Prediction Toggle

Toggles net_predict_movement

  1. // ==UserScript==
  2. // @name Prediction Toggle
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.0
  5. // @description Toggles net_predict_movement
  6. // @author Altanis#6362
  7. // @match https://diep.io/
  8. // @grant none
  9. // ==/UserScript==
  10. (async function() {
  11. 'use strict';
  12.  
  13. var GUI1 = document.createElement("div");
  14. GUI1.style = `pointer-events: none; position: fixed; top:10px; left:10px; font-family: Ubuntu; color: #FFFFFF; font-style: normal; font-size: 17px; text-shadow: black 2px 0px, black -2px 0px, black 0px -2px, black 0px 2px, black 2px 2px, black -2px 2px, black 2px -2px, black -2px -2px, black 1px 2px, black -1px 2px, black 1px -2px, black -1px -2px, black 2px 1px, black -2px 1px, black 2px -1px, black -2px -1px;`;
  15. document.body.appendChild(GUI1);
  16. GUI1.innerHTML = `<div style='
  17. border: 6px solid transparent
  18. border-image: linear-gradient(to bottom right, #b827fc 0%, #2c90fc 25%, #b8fd33 50%, #fec837 75%, #fd1892 100%);
  19. border-image-slice: 1;
  20. padding: 0px 9px;
  21. opacity:0.9;
  22. align-content: center;'>
  23. <p>
  24. [P]: Disable Prediction
  25. <p>
  26. [Y]: Toggle GUI
  27.  
  28. <p style="font-size: 10px;">
  29. Script by: Altanis#6362
  30. </p>
  31. </div>`;
  32.  
  33. const prediction = {
  34. enabled: true
  35. };
  36.  
  37. document.addEventListener('keydown', async event => {
  38. if (event.keyCode == 80 || event.which == 80) {
  39. prediction['enabled'] = !prediction['enabled'];
  40. window.input.execute('net_predict_movement ' + prediction['enabled']);
  41.  
  42. if (GUI1.innerHTML == '') return;
  43.  
  44. GUI1.innerHTML = `<div style='
  45. border: 6px solid transparent
  46. border-image: linear-gradient(to bottom right, #b827fc 0%, #2c90fc 25%, #b8fd33 50%, #fec837 75%, #fd1892 100%);
  47. border-image-slice: 1;
  48. padding: 0px 9px;
  49. opacity:0.9;
  50. align-content: center;'>
  51. <p>
  52. [P]: ${prediction['enabled'] ? 'Disable' : 'Enable'} Prediction
  53. <p>
  54. [Y]: Toggle GUI
  55.  
  56. <p style="font-size: 10px;">
  57. Script by: Altanis#1261
  58. </p>
  59. </div>`;
  60. } else if (event.keyCode == 89 || event.which == 89) {
  61. if (GUI1.innerHTML == false) {
  62. GUI1.innerHTML = `<div style='
  63. border: 6px solid transparent
  64. border-image: linear-gradient(to bottom right, #b827fc 0%, #2c90fc 25%, #b8fd33 50%, #fec837 75%, #fd1892 100%);
  65. border-image-slice: 1;
  66. padding: 0px 9px;
  67. opacity:0.9;
  68. align-content: center;'>
  69. <p>
  70. [P]: ${prediction['enabled'] ? 'Disable' : 'Enable'} Prediction
  71. <p>
  72. [Y]: Toggle GUI
  73.  
  74. <p style="font-size: 10px;">
  75. Script by: Altanis#1261
  76. </p>
  77. </div>`;
  78. } else {
  79. GUI1.innerHTML = '';
  80. }
  81. }
  82. });
  83. })();