Bubleroyal.com macro

shift - autosplit | 1,2,3,4,5 - splits | qasd - movement

  1. // ==UserScript==
  2. // @name Bubleroyal.com macro
  3. // @namespace https://discord.gg/p56aQHNU9U
  4. // @version 1.0
  5. // @description shift - autosplit | 1,2,3,4,5 - splits | qasd - movement
  6. // @author DD7
  7. // @match *://bubleroyal.com/*
  8. // @run-at document-start
  9. // @grant none
  10. // ==/UserScript==
  11. let splitInterval = null, splitSwitch = false;
  12.  
  13. function split(times) {
  14. for(let i = 0; i < times; i++) {
  15. setTimeout(function() {
  16. $("body").trigger($.Event("keydown", { keyCode: 32 }));
  17. $("body").trigger($.Event("keyup", { keyCode: 32 }));
  18. }, 50 * i);
  19. }
  20. }
  21.  
  22. function goTo(x, y) {
  23. x = window.innerWidth / x; y = window.innerHeight / y;
  24. $("canvas").trigger($.Event("mousemove", {clientX: x, clientY: y}));
  25. }
  26.  
  27. function keydown(e) {
  28. const chat = document.querySelector("#chat_textbox");
  29. if(chat === document.activeElement) return;
  30.  
  31. const key = e.key;
  32. switch(key) {
  33. case "Shift":
  34. if(splitSwitch) return;
  35.  
  36. splitSwitch = true;
  37. splitInterval = setInterval(() => {
  38. $("body").trigger($.Event("keydown", { keyCode: 32 }));
  39. $("body").trigger($.Event("keyup", { keyCode: 32 }));
  40. }, 4);
  41. break;
  42.  
  43. case "1":
  44. split(1);
  45. break;
  46.  
  47. case "2":
  48. split(2);
  49. break;
  50.  
  51. case "3":
  52. split(3);
  53. break;
  54.  
  55. case "4":
  56. split(4);
  57. break;
  58.  
  59. case "5":
  60. split(5);
  61. break;
  62.  
  63. case "q":
  64. goTo(2, -0.6);
  65. break;
  66.  
  67. case "a":
  68. goTo(-0.6, 2);
  69. break;
  70.  
  71. case "s":
  72. goTo(2, 0.6);
  73. break;
  74.  
  75. case "d":
  76. goTo(0.6, 2);
  77. break;
  78. }
  79. }
  80.  
  81. function keyup(e) {
  82. const chat = document.querySelector("#chat_textbox");
  83. if(chat === document.activeElement) return;
  84.  
  85. const key = e.key;
  86. switch(key) {
  87. case "Shift":
  88. clearInterval(splitInterval);
  89. splitSwitch = false;
  90. return;
  91. }
  92. }
  93.  
  94. document.addEventListener("keydown", keydown);
  95. document.addEventListener("keyup", keyup);
  96.  
  97. console.log("Created by DD7");