Bug - Fixed KoLmafia refuses to abort when requested by the user (Elevator Action noncombat)

Mr_Crac

Member
I am running the bumcheekascend script and it is doing the Hidden City part of the Level 11 quest. KoLmafia version r13074. For some reason, it gets stuck in the Elevator Action noncombat. This in itself would not be so bad if I could abort the script, but KoLmafia does not let me do this. I am pressing the "Escape" key like a madman, or trying the "stop now" button, but to no avail. Here is a screenshot:

http://abload.de/img/kolmafia_wont_abortjwf28.jpg

So I had to log out of the game, and log in again. I then saw some note when re-logging in: "Unsupported choice adventure #780". I *think* it was that number, not 100% sure. Also, this:

Installing default certificate validation...
Validating login server (www.kingdomofloathing.com)...
414 players online.
Sending login request...
guild.php: redirected to a choice page.
guild.php: redirected to a choice page.
guild.php: redirected to a choice page.
guild.php: redirected to a choice page.
guild.php: redirected to a choice page.
guild.php: redirected to a choice page.
charsheet.php: redirected to a choice page.


This sucks. :( Please fix :)

EDIT: Could this be similar to this one - http://kolmafia.us/showthread.php?1...oice-adventure-in-the-Top-Floor-of-the-Castle
 
Last edited:

Darzil

Developer
Can you do "get choiceAdventure780" (without quotes) at the cli and give the result, that will show which option was selected. Did you have Thrice-cursed at the time?

Looking at the code the only thing I saw was that if you'd already killed the spirit it would try to banish lawyers rather than skipping. If KoL has changed so that you can only banish lawyers once, and the script didn't realise you'd already killed the spirits, it would have that effect. If the penthouse empty message had changed, and Mafia hadn't picked up the spirit defeat, that would also cause this. Will take a look.

Edit - Can't replicate this yet. The penthouse message isn't changed by the sword at least, so quest progress detection works, and changes decisions correctly to one that won't get you stuck. Banishing lawyer choice can still be taken multiple times.
 
Last edited:

Crowther

Active member
This happens with a number of non-combats where the user selected option (choiceAdventureXXX) is not available. I know it happens in the daily dungeon if you select options in mafia that require objects you don't have (detect boring door and eleven foot pole). I've seen infinite loops many other places, but can't remember another example off hand. You cannot abort mafia, which probably should be considered a bug. You can, select an option in the relay browser, change the choiceAdventureXXX setting in the GUI, or quit mafia via the GUI.
 

Darzil

Developer
This choice adventure doesn't have such options, so unless choiceAdventure780 is set to something other than 1, 2, 3 or 6, it would be a bug.
 

Veracity

Developer
Staff member
It happens only with automation, right?

ChoiceManager.processChoiceAdventure has a loop in it: it will proceed as long as KoL still offers "action=choice.php" - i.e., you are still in a choice. Within the loop, it calls various methods to determine which (automated) choice the user is requesting. Eventually, it does this:

Code:
			// Let user handle the choice manually, if requested

			if ( decision.equals( "0" ) )
			{
				KoLmafia.updateDisplay( MafiaState.ABORT, "Manual control requested for choice #" + choice );
				ChoiceCommand.printChoices();
				request.showInBrowser( true );
				return;
			}

			// Bail if no setting determines the decision

			if ( decision.equals( "" ) )
			{
				KoLmafia.updateDisplay( MafiaState.ABORT, "Unsupported choice adventure #" + choice );
				ChoiceCommand.logChoices();
				request.showInBrowser( true );
				return;
			}
After those checks would be the ideal place to insert something like this:

Code:
			// Make sure that KoL currently allows the chosen choice

			if ( !ChoiceManager.decisionAvailable( decision, request.responseText ) )
			{
				KoLmafia.updateDisplay( MafiaState.ABORT, "Requested choice (" + decision + ") for choice #" + choice + " is not currently available." );
				ChoiceCommand.printChoices();
				request.showInBrowser( true );
				return;
			}
where ChoiceManager.decisionAvailable would be a method which makes sure that there is a choice button available in the responseText corresponding to "decision".

That would stop this kind of loop, once and for all. We might want to put in special handling, now and then, to handle disappearing or changing choice options, but until and unless we do that, this will stop automation.
 

Veracity

Developer
Staff member
I'm out of turns and don't have a DEBUG log with a choice page in it, but recision 13097 provides the framework for this. Perhaps somebody with turns will be interested in looking at the stub function - ChoiceManager.decisionAvailable - and flesh it out appropriately. If not, I will do it tomorrow.

Hmm. I have some multis with spleen available. I'll see what I can do after breakfast.
 

Darzil

Developer
Yes, I think this is a very good plan. Something that aborts in every case where we've not handled it more gracefully is a lot better than 'infinite' server hits.
 

Veracity

Developer
Staff member
Revision 13098 does what I suggested: if your choiceAdventureXXX setting specifies something that does not resolve to a real option that is currently available, we abort automation and let you select the option you deire in the Relay Browser or via the "choice" command.
 

Crowther

Active member
Revision 13098 does what I suggested: if your choiceAdventureXXX setting specifies something that does not resolve to a real option that is currently available, we abort automation and let you select the option you deire in the Relay Browser or via the "choice" command.
Awesome, thanks!
Yes, I'd only seen it during automation.
 

Mr_Crac

Member
Can you do "get choiceAdventure780" (without quotes) at the cli and give the result, that will show which option was selected.

> get choiceAdventure780

1


Did you have Thrice-cursed at the time?

I think I did not have it yet, not sure though.


It happens only with automation, right?

To the best of my knowledge, yes.

Revision 13098 does what I suggested: if your choiceAdventureXXX setting specifies something that does not resolve to a real option that is currently available, we abort automation and let you select the option you deire in the Relay Browser or via the "choice" command.

Yay! Thanks :)
 

Darzil

Developer
What do you see if you start the relay browser? Which choice has an arrow against it, what happens if you hit it manually ?
 

Mr_Crac

Member
I cleared the adventure manually in the relay browser. I think it was set to choice 1, but I am not 100% sure.

Choice number 1 at this point of time made no sense, since I did not have the effect Thrice-Cursed yet. I manually chose whatever the choice number is to get Twice-Cursed, since I was Once-Cursed at the time where this happened.

I am now re-starting the bumcheekascend script and will see whether it goes from Twice-Cursed to Thrice-Cursed or what it does.

Edit: Yeah, this time it worked. The script beat the Protector Spirit for me, which means it went from Twice to Thrice by itself. I have no idea why it failed to do the same from Once to Twice.
 
Last edited:

Darzil

Developer
r13181. Sorry about that. One of those moments where staring at the code goes from "that looks right" to "why's that there".
 

Mr_Crac

Member
It is happening again. :(

KoLmafia is refusing to abort its endless output to the CLI when I press the Escape key, or "stop now", or "stop after".

Screenshot:
KoLmafia_not_aborting.png

Here are the last couple lines from my KoLmafia log:

[maximize 0 beeosity, mainstat 304 max, +10spell damage +mysticality experience +5 mp regen min +5 mp regen max, 5 hp, -10 ml, -weapon, -equip hilarious comedy prop
> BCC: Your familiar is set to a 100% Angry Jung Man
> BCC: Nothing to fax according to whatShouldIFax
> Need to Level up a bit to get 304 Mainstat
> BCC: levelMe(304, false) called.
> Need to Level up a bit to get at least 304 buffed Primestat. This means getting 2 Primestat.
> BCC: But, we're a myst class and at or over level 10, so we won't bother with buffed stats.
> BCC: Maximizing '-weapon, '

maximize 0 beeosity, mainstat 304 max, +10spell damage +mysticality experience +5 mp regen min +5 mp regen max, 5 hp, -10 ml, -weapon, -equip hilarious comedy prop
> BCC: Defeating the last Protector Spectre.
> BCC: Setting goals of '1 choiceadv'...

[795] A Massive Ziggurat
Encounter: dense liana
Round 0: mr_crac wins initiative!
Round 1: mr_crac wins the fight!
After Battle: Grot says, "the uncontrollable urge to dance is evidence of repressed sexual longing," and does a little soft-shoe.

[795] A Massive Ziggurat
Encounter: dense liana
Round 0: mr_crac wins initiative!
Round 1: mr_crac wins the fight!
After Battle: Grot says, "dancing is an expression of several base human urges, sublimated into a more socially acceptable form of expression," as he does a few pirouettes.

[795] A Massive Ziggurat
Encounter: dense liana
Round 0: mr_crac wins initiative!
Round 1: mr_crac wins the fight!
After Battle: Grot says, "the uncontrollable urge to dance is evidence of repressed sexual longing," and does a little soft-shoe.

[795] A Massive Ziggurat
Encounter: Legend of the Temple in the Hidden City
Took choice 791/1: fight Protector Spectre
choice.php?whichchoice=791&option=1&pwd
Encounter: Protector Spectre
Round 0: mr_crac wins initiative!

So the script (bumcheekascend plus WHAM) was apparently fighting a Protector Spectre, but for some reason could not actually finish the fight, even though it was as simple as casting Saucegeyser one single time and insta-win. I opened the relay browser and finished the fight there. That did break the endless loop. It would be really nice though if that endless loop did not occur in the first place :)
 
Last edited:
Top