Alistair1231 / Kittens-Game-automation-and-tools

kittens game bot
1 stars 2 forks source link

Infinite loop when there is enough slabs to make concrete but not enough steel #1

Open huner15 opened 6 years ago

huner15 commented 6 years ago

if(gamePage.resPool.get('slab').value > 120000 && gamePage.resPool.get('concrate').unlocked) while(gamePage.resPool.get('slab').value > 90000) gamePage.craft(gamePage.resPool.get('concrate').name,1); So Ran into lock ups in my game, paused the execution in the debugger and it came up with this. I noticed that there wasn't enough steel to make concrete which with the while loop logic here would end in an infinite loop since if you're note crafting any concrete then the slab count won't be going down, would recommend added a check to the amount of steel as well.

Alistair1231 commented 6 years ago

really? That was a bug I fixed...

gamePage.craft(gamePage.resPool.get('concrate').name,1);

is in a while loop, when I run the line it crafts concrete, so it shouldn't loop infinitely... Try reinstalling the script. maybe I forgot to change Version number when I patched it so it didn't update automatically...

huner15 commented 6 years ago

The version i'm running is identical to the one on GitHub.

The issue with the while loop is that its waiting for the slab count to be <90001 but if you run out of steel before that point then the loop will not exit as you still meet the condition of slab count > 90000 and then your trapped.