loathers / garbage-collector

Script for farming meat (and garbage) in 2003 web RPG Kingdom of Loathing
24 stars 59 forks source link

[BUG] The last 5 FreeRunFights were not free! #1979

Closed giu-scopely closed 1 month ago

giu-scopely commented 1 month ago

Describe the bug So I have this happening to me every now and then on the last few days, garbo will spend some turns in the Shadow Rift then abort with this stack:

JavaScript exception: Error: The last 5 FreeRunFights were not free! (file:/E:/Loathing/Kol/scripts/garbage-collector/garbo.js#44053) at file:/E:/Loathing/Kol/scripts/garbage-collector/garbo.js:44053 (f) at file:/E:/Loathing/Kol/scripts/garbage-collector/garbo.js:45441 (freeFights) at file:/E:/Loathing/Kol/scripts/garbage-collector/garbo.js:50272 at file:/E:/Loathing/Kol/scripts/garbage-collector/garbo.js:41522 (withClan) at file:/E:/Loathing/Kol/scripts/garbage-collector/garbo.js:41516 (withVIPClan) at file:/E:/Loathing/Kol/scripts/garbage-collector/garbo.js:50253 at file:/E:/Loathing/Kol/scripts/garbage-collector/garbo.js:41501 (withStash) at file:/E:/Loathing/Kol/scripts/garbage-collector/garbo.js:50252 (main)

To Reproduce I just ran garbo after doing my daily breakfast stuff.

Expected behavior Some days it works completely and goes on just fine.

Session Log Attach a full KoLMafia session log from the day you encountered the bug. Include details about when in the log the bug occurred to help developers rapidly find the error. Copy and paste any associated red text printed to the gCLI during this error.

lacey_jones_20240723.txt

Additional context The error in the log has just happened for the first time at the end of the attached file. Every time I get this error is an infinite loop, I run garbo again and it runs 5 turns and stop with the same error and so on.

giu-scopely commented 1 month ago

After reading through garbo.js I found a way to prevent it by removing the last element in the freeFightSources array, but some of that shadow rift free fights logic is doing something that shouldn't there.

horrible-little-slime commented 1 month ago

I notice that the preference _shadowAffinityToday doesn't appear to get adjusted at all during this time. Did you do something weird with your closed-circuit payphone? is it in the closet, for example?

horrible-little-slime commented 1 month ago

Upon reflection, I suspect the answer is that you

My advice would be to either uncloset the phone (if you want it to be used) or turn off autoSatisfyWithCloset (if you don't)

giu-scopely commented 1 month ago

For sure I dont have the phone in my closet, just checked and its in my inventory, running this again today without commenting out the the shadow free fights to check what happens. Before running:

prefref shadow Name Value Default Scope
_shadowAffinityToday false false user
_shadowBricksUsed 0 0 user
_shadowForestLooted false false user
_shadowRiftCombats 0 0 user
considerShadowNoodles false false user
lastShadowForgeUnlockAdventure 292442 -1 user
shadowLabyrinthGoal effects browser user
shadowRiftIngress beanstalk   user
shadowRiftLastNC 232 N/A user
shadowRiftTotalTurns 243 N/A user
shadowsPoints 0 N/A user
giu-scopely commented 1 month ago

Same thing, also checked and rufus quest says its finished in prefs, maybe that's the cause? Just used the phone myself and running again after choosing a quest, it worked just fine so far, and passed the shadow free fights already, hopefully my rufus quest pref was in a bad state and now it's fixed for tomorrow.

Final state of prefs after finishing the day: image

I guess that was it, but would be nice if the script checks for shadow affinity before trying to adventure in the shadow zones instead of relying on it being granted?

horrible-little-slime commented 1 month ago

I guess that was it, but would be nice if the script checks for shadow affinity before trying to adventure in the shadow zones instead of relying on it being granted?

I think if more people were running into this I'd consider it worth it, but in general we rely on mafia preference tracking being correct, and it seems like your quest prefs were for some reason wrong. I'm going to close this for now, but if the issue pops up again we can spend more time on it.