Split and Macro

Shift is split, Q is macro

  1. // ==UserScript==
  2. // @name Split and Macro
  3. // @namespace agar.io
  4. // @version 2
  5. // @description Shift is split, Q is macro
  6. // @author ReaperAgario
  7. // @match http://agar.io/*
  8. // @match http://www.agar.re/
  9. // @match http://play.ogarul.tk/
  10. // @grant none
  11. // ==/UserScript==
  12. / jshint -W097 /
  13. 'use strict';
  14.  
  15. var SplitInterval;
  16. var MacroInterval;
  17. var SplitDebounce = false;
  18. var MacroDebounce = false;
  19. $(document).on('keydown', function(input) {
  20. console.log("got keydown")
  21. if (input.keyCode == 16) {
  22. if (SplitDebounce) {
  23. return;
  24. }
  25. SplitDebounce = true;
  26. SplitInterval = setInterval(function() {
  27. $("body").trigger($.Event("keydown", {
  28. keyCode: 32
  29. }));
  30. $("body").trigger($.Event("keyup", {
  31. keyCode: 32
  32. }));
  33. }, 0);
  34. } else if (input.keyCode == 81) {
  35. if (MacroDebounce) {
  36. return;
  37. }
  38. MacroDebounce = true;
  39. MacroInterval = setInterval(function() {
  40. $("body").trigger($.Event("keydown", {
  41. keyCode: 87
  42. }));
  43. $("body").trigger($.Event("keyup", {
  44. keyCode: 87
  45. }));
  46. }, 0);
  47. }
  48. })
  49.  
  50. $(document).on('keyup', function(input) {
  51. if (input.keyCode == 16) {
  52. SplitDebounce = false;
  53. clearInterval(SplitInterval);
  54. return;
  55. } else if (input.keyCode == 81) {
  56. MacroDebounce = false;
  57. clearInterval(MacroInterval);
  58. return;
  59. }
  60. })