Auto Stickers for NT

Forget to show your stickers in a race? This script will help you!

  1. // ==UserScript==
  2. // @name Auto Stickers for NT
  3. // @namespace https://singdev.wixsite.com/sing-developments/nitro
  4. // @version 2.0
  5. // @description Forget to show your stickers in a race? This script will help you!
  6. // @author Sing Developments
  7. // @match https://nitrotype.com/race
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Define the frequency of hitting the shift key (in milliseconds) and posting stickers
  15. var shift_key_interval = 10000; // Interval to hit the shift key (in milliseconds)
  16. var frequency_of_stickers = 50; // Adjust this value for different frequencies
  17.  
  18. // Function to check if the page is fully loaded
  19. function isPageFullyLoaded() {
  20. return document.readyState === 'complete';
  21. }
  22.  
  23. // Function to click the chat picker button and post stickers
  24. function click_the_b(a) {
  25. // Hit the shift key periodically
  26. setInterval(function() {
  27. simulateKeyEvent('keydown', 16); // 16 is the keycode for the shift key
  28. simulateKeyEvent('keyup', 16);
  29. }, shift_key_interval);
  30.  
  31. // Check if a sticker should be posted based on frequency
  32. if (Math.random() * 100 <= frequency_of_stickers) {
  33. var total_choices = a.length;
  34. var current_choice = Math.floor(Math.random() * total_choices);
  35. a[current_choice].click();
  36. }
  37. }
  38.  
  39. // Function to simulate keyboard events
  40. function simulateKeyEvent(type, keyCode) {
  41. var event = new KeyboardEvent(type, {
  42. bubbles: true,
  43. keyCode: keyCode,
  44. which: keyCode // Specify the 'which' property for better compatibility
  45. });
  46. document.dispatchEvent(event);
  47. }
  48.  
  49. // Wait for the page to fully load before performing any actions
  50. var checkPageInterval = setInterval(function() {
  51. if (isPageFullyLoaded()) {
  52. clearInterval(checkPageInterval);
  53.  
  54. // Check for the presence of the chat picker button
  55. var a = document.getElementsByClassName('raceChat-pickerOpt');
  56. if (a.length > 0) {
  57. click_the_b(a);
  58. }
  59. }
  60. }, 100); // Check every 100ms if the page is fully loaded
  61. })();