Bug Certain foldables triggering choice adventure abort

Since the recent update involving aborting in response to choice adventures, my CS script has been running into some issues. I assume these pertained to my use of the force, which is a notoriously fiddly mechanic.

Turns out, it wasn't!

> acquire burning cape

Verifying ingredients for burning cape (1)...
Creating 1 burning cape...
You lose 1 hit point
You acquire an item: burning cape
Successfully created burning cape (1)
Whoops! You're not actually in a choice adventure
I ran into issues with the meteorite guard as well.
 

Ryo_Sangnoir

Developer
Staff member
Additionally, from breakfast:
Code:
Visiting the Swimmy Little Fishes and Such
Encounter: Approach the    Jellyfish
You acquire an item: sea jelly
Whoops!    You're not actually in a choice adventure
Harvesting batteries...
 

Ryo_Sangnoir

Developer
Staff member
FarFuture.ash has the following:

Code:
    //Are we in a game?
    string page_text = visit_url("choice.php");
    if (!page_text.contains_text("Starship ") && !page_text.contains_text("blue><b>The Far Future")) {
      [...]

That one should be easy enough to fix: allow accessing choice.php without a specific choice.
 

Veracity

Developer
Staff member
Maybe we don't want to abort...

You can walk away from the sea jelly choice adventure, but KoLmafia doesn't know that.
 

Veracity

Developer
Staff member
Folding a burning newspaper is choice 1277.
You can walk away from that.
As coded, the NEWSPAPER creation method attempts to fold as many as you requested and then chooses option 6 to exit the choice.
But it's only still in the choice if you have unused newspapers left.
Otherwise, it dumped you out of the choice.

So, this is clearly a KoLmafia bug - with several possible solutions.
- Don't bother exiting the choice, since you can walk away from it any way.
- Only exit if you still have un-used newspapers in inventory.
 

Veracity

Developer
Staff member
Further testing shows that you exit the burning newspaper choice each time you create an item.
As coded, the creation method thinks you stay in the choice, and it attempts to make additional items, if you requested more than one.
 

Veracity

Developer
Staff member
The following PR does this:
- Fix burning newspaper and metal meteoroid folding
- Allow a call to literally "choice.php" to not generate an error. FarFuture.ash worked fine for me after this.
- Marks the sea jelly choice as walk-away-able. (Note that I could not reproduce the bug.)

 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Thanks V. We could consider changing the MafiaState.ABORT to MafiaState.ERROR but I'm also heartened somewhat that the change surfaced some actual bugs that we didn't know about and has lead to them being fixed.
 

Magus_Prime

Active member
This is what I saw in the gCLI this morning, with r26618:
Visiting the Swimmy Little Fishes and Such
You acquire an item: sea jelly
Whoops! You're not actually in a choice adventure
Harvesting batteries...
I'm going to guess that the "Whoops" line is a side-effect of this change but I may be wrong. ;) It shouldn't be there.
 
Last edited:

Veracity

Developer
Staff member
That’s what Ryo_Sangnoir reported above.
I was unable to reproduce it.
I will try again…
 

Veracity

Developer
Staff member
Breakfast:

Code:
class net.sourceforge.kolmafia.request.PlaceRequest
Visiting the Swimmy Little Fishes and Such
Connecting to place.php...
Requesting: https://www.kingdomofloathing.com/place.php?whichplace=thesea&action=thesea_left2
Field: location = [choice.php?forceoption=0]

class net.sourceforge.kolmafia.session.ChoiceManager$1
Connecting to choice.php...
Requesting: https://www.kingdomofloathing.com/choice.php?forceoption=0
Retrieved: https://www.kingdomofloathing.com/choice.php?forceoption=0

class net.sourceforge.kolmafia.session.ChoiceManager$1
Connecting to choice.php...
Requesting: https://www.kingdomofloathing.com/choice.php?whichchoice=1219&option=1&pwd
Retrieved: https://www.kingdomofloathing.com/choice.php?whichchoice=1219&option=1&pwd
You acquire an item: sea jelly

class net.sourceforge.kolmafia.request.GenericRequest
Connecting to choice.php...
Requesting: https://www.kingdomofloathing.com/choice.php?whichchoice=1219&option=1
Retrieved: https://www.kingdomofloathing.com/choice.php?whichchoice=1219&option=1
Whoops! You're not actually in a choice adventure

We automated the choice and then attempted to manually execute it.

defaults.txt:

Code:
user    choiceAdventure1219    1

Yup.

I suppose the user could manually change the option to 0 (Show in Browser) which will leave you in the choice or 2 (leave the jellyfish alone), but with either 1 or 2, automation will take the choice and leave you not in the choice.

I suppose breakfast should simply not try to take the choice unless ChoiceManager.handlingChoice.
Or perhaps breakfast should force the option to be 1 and then just allow automation to do its thing.
 

AlbinoRhino

Active member
Or perhaps breakfast should force the option to be 1 and then just allow automation to do its thing.

This sounds the most reasonable (to me). I don't seem to see a "collect sea jelly" preference in the "Automation" section of the Preferences panel. I suspect there should be one so that the behavior quoted above can be enabled/disabled as the user prefers?
 

AlbinoRhino

Active member
Yes. Breakfast is trying to visit the choice a second time after already collecting the sea jelly. We are all getting the message when it does so.
 

Veracity

Developer
Staff member
I notice the following in SVN history:

Code:
------------------------------------------------------------------------
r17722 | veracity0 | 2017-01-23 17:05:43 -0500 (Mon, 23 Jan 2017) | 3 lines

Don't automate the choice when collecting sea jelly during breakfast. Even so, make
collecting jelly be the default for that choice adventure.

------------------------------------------------------------------------
r17721 | veracity0 | 2017-01-23 16:05:43 -0500 (Mon, 23 Jan 2017) | 3 lines

Don't run breakfast if in a (temporary) limitmode. Hermit is in Mountain zone, not Woods.
Courtesy of Ryo_Sangnoir, collect sea jelly (if capable and available) at breakfast

Revision 17722 makes a PlaceRequest with "followRedirect" as "false" - the only place in KoLmafia where that is done.
Yet, I see no code in GenericRequest.handleServerRedirect to obey that; in that case, if it redirects to choice.php, GenericRequest does this:

Code:
    if (this.redirectLocation.startsWith("choice.php")) {
      ...
      this.redirectHandled = true;
      ChoiceManager.processRedirectedChoiceAdventure(this.redirectLocation);
      return true;
    }

(The omitted part does special handling for a choice while logging in.)
So, no exemption for a PlaceRequest, it automates the choice. Was that how it was intended to work?

Rather than opening that can of rats (mixed metaphor ;)), r26621 forces KoLmafia to automate the choice.
 

Veracity

Developer
Staff member
Going down that wormhole a bit (the other side of the mixed metaphor):

It is because we don't "followRedirect" for that PlaceRequest that we end up doing the ChoiceManager.processRedirectedChoiceAdventure which automates the choice. Given that, simply removing the extra call to choice.php, the r26621 does, is what was needed.
 

3_D

New member
Reproduced, when trying to fold the unbreakable umbrella while the left-hand man is holding it.
Maximizing...
Folding umbrella
Whoops! You're not actually in a choice adventure
 
Top