Skip to content

Instantly share code, notes, and snippets.

@Vany
Last active June 6, 2020 22:03
Show Gist options
  • Save Vany/bbda1a93c4ad91c18b609c3b7f955b58 to your computer and use it in GitHub Desktop.
Save Vany/bbda1a93c4ad91c18b609c3b7f955b58 to your computer and use it in GitHub Desktop.
Cookieclicker autoplay scripts
function GoldenCookieClick() {
let c = document.getElementsByClassName("shimmer");
if (!c) return;
for (let s of c) {
if (!s) return;
if (s.wrath>0) return;
s.click();
}
}
setInterval(GoldenCookieClick, 1000);
function WhatToBuy() {
let mid="";
let mfreq=0;
Game.ObjectsById.forEach(me => {
let freq = me.cps(me) / me.bulkPrice;
if (mfreq < freq) {
mid = me.id;
mfreq = freq;
}
})
return mid;
}
function Buy() {
let id = WhatToBuy();
if (id == "") {
console.log("nothing to buy")
}
let target = Game.ObjectsById[id];
if (target.price > Game.cookies ) {
console.log("Want " + target.name);
return false;
}
target.buy(1);
return true;
}
function PopWrinkler() {
if (Game.wrinklers.filter(e => e.phase == 2).length != Game.getWrinklersMax()) return;
let mid = "";
let sucked = 0;
Game.wrinklers.forEach(w => {
if (w.sucked>sucked) {
mid = w.id;
sucked = w.sucked
}
});
Game.wrinklers[mid].hp=0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment