Bug - Fixed Choice Handling and Goal not quite working as expected.

It's definitely the choice.ash causing this.
I am puzzled. I set up a choice.ash like this:

PHP:
void main()
{
    buffer responseText;
    append(responseText, visit_url());
    write(responseText);
}
In other words, it is called when choice.php is encountered, it fetches the page, and passes it straight on through.

Based on your DEBUG file, I made two tiny changes to KoLmafia:

- When we execute a relay script, put the name into the debug log
- When you hit the "auto" button on a choice, strip off "action=auto" from the path before passing it on through. I am certain that KoL ignored that, and the auto button has always worked for me, but it was bogus.

I set my choice options to "get a Spooky Temple map and then skip" - which is what your options were set to - went to the Spooky forest and ran with debugging until I got the choice adventure. I hit the auto button. Here is what I see in the gCLI:

[418246] The Spooky Forest
Encounter: Arboreal Respite
Encounter: Consciousness of a Stream
In the Relay Browser, I see:

Results:

You squeeze into the cave again, but there's nothing else of interest in here.
and in the DEBUG log I see:

Code:
-----From Browser-----
GET /adventure.php?snarfblat=15 HTTP/1.1
Requesting: http://www.kingdomofloathing.com/adventure.php?snarfblat=15
Retrieved: http://www.kingdomofloathing.com/adventure.php?snarfblat=15
Field: Location = [choice.php?forceoption=0]
-----To Browser-----
HTTP/1.1 302 Found
Location: choice.php?forceoption=0
-----From Browser-----
GET /choice.php?forceoption=0 HTTP/1.1
Executing relay script: choice.ash
         Entering function visit_url
Requesting: http://www.kingdomofloathing.com/choice.php?forceoption=0
Retrieved: http://www.kingdomofloathing.com/choice.php?forceoption=0
         Function visit_url returned:
      Entering function write
      Function write returned: void
-----To Browser-----
HTTP/1.1 200 OK
-----From Browser-----
GET /choice.php?action=auto HTTP/1.1
Executing relay script: choice.ash
         Entering function visit_url
Requesting: http://www.kingdomofloathing.com/choice.php?whichchoice=502&option=2&pwd
Retrieved: http://www.kingdomofloathing.com/choice.php?whichchoice=502&option=2&pwd
         Function visit_url returned:
      Entering function write
      Function write returned: void
Executing relay script: choice.ash
         Entering function visit_url
Requesting: http://www.kingdomofloathing.com/choice.php?whichchoice=505&option=2&pwd
Retrieved: http://www.kingdomofloathing.com/choice.php?whichchoice=505&option=2&pwd
         Function visit_url returned:
      Entering function write
      Function write returned: void
-----To Browser-----
HTTP/1.1 200 OK
I was interested to see that it called choice.ash for each step of the automated choice handling, since choice.ash has a chance to modify the output at each stage, and the automated choice handler has to work on the modified output, but upon thinking about it, I think it has to work like that, since you want choice.php to modify the final page that is finally given back to the browser.

Given that, it worked fine: I see exactly the transactions between the browser and KoLmafia and between KoLmafia and KoL that I expect, and the relay script is called in exactly the places I expect it to be called and submits exactly the correct URLs via visit_url() that I expect.

I don't see how my two little changes to the code (which I will submit, since they seem right) would cause the difference in behavior between what you reported and what I observed. And I don't see how the differences in your relay script and mine would have caused those, either.

So, I am puzzled.

With revision 12737, I am unable to reproduce your issue.
 
I am afraid I can't help with the puzzlement since I don't understand scripting at all -
the choice.ash is something I got off these forums. ;)

The way I figured it was casuing the troubles was deleting it from the relay folder. The loops were gone right after that.


Gave it a try just now with my old choice.ash - loops in 12735, doesn't loop in 12738.
Cleary those two little code changes solved whatever was going on.
 
In that case, I assume there was a KoL-side change that made "action=auto" repeat the same choice, rather than taking the decision specified by the other parameters.

Thanks for finding it. :)
 
Back
Top