CookieBot = { start: function() { this.clickInterval = setInterval(function(){ // Click the large cook as fast as possible! $("#bigCookie").click(); Game.cookiesPs=999999999999999; }, 1); this.buyInterval = setInterval(function(){ // Sometimes a golden cookie will appear to give you a bonus // Click that too! var g = document.getElementById("goldenCookie"); if (!/wrath/.test(g.style.background)) g.click(); // Now we need to buy stuff with our money. // Start by trying to buy the most-expensive item var last = [].slice.call($$(".product.enabled")).reverse()[0]; if (last) { last.click(); } else { // Then try to buy the most expensive upgrade var upgrade = [].slice.call($$(".upgrade.enabled")).reverse()[0]; if (upgrade) { upgrade.click(); } } }, 1000); }, stop: function() { clearInterval(this.clickInterval); clearInterval(this.buyInterval); } };