mirror of
https://github.com/Luzifer/automate-cookie-clicker.git
synced 2024-12-23 02:31:18 +00:00
Track CPS and handle script clicking
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
9a5b1adba5
commit
d9877b6413
1 changed files with 14 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Automate CookieClicker
|
// @name Automate CookieClicker
|
||||||
// @namespace https://luzifer.io/
|
// @namespace https://luzifer.io/
|
||||||
// @version 0.4.0
|
// @version 0.5.0
|
||||||
// @description Automate everything!
|
// @description Automate everything!
|
||||||
// @author Knut Ahlers <knut@ahlers.me>
|
// @author Knut Ahlers <knut@ahlers.me>
|
||||||
// @match http://orteil.dashnet.org/cookieclicker/
|
// @match http://orteil.dashnet.org/cookieclicker/
|
||||||
|
@ -40,6 +40,18 @@ function autoPurchaseUpgrades() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkCPS() {
|
||||||
|
let cps = parseInt($('#cookies').children('div').text().split(': ')[1]);
|
||||||
|
if (cps < 3000 && window.autoClicker == undefined) {
|
||||||
|
window.autoClicker = window.setInterval(autoClick, 1);
|
||||||
|
} else {
|
||||||
|
if (window.autoClicker != undefined) {
|
||||||
|
window.clearInterval(window.autoClicker);
|
||||||
|
window.autoClicker = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function debug(msg) {
|
function debug(msg) {
|
||||||
console.log("[AutoCookieClicker] " + msg);
|
console.log("[AutoCookieClicker] " + msg);
|
||||||
}
|
}
|
||||||
|
@ -66,10 +78,7 @@ function debug(msg) {
|
||||||
"hideMethod": "fadeOut"
|
"hideMethod": "fadeOut"
|
||||||
};
|
};
|
||||||
|
|
||||||
let cps = parseInt($('#cookies').children('div').text().split(': ')[1]);
|
window.checkCPS = window.setInterval(checkCPS, 1000);
|
||||||
if (cps == 0) {
|
|
||||||
window.autoClicker = window.setInterval(autoClick, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable automatic purchasing of upgrades / elements
|
// Enable automatic purchasing of upgrades / elements
|
||||||
window.autoPurchase = window.setInterval(autoPurchaseUpgrades, 500);
|
window.autoPurchase = window.setInterval(autoPurchaseUpgrades, 500);
|
||||||
|
|
Loading…
Reference in a new issue