diff --git a/CUnleash.js b/CUnleash.js index 86eda94..c1cabcb 100644 --- a/CUnleash.js +++ b/CUnleash.js @@ -25,12 +25,11 @@ setInterval(function () { (function () { "use strict"; - let state = true; + let state = false; let intervalId; document.addEventListener("keydown", function (event) { if (event.code === "KeyX") { - state = !state; // toggle state if (state) { // code to run when state is ON console.log("State is ON"); @@ -49,21 +48,23 @@ setInterval(function () { intervalId = setInterval(function () { Game.ClickCookie(); }, 4); + state = true; } function stopAutoClicker() { console.log("Auto-clicker stopped"); Game.Notify(`Auto clicker OFF`, `Press X to toggle`, [0, 35], false); clearInterval(intervalId); + state = false; } // Wait for the Game object to be defined, then start the auto-clicker - const waitIntervalId = setInterval(function () { - if (typeof Game !== "undefined") { - clearInterval(waitIntervalId); - stopAutoClicker(); - } - }, 1000); + // const waitIntervalId = setInterval(function () { + // if (typeof Game !== "undefined") { + // clearInterval(waitIntervalId); + // stopAutoClicker(); + // } + // }, 1000); })(); // setInterval(function() {