Bug - Fixed "Quests > Hedge Maze Traps" infinite loop burns all adventures bug

taltamir

Member
Using the built in quest script under "Quest" in mafia to select "hedge maze traps" without an auto heal script and insufficient starting resistance/HP can result in infinite loop of burning all your adventures.

It should automatically abort that script if you become beaten up. There might be an assumption of 0HP after being beaten up (requiring manual healing to adventure again), but with passive HP regen you actually end up with positive HP after being beaten up and can immediately adventure again.


Code:
You are currently in room 0 and it will take you 4 turns to clear the maze.
Entering the Hedge Maze...


[1325] The Hedge Maze (Room 1)
Encounter: 'Allo


[1326] The Hedge Maze (Room 4)
Encounter: Pooling Your Resources
You lose 256 hit points


[1327] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 302 hit points
You lose 265 hit points


[1328] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 214 hit points


[1329] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 214 hit points


[1330] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 215 hit points


[1331] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 215 hit points


[1332] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 215 hit points


[1333] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 114 hit points


[1334] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 115 hit points


[1335] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 115 hit points


[1336] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 115 hit points


[1337] The Hedge Maze (Room 7)
Encounter: Of Mouseholes and Manholes
You lose 114 hit points
 

fronobulax

Developer
Staff member
This is why many people have a mood that aborts when they get Beaten Up.

Not suggesting it doesn't need to be addressed in mafia but this will ease the pain until it is.
 

taltamir

Member
This is why many people have a mood that aborts when they get Beaten Up.

Not suggesting it doesn't need to be addressed in mafia but this will ease the pain until it is.
Good points.

IIRC I had just switched to a new mood that happened to have no had that in it.
Is there some sort of universal mood that is automatically appended to all other moods?
If not then a good feature to add might be for a checkbox option to "auto abort automation when beaten up" without relying on moods to do so.

anyways, this is going off on a tangent. sorry about that.
 

taltamir

Member
So that is why I disabled the mood abort on beaten up... it aborts the universal recovery script i use to heal
 

AlbinoRhino

Active member
It aborts the recovery script? Or, automation aborts before the recovery script runs? If the latter, then, after an abort, you should be able to type "restore hp" or similar action and trigger your recovery script.
 

taltamir

Member
It aborts the recovery script? Or, automation aborts before the recovery script runs? If the latter, then, after an abort, you should be able to type "restore hp" or similar action and trigger your recovery script.
I was playing manually, I lost a fight.
I was sitting at 0HP and beaten up on the main map.
I clicked on my HP at the status bar to run the currently configured recovery script
It was aborted before it could heal me by the mood
I did not try to go an adventure (which would have also ran the recovery script, but I happened to have tried to call it manually that time)
 
Last edited:

Darzil

Developer
So, looking at the code, it shouldn't continue unless recovery says it can.

r18613 adds a check that you will survive automation, and prompts if you won't - lightly tested.
r18614 adds a check for whether you succeed a test, and aborts if you don't - using wiki text, so may not work right.

I'll may never use this code, so let me know if it works!
 

taltamir

Member
Thank you for the fix. I just tested it, I indeed got the message "you won't survive" asking if I am sure I want to proceed.
I had forgotten to disable auto recovery script for the test, but even with it I still failed and it still auto halted... anyways, this is the results I got

You are currently in room 0 and it will take you 4 turns to clear the maze.
Restoring HP! Currently at 114 of 151 HP, 149 of 149 MP, current meat: 34000 ... Target HP = 151.
Casting Shake It Off 1 times...
You gain 37 hit points
Shake It Off was successfully cast.
Entering the Hedge Maze...

[1160] The Hedge Maze (Room 1)
Encounter: 'Allo

[1161] The Hedge Maze (Room 4)
Encounter: Pooling Your Resources
You lose 136 hit points
You lose 120 hit points
Requests complete.
As you can see, it has successfully stopped when I failed after spending 2 adventures only.

Can't really test this for all 15 possible results since mafia log doesn't seem to indicate which of those I got. But it seems to work.

BTW, can someone mark this bug as fixed? its still marked as open.
 

taltamir

Member
Great! Generally don't mark as fixed until verified fixed, and you just have!
Thank you.

I actually just had an idea. Can you modify it so that when it does auto stop, it informs you which room and energy type brought you to zero by printing it to the CLI?

This way I could test until I confirm all 15 possible options result in a stop. Since, as you said, you used wiki text for it and thus can't be 100% sure it works for all the 15 failure possibilities.
... or, actually would it be 15? there are 5 energy type possibilities per room, but regardless of what the energy type is you still lose. So would it be just testing all 3 possible failure rooms?
 

Darzil

Developer
All that information is held in preferences:
currentHedgeMazeRoom - current room, 1 to 9.
nsChallenge3 - element of first trap
nsChallenge4 - element of second trap
nsChallenge5 - element of third trap
 

taltamir

Member
All that information is held in preferences:
currentHedgeMazeRoom - current room, 1 to 9.
nsChallenge3 - element of first trap
nsChallenge4 - element of second trap
nsChallenge5 - element of third trap
I do not understand what you are saying here.
The element of the room is randomly rolled for by KoL... what does kolmafia preferences have to do with it?
Or are you saying that kolmafia records the last element encountered in that room into the preferences file?
 

lostcalpolydude

Developer
Staff member
I do not understand what you are saying here.
The element of the room is randomly rolled for by KoL... what does kolmafia preferences have to do with it?
Or are you saying that kolmafia records the last element encountered in that room into the preferences file?

The element is chosen when you start your ascension. If you have an upgraded telescope, you can see it long before you reach the tower, and those preferences track it. I don't know if those preferences are useful without a telescope.
 

Darzil

Developer
The element is chosen when you start your ascension. If you have an upgraded telescope, you can see it long before you reach the tower, and those preferences track it. I don't know if those preferences are useful without a telescope.
Without the telescope they are set when you see them, so once you've hit the encounter and been defeated, they are relevant.
 

taltamir

Member
The element is chosen when you start your ascension. If you have an upgraded telescope, you can see it long before you reach the tower, and those preferences track it. I don't know if those preferences are useful without a telescope.
Without the telescope they are set when you see them, so once you've hit the encounter and been defeated, they are relevant.
Thanks for clarifying, I do not have a telescope.

so just to be clear, it is randomized per ascension, but will not change between attempts on the same ascension, and will populate when I encounter it?
what would be the CLI command to look it up? I know "set" can be used to change a setting but not how to print it to the CLI
 

Ethelred

Member
Thanks for clarifying, I do not have a telescope.

...
what would be the CLI command to look it up? I know "set" can be used to change a setting but not how to print it to the CLI

The "get" cli command will display the current value of the specified property. See "help get" for additional details.
 

taltamir

Member
The "get" cli command will display the current value of the specified property. See "help get" for additional details.
Thank you.

I don't understand why but for some reason I am unable to prevent it from auto healing before entering the maze. Even when disabling all scripts which I think should have done it, it still automatically casts shake it off each time i run the hedge maze script. So it is impossible to fail on the first step. Probably on purpose as part of this fix.

Testing:

get nsChallenge3
The Hedge Maze (Room 1) - 'Allo:
Can't fail so long as it auto heals before entering.

get nsChallenge4
The Hedge Maze (Room 4) - Pooling Your Resources:
hot - successfully autoaborts on failure
stench - successfully autoaborts on failure
spooky - successfully autoaborts on failure

get nsChallenge5
The Hedge Maze (Room 7) - Of Mouseholes and Manholes:
stench - successfully autoaborts on failure
sleaze - successfully autoaborts on failure
spooky - successfully autoaborts on failure
hot - successfully autoaborts on failure
 
Last edited:
Top