Recent problems with batfellow.ash

adeyke

Member
I use cheesecookie's batfellow.ash to turn my weekly special edition Batfellow comics into meat, when I'm in aftercore. However, the past two times, I encountered problems with it. I'd get frequent "Whoops! You're not actually in a choice adventure" errors that aborted the script. I'd rerun the script each time this happened, but it would eventually terminate at the Jokester due to not having defeated Kudzu, Mansquito, or Miss Graves.

I had these problems on August 2 and August 8. The last time I ran it without issue was July 25.

I'm not sure what the source of the problem is or how to fix it.
 
In r26613, code was added to abort if a script tries to run a choice without actually being in a choice adventure.

Either we need to figure out what the script is doing and allow that case, or stop aborting on this error. Maybe with a preference.
 
In r26613, code was added to abort if a script tries to run a choice without actually being in a choice adventure.

Either we need to figure out what the script is doing and allow that case, or stop aborting on this error. Maybe with a preference.
"allow for that case" might mean "fix the bug in the script".

Code:
    if (request.responseText.contains("Whoops!  You're not actually in a choice adventure.")) {
      // Allow a script to simply attempt to visit choice.php.
      if (!urlString.equals("choice.php")) {
        KoLmafia.updateDisplay(
            MafiaState.ABORT, "Whoops! You're not actually in a choice adventure");
      }
      ChoiceManager.handlingChoice = false;
      return true;
    }

could become:

Code:
    if (request.responseText.contains("Whoops!  You're not actually in a choice adventure.")) {
      // Allow a script to simply attempt to visit choice.php.
      if (!urlString.equals("choice.php")) {
        if (Preferences.getBoolean("workAroundBuggyScriptsSubmittingChoices")) {
            KoLmafia.updateDisplay(MafiaState.ERROR, "Script submitted " + urlString + " when KoL was not in a choice adventure")
        } else {
            KoLmafia.updateDisplay(MafiaState.ABORT, "Whoops! You're not actually in a choice adventure");
        }
      }
      ChoiceManager.handlingChoice = false;
      return true;
    }

to allow scripts to continue and maybe give the script author feedback for fixing their bug. :)
 
As suspected, that version of the script had the same issues. However, setting abortOnChoiceWhenNotInChoice to false allowed the script to run to completion. My conclusion is that the script has always been bugged, and that bug only became noticeable with that KoLmafia change. However, I don't know the fix. The script seems rather impenetrable to me at the moment, and the limited nature of Batfellow makes experimentation difficult. Attached is the CLI output, for whatever that's worth.
 

Attachments

I have noticed that after running the script (with abortOnChoiceWhenNotInChoice set to false), afterwards mafia does not recognize my torso awareness anymore. Mafia also thinks my stats are severely below what they actually are (this only gets fixed by logging out and back in again). Another thing that happens is that my MP gets almost depleted.
 
I made three tweaks and it seems to work. I use a basic wrapper script to loop through and get a full set of consumables every few months.

I added the following to the start of my wrapper script:
Code:
cli_execute("set abortOnChoiceWhenNotInChoice = false");
cli_execute("refresh all");

I and I added this to the end of the wrapper script (after I was done looping through all the consumables):
Code:
cli_execute("set abortOnChoiceWhenNotInChoice = true");
cli_execute("refresh storage");

Finally, in batfellow.ash itself, I added the following around line 288, right before it tries to use the $item[Special Edition Batfellow Comic];
Code:
cli_execute("refresh all");

With those three things in place, it doesn't break on the noncombats, and it can find that I still have a backlog of comics to read.

I hope this helps!
 
  • Like
Reactions: AdW
Sorry for the late posting here. But I can't find cheesecookie's script (the location isn't mentioned here, or anywhere else I could find). And the script that was mentioned here by ckb doesn't seem to have fixed the issue mentioned in '22.

When I run ckb's script, it stops constantly and says I'm not in a choice adventure. I need to manually play the adventure and then restart the script, choosing a different starting number each time (I assume)... and then I blow up. This is a long journey to end in the death of millions.

Could someone point me to cheesecookie's script?
 
Hmm... the starting comment suggests that these scripts are literal copies. I can check it again once I'm out of HC.

@infopowerbroker gave some great information, but I don't know how to call a script in a wrapper script. The rest I can do, but could someone help me with this part?

I have over 400 of these comics to go through (I took a long time off), so hopefully the script doesn't continually process them all. If it does, any hints on how to do only a specific number of them here, or should I just closet all other I don't want to wait for?
 
Hmm... the starting comment suggests that these scripts are literal copies. I can check it again once I'm out of HC.

@infopowerbroker gave some great information, but I don't know how to call a script in a wrapper script. The rest I can do, but could someone help me with this part?

I have over 400 of these comics to go through (I took a long time off), so hopefully the script doesn't continually process them all. If it does, any hints on how to do only a specific number of them here, or should I just closet all other I don't want to wait for?
Two options (I did not try these today, please test for typos etc):
  • You can call the script directly like you would from the CLI:
cli_execute("call batfellow.ash Kudzu salad");​
  • You can import the batfellow script's functions into your own script, then
batfellow($item[Kudzu salad]);​


Items and usage can be found at the top of the batfellow script (svn.code.sf.net):

# Methods to run the script:
# Read comic, skip Intro NC, run batfellow.ash: You will be prompted to enter a goal:
# Either enter the number or type out the item name:
# 1 Kudzu salad
# 2 Mansquito Serum
# 3 Miss Graves' vermouth
# 4 The Plumber's mushroom stew
# 5 The Author's ink
# 6 The Mad Liquor
# 7 Doc Clock's thyme cocktail
# 8 Mr. Burnsger
# 9 The Inquisitor's unidentifiable object
# This method requires that you start Batfellow yourself to avoid accidents
#
# The following command will complete an entire Batfellow set (this opens it as well, just won't buy it).
# ash import<batfellow.ash> batfellow(item);
#
# Alternatively, you can add it to a script by importing and then using the function directly.

I hope this helps!
 
Back
Top