I reproduced this by doing the following:
I set my CCS to include:
Code:
[ war frat 151st infantryman ]
skill use the force
I iinstalled a choiceAdventureScript:
Code:
void main( int choice, string page )
{
// code to handle the choice, using available_choice_options(), run_choice(), etc.
print( "In choice adventure " + choice );
int option = 0;
boolean fight = false;
switch ( choice ) {
// Using the Force
case 1387:
option = 3;
break;
default:
print( "not handling " + choice );
return;
}
// Argument 2 is "should automate fights" We don't want to do that
// inside this script; follow the redirect and leave it to outer
// automation.
run_choice( option, !fight );
if ( fight_follows_choice() ) {
print( "Heading into a fight..." );
}
print( "Done!" );
}
When I did "numberology 51", it redirected to a fight, found my CCS, which cast "Use the Force" - and left me in the choice adventure.
The "numberology" command uses a NumberologyRequest. I noticed that GenericRequest has special handling for certain classes which can redirect to a fight.
I added NumberologyRequest to that:
Code:
if ( this.redirectLocation.startsWith( "fight.php" ) || this.redirectLocation.startsWith( "fambattle.php" ) )
{
String location = this.getURLString();
GenericRequest.checkItemRedirection( location );
GenericRequest.checkChoiceRedirection( location );
GenericRequest.checkSkillRedirection( location );
GenericRequest.checkOtherRedirection( location );
if ( this instanceof UseItemRequest ||
this instanceof CampgroundRequest ||
this instanceof ChateauRequest ||
this instanceof DeckOfEveryCardRequest ||
this instanceof GenieRequest ||
this instanceof NumberologyRequest ||
this instanceof UseSkillRequest )
{
this.redirectHandled = true;
FightRequest.INSTANCE.run( this.redirectLocation );
if ( FightRequest.currentRound == 0 && !FightRequest.inMultiFight && !FightRequest.choiceFollowsFight )
{
KoLmafia.executeAfterAdventureScript();
}
return !LoginRequest.isInstanceRunning();
}
}
It still left me at the choice, because FightRequest did not automate once it redirected to a choice.
That is typically left to the outer script - adv1(), etc. - to do. In fact, any of these requests - mushroom garden, chateau monster, genie wishes, numberology - can lead to multi-fights (clingy monsters, Eldritch Attunement) or a choice (Use the Force). So I added automation for those conditions, the same as adv1() etc. needs to do:
Code:
// Clingy monsters or Eldritch Attunement can lead to a multi-fight
// Using the Force can leave you in a choice.
while ( !KoLmafia.refusesContinue() )
{
if ( FightRequest.inMultiFight || FightRequest.fightFollowsChoice )
{
FightRequest.INSTANCE.run();
continue;
}
if ( FightRequest.choiceFollowsFight )
{
RequestThread.postRequest( new GenericRequest( "choice.php" ) );
// Fall through
}
if ( ChoiceManager.handlingChoice )
{
ChoiceManager.gotoGoal();
continue;
}
break;
}
With those changes, I did this:
Code:
[color=green]> numberology 51[/color]
[1199] numberology 51
Encounter: War Frat 151st Infantryman
Round 0: Veracity wins initiative!
Round 1: Veracity executes a macro!
Encounter: Using the Force
In choice adventure 1387
Submitting option 3 for choice 1387
You acquire an item: distressed denim pants
You acquire an item: beer helmet
You acquire an item: bejeweled pledge pin
You acquire an item: bottle opener belt buckle
You acquire an item: perforated battle paddle
You acquire an item: keg shield
You acquire an item: beer bomb
You acquire an item: flask flops
Done!
Notice that it called my choiceAdventureScript: "In choice adventure 1387" and "Done!" were printed by this.
So, as long as you are Calculating the Universe via the "numberology" command - which casts the skill, follows the choice.php redirection, submits the derived number to get the desired result - you should be good to go.
If you are doing all those manually with visit_url(), then you need to handle the fights and choices on your own.
Revision 20261