Bug - Fixed No longer able to use another gong when a previous gong's effect is expiring

parastra

New member
I have a script which uses a number of llama lama gongs, and in recent builds (currently using r10949) this script has suddenly started to fail when attempting to use a gong for the second time, when the "Welcome Back" adventure for the first gong is due.

The script in question is basically doing this:
Code:
if (have_effect($effect[Shape of...Mole!]) == 0)
{
     set_property("gongPath","2");
     use(1, $item[llama lama gong]);
}

Below is a relevant section of CLI output, note that mafia does correctly visit the Noob Cave and receive the "Welcome Back" adventure:
[59207] Mt. Molehill
Encounter: No Sects in the Potion Room
You acquire an item: digital underground potion
Using 1 llama lama gong...

[59208] Noob Cave
Encounter: Welcome Back!
Using 1 llama lama gong...
Finished using 1 llama lama gong.
Finished using 1 llama lama gong.
Using 1 llama lama gong...
Finished using 1 llama lama gong.
Using 1 llama lama gong...
Finished using 1 llama lama gong.
Using 1 llama lama gong...
Finished using 1 llama lama gong.
Using 1 llama lama gong...

If I abort the script at this point and manually attempt to visit an adventure.php location (like the Noob Cave), then I get the "The Gong Has Been Bung" encounter, and pressing the 'Auto' button correctly chooses the path of the mole:
KoLmafia declares world peace.

[59208] Noob Cave
Encounter: The Gong Has Been Bung
You acquire an effect: Shape of...Mole! (duration: 12 Adventures)

However, when the effect from that gong expires, I get the same thing happening again.

It almost looks like mafia is getting stuck in the "The Gong Has Been Bung" choice adventure, and keeps trying to use another gong instead of choosing a path.
 

Glazius

Member
I'm seeing this same behavior, just from typing "gong bird" fresh: opening up the relay browser reveals it's sitting at a decorated choice adventure (with how many turns each form will last).
 

Orbrisa

Member
Same here. When using the maximizer to increase muscle, the CLI says:

Gong path: musc, musc, +30% musc
Using 1 llama lama gong...
Finished using 1 llama lama gong.

But when I click something in the relay browser, it's still sitting on The Gong Has Been Bung.

Possibly related: I used to be able to configure Mafia to get particular items from a reflection of a map, by manually setting choice adventure options. But now this is similarly failing; the CLI says that the reflection has been used, but doesn't actually use the map and get the item.

I'm using build 10944.
 

AlbinoRhino

Active member
I've experienced the same issue with gongs as well as had a "use house blueprints" cli command fail.

It appears that on May 1, a change was made to choice.php pages. The url for these pages (or at least a lot of them) now seems to include a "?forceoption=0" argument. Perhaps that is why some of these mafia tools are now failing.
 

lostcalpolydude

Developer
Staff member
The relevant section of the debug log from "gong bird":

Retrieving server reply...

Retrieved: http://www.kingdomofloathing.com/inv_use.php?whichitem=3353&ajax=1

10 header fields
Field: null = [HTTP/1.1 200 OK]
Field: Date = [Sat, 19 May 2012 01:57:16 GMT]
Field: Content-Length = [100]
Field: Expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: Content-Type = [text/html; charset=UTF-8]
Field: Connection = [close]
Field: Server = [nginx/0.8.55]
Field: X-Powered-By = [PHP/5.1.6]
Field: Cache-Control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
Field: Pragma = [no-cache]

Retrieving server reply
ResponseText has 100 characters.
<script type="text/javascript">top.mainpane.document.location = "choice.php?forceoption=0";</script>
Processing results...
Processing result: llama lama gong (-1)
Processing result: llama lama gong
Finished using 1 llama lama gong.

There is no Location field in the headers. Instead, the redirect is done using javascript. This means that
this.redirectLocation = this.responseCode != 302 ? null : this.formConnection.getHeaderField( "Location" );
in GenericRequest sets redirectLocation to null, and failure to detect the redirect prevents further processing.

Edit: There's other code to catch that, so the stuff above might not be relevant.
 
Last edited:

lostcalpolydude

Developer
Staff member
The actual problem seems to be
ResponseText has 100 characters.
with a check for
this.responseText.length() < 100
I changed that to 200 and I was able to run "gong bird". I don't see why that check is there to begin with, so it seems like removing it is better than increasing the length limit. I'll wait a little bit in case someone else sees a reason to not remove it.
 

lostcalpolydude

Developer
Staff member
r10991. Not running that regex on every page probably speeds things up a bit, so I just increased the limit to 200.
 
Top