Yeah. For now, I'm assuming that if you are automating this, you will pre-stock with enough supplies, given hippy/frat boys remaining, how many turns you are spending, how many you defeat on normal fights, etc. Or, if you are scripting and using run_choice(), you will acquire (at least) enough before you get there - and will restock, if needed, before continuing to the next one.
If you specify an option that is not currently available for any choice, we go to manual decision:
We actually do have a mechanism for doing extra validation on choices -
// Make sure that KoL currently allows the chosen choice
if ( !ChoiceUtilities.optionAvailable( decision, request.responseText ) )
KoLmafia.updateDisplay( MafiaState.ABORT, "Requested choice (" + decision + ") for choice #" + choice + " is not currently available." );
request.showInBrowser( true );
Notice that it has the responseText, so we can look. Here is what we do for the Tomb of the Unknown <Your Class Here>
private static final String specialChoiceDecision1( final int choice, String decision, final int stepCount, final String responseText )
I could add an extra argument to that - the extra fields you specify - and add code to handle choice 1391 in particular. Of course the "extra fields" functionality is generic, so it is always "don't do that" for anything we don't have that kind of error checking built in.
// Tomb of the Unknown Your Class Here
// This handles every choice in the "The Unknown Tomb"
// Many of them have a single option.
TreeMap<Integer,String> choices = ChoiceUtilities.parseChoices( responseText );
if ( choices.size() == 1 )
// The only one that has more than one option is the initial riddle.
// The option numbers are randomized each time, although the correct
// answer remains the same.
String myClass = KoLCharacter.getClassType();
String answer =
myClass == KoLCharacter.SEAL_CLUBBER ? "Boredom." :
myClass == KoLCharacter.TURTLE_TAMER ? "Friendship." :
myClass == KoLCharacter.PASTAMANCER ? "Binding pasta thralls." :
myClass == KoLCharacter.SAUCEROR ? "Power." :
myClass == KoLCharacter.DISCO_BANDIT ? "Me. Duh." :
myClass == KoLCharacter.ACCORDION_THIEF ? "Music." :
// Only standard classes can join the guild, so we
// should not fail. But, if we do, cope.
if ( answer == null )
// Iterate over the option strings and find the one
// that matches the correct answer.
for ( Map.Entry<Integer,String> entry : choices.entrySet() )
if ( entry.getValue().contains( answer ) )
return String.valueOf( entry.getKey() );
// Again, we should not fail, but cope.
If I code up something for this, I wouldn't be able to test until tomorrow, and I am planning to spin a (final?) point release today. I'll be back on the battlefield tomorrow for my 13th run. I suppose I can put off the point release until then.