Bug - Fixed Error on visit_url() when my .ash script plays Dungeon Fist more than once

antimarty

Member
I wrote an .ash script that plays Dungeon Fist! for me, by calling visit_url() repeatedly with the proper moves. It works perfectly the first time it plays, no unexpected behavior at all. I can adventure normally after running the script, and even play Dungeon Fist! manually or via gm script.

But when the script plays the game a second time, whether as part of a loop, or being invoked separately, every visit_url() returns the "Unexpected error, debug log printed." msg, as does everything that I try to do in mafia after that (adventure elsewhere, do a summons, whatever). However, despite the error msgs, the script still plays through the game correctly - I don't think it's sending anything broken, but rather that mafia is now having trouble with the responses.

I'm at a bit of a loss to figure out why it works perfectly for a single game, but everything breaks when I revisit the arcade.

The relevant bit of the logged debug msg is:

Unexpected error, debug log printed.
class java.lang.NullPointerException: null
java.lang.NullPointerException
at net.sourceforge.kolmafia.request.ArcadeRequest.findChoiceName(ArcadeRequest.java:326)
at net.sourceforge.kolmafia.request.ArcadeRequest.postChoiceDungeonFist(ArcadeRequest.java:716)
at net.sourceforge.kolmafia.session.ChoiceManager.postChoice1(ChoiceManager.java:2867)
at net.sourceforge.kolmafia.request.GenericRequest.processResponse(GenericRequest.java:1779)
at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:1728)
at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:1423)
at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1161)
at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1052)
at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:73)
at net.sourceforge.kolmafia.textui.RuntimeLibrary.visit_url(RuntimeLibrary.java:1546)
at net.sourceforge.kolmafia.textui.RuntimeLibrary.visit_url(RuntimeLibrary.java:1517)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 

heeheehee

Developer
Staff member
I ran into this same problem with the same script. Oddly enough, it only started printing debug logs like crazy when the relay browser was open.
 

antimarty

Member
Thanks, I had somehow missed that thread (and the other DF! script), but the problem was the same; when I added veracity's extra visit_url(choice.php) it worked.
 

Veracity

Developer
Staff member
You did not include your script.

Edit: Never mind. I figured out the issue. I had fixed this in 8506, but broke it when I added Space Trip logging. That game offers non-contiguous choice options, and I needed an extra array to keep track of the index associated with the message.

Revision 8518.
 
Last edited:

heeheehee

Developer
Staff member
It's apparently not the same issue, looking at the debug log.

The script is pretty much the one provided here, tossed into a for loop, so it'll execute however many times.

I can't seem to duplicate the problem right now.

Edit: I guess there's no need, then.
 

Attachments

  • DungeonFist.ash
    9 KB · Views: 504
Last edited:

antimarty

Member
You did not include your script.

Sorry; I thought I'd included all the relevant info, and that posting the whole script would just confuse things. Here it is. (and, since it asks this question in the code: is there a better way to initialize an array?).
 

Attachments

  • dungeon fist-2.ash
    3.1 KB · Views: 282
Top