Slither.io script (Tariq)

s to pause, q to split 16, left mouse click is to feed.

  1. // ==UserScript==
  2. // @name Slither.io script (Tariq)
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.15
  5. // @description s to pause, q to split 16, left mouse click is to feed.
  6. // @author All credits belong to Ali Ahfad Mehdi, I only edited a few lines and modified it to pause whenever a user is typing in chat.- GoogleFutanari.
  7. // @match http://slither.io/*
  8. // @grant none
  9. // @run-at document-end
  10. // @license MIT
  11. // ==/UserScript==
  12. window.addEventListener('keydown', keydown);
  13. window.addEventListener('keyup', keyup);
  14. var Feed = false;
  15. var Speed = 25;
  16. //Funtions
  17. function split() {
  18. $("body").trigger($.Event("keydown", { keyCode: 32}));
  19. // $("body").trigger($.Event("keyup", { keyCode: 32}));
  20. }
  21. function mass() {
  22. if (Feed) {
  23. window.onkeydown({keyCode: 87});
  24. window.onkeyup({keyCode: 87});
  25. setTimeout(mass, Speed);
  26. }
  27. }
  28. function keydown(event) {
  29. // Feed Macro
  30. var dummyEl = document.getElementById('chat_textbox');
  31. //only execute the following code if the chatbox is not active.
  32. console.log(dummyEl == document.activeElement);
  33. if(!(dummyEl == document.activeElement)){
  34. if (event.keyCode == 69 ) // E
  35. {
  36. Feed = true;
  37. setTimeout(mass, Speed);
  38. }// Center(this pauses your blob)
  39. if (event.keyCode == 83) { // S
  40. var X = window.innerWidth/2;
  41. var Y = window.innerHeight/2;
  42. $("canvas").trigger($.Event("mousemove", {clientX: X, clientY: Y}));
  43. }
  44. // Tricksplit
  45. if (event.keyCode == 81) { // q
  46. split();
  47. setTimeout(split, Speed);
  48. setTimeout(split, Speed*2);
  49. setTimeout(split, Speed*3);
  50. setTimeout(split, Speed*4);
  51. } // Triplesplit
  52. if (event.keyCode == 32) { // spacebar
  53. split();
  54. setTimeout(split, Speed);
  55. setTimeout(split, Speed*2);
  56. } // Doublesplit
  57. if (event.keyCode == 48) { // d for double split
  58. split();
  59. setTimeout(split, Speed);
  60. }// Split
  61. if (event.keyCode == 'yourkey' || event.keyCode == 'yourkey2') { // Put in Your Key
  62. split();
  63. }
  64. }
  65. } // When Player Lets Go Of E, It Stops Feeding
  66. function keyup(event) {
  67. if (event.keyCode == 69 || event.keyCode == 83) {
  68. Feed = false;
  69. }
  70. }
  71. //Mouse Clicks
  72. (function() {
  73. document.getElementById("canvas").addEventListener("mousedown", function(event) {
  74. if (event.which == 1) {
  75. Feed = true;
  76. setTimeout(mass, Speed);
  77. }
  78. else if (event.which == 2) {
  79. split();
  80. setTimeout(split, Speed);
  81. setTimeout(split, Speed*2);
  82. setTimeout(split, Speed*3);
  83. }
  84. });
  85. document.getElementById("canvas").addEventListener("mouseup", function(event) {
  86. if (event.which == 1) {
  87. Feed = false;
  88. }
  89. });
  90. $('#canvas').bind('contextmenu', function(e) {
  91. e.preventDefault();
  92. });
  93. }());
  94. //Go Ahead, Mess Around. ( ͡ᵔ ͜ʖ ͡ᵔ )
  95. //CREDITS TO: JACK BURCH AND TOM BURRIS
  96. //Thanks Guys You Inspired Me.