From 1cd1089add829e2dadf41717a6d6bdb9da481187 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 25 Apr 2018 13:01:40 +0200 Subject: [PATCH] Fix: Don't endless loop Signed-off-by: Knut Ahlers --- autocookieclicker.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autocookieclicker.user.js b/autocookieclicker.user.js index 6b14e0d..9687528 100644 --- a/autocookieclicker.user.js +++ b/autocookieclicker.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Automate CookieClicker // @namespace https://luzifer.io/ -// @version 0.21.0 +// @version 0.21.1 // @description Automate everything! // @author Knut Ahlers // @source https://github.com/Luzifer/automate-cookie-clicker @@ -56,7 +56,7 @@ function executeAutoActions() { while (availableProducts.length > 0 && Game.buyMode === 1) { // buyMode 1 = buy, -1 = sell let product = availableProducts[availableProducts.length - 1]; - for (let buyAmount = purchaseSteps - product.amount; buyAmount > 0; buyAmount--) { + for (let buyAmount = purchaseSteps; buyAmount > 0; buyAmount--) { if (product.getSumPrice(buyAmount) <= Game.cookies) { product.buy(buyAmount); note(`Purchased ${buyAmount} ${buyAmount === 1 ? product.name : product.plural} for you.`);