Nitrotype Auto Typing Bot

Automatically types during Nitrotype races with customizable settings.

  1. // ==UserScript==
  2. // @name Nitrotype Auto Typing Bot
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Automatically types during Nitrotype races with customizable settings.
  6. // @author Simeon
  7. // @match *://www.nitrotype.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. let raceText = '';
  16. let typingDelay = 200; // Default typing delay
  17. let accuracy = 100; // Default accuracy
  18. let totalRaces = 1; // Default number of races
  19. let currentRaceCount = 0; // Current race counter
  20.  
  21. // Create a UI for settings
  22. const createUI = () => {
  23. const uiDiv = document.createElement('div');
  24. uiDiv.style.position = 'fixed';
  25. uiDiv.style.top = '10px';
  26. uiDiv.style.right = '10px';
  27. uiDiv.style.backgroundColor = 'white';
  28. uiDiv.style.padding = '10px';
  29. uiDiv.style.zIndex = '1000';
  30. uiDiv.style.border = '1px solid black';
  31.  
  32. uiDiv.innerHTML = `
  33. <h4>Nitrotype Auto Typing Bot</h4>
  34. <label for="wpm">Desired WPM:</label>
  35. <input type="number" id="wpm" min="1" value="40">
  36. <br>
  37. <label for="accuracy">Accuracy (%):</label>
  38. <input type="number" id="accuracy" min="0" max="100" value="100">
  39. <br>
  40. <label for="races">Number of Races:</label>
  41. <input type="number" id="races" min="1" value="1">
  42. <br>
  43. <button id="startRacing">Start Racing</button>
  44. `;
  45.  
  46. document.body.appendChild(uiDiv);
  47.  
  48. // Start racing on button click
  49. document.getElementById('startRacing').addEventListener('click', () => {
  50. const wpm = parseInt(document.getElementById('wpm').value);
  51. accuracy = parseInt(document.getElementById('accuracy').value);
  52. totalRaces = parseInt(document.getElementById('races').value);
  53. typingDelay = (60000 / wpm) / 5; // Calculate typing delay based on WPM
  54. currentRaceCount = 0; // Reset race counter
  55. alert("Settings saved! The bot will start racing.");
  56. });
  57. };
  58.  
  59. // Detect race text and start typing
  60. const detectRaceText = () => {
  61. const textElement = document.querySelector('.race-text'); // Adjust selector as needed
  62. if (textElement) {
  63. raceText = textElement.innerText;
  64. console.log("Detected race text:", raceText);
  65. setTimeout(() => {
  66. simulateTyping(raceText);
  67. }, 3000); // Delay before typing
  68. }
  69. };
  70.  
  71. const simulateTyping = (text) => {
  72. const inputField = document.querySelector('.input-field'); // Adjust selector as needed
  73. if (inputField) {
  74. inputField.focus();
  75. let lastIndex = 0;
  76.  
  77. const typeNextCharacter = () => {
  78. if (lastIndex < text.length) {
  79. const isAccurate = Math.random() * 100 < accuracy; // Determine if the character is accurate
  80. const charToType = isAccurate ? text[lastIndex] : getRandomCharacter();
  81.  
  82. inputField.value += charToType; // Append character
  83. inputField.dispatchEvent(new Event('input')); // Trigger input event
  84.  
  85. lastIndex++;
  86. const delay = typingDelay + Math.random() * 50; // Randomize delay for realism
  87. setTimeout(typeNextCharacter, delay);
  88. } else {
  89. currentRaceCount++;
  90. if (currentRaceCount < totalRaces) {
  91. setTimeout(detectRaceText, 3000); // Delay before the next race
  92. }
  93. }
  94. };
  95.  
  96. typeNextCharacter();
  97. }
  98. };
  99.  
  100. const getRandomCharacter = () => {
  101. const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789":?-*\.,; ';
  102. return characters.charAt(Math.floor(Math.random() * characters.length));
  103. };
  104.  
  105. // Monitor for race events
  106. const raceObserver = new MutationObserver(detectRaceText);
  107. raceObserver.observe(document.body, { childList: true, subtree: true });
  108.  
  109. // Initialize the UI
  110. createUI();
  111. })();