I have had a few problems in a script because of ASH functions with boolean return values. They were returning false even when the action was successful.
After checking RuntimeLibrary.java, it seems like all the ASH functions affected are those that use:
What led me to this is that, when successful, restore_mp() would return false while restore_hp() returned true:
It just happens that restore_hp() doesn't return RuntimeLibrary.continueValue(), while restore_mp() does.
I also tested other functions: equip(), restore_mp(), use_skill(), outfit(), use_familiar() and change_mcd():
The next function I found that returned RuntimeLibrary.continueValue() was adventure():
After using adventure() successfully, I tested the functions above again:
I can only guess that either KoLmafia.continuationState or KoLmafia.hadPendingState had not been reset prior to using those functions, but adventuring restored them.
Before having this problem, I had just adventured until a goal was fulfilled. I can consistently reproduce this now:
Pinpointing the issue further, only completing the conditions seems to cause the problem:
After checking RuntimeLibrary.java, it seems like all the ASH functions affected are those that use:
PHP:
return RuntimeLibrary.continueValue();
Code:
> ash my_mp()
Returned: 615
> ash restore_mp( 10 )
[B]Returned: false[/B]
> ash my_hp()
Returned: 202
> ash restore_hp( 10 )
[B]Returned: true[/B]
I also tested other functions: equip(), restore_mp(), use_skill(), outfit(), use_familiar() and change_mcd():
Code:
> ash equip( $item[ perforated battle paddle ] )
Wielding perforated battle paddle...
Equipment changed.
[B]Returned: false[/B]
> ash use_skill( 1, $skill[ rage of the reindeer] )
Casting Rage of the Reindeer 1 times...
You acquire an effect: Rage of the Reindeer (duration: 10 Adventures)
Rage of the Reindeer was successfully cast.
[B]Returned: false[/B]
> ash outfit("castle")
Putting on outfit: castle
Equipment changed.
[B]Returned: false[/B]
> ash use_familiar( $familiar[ hobo monkey ] );
Putting Dom Casmurro the Llama Lama back into terrarium...
Taking Ultralord of the Hobo Jungle the Hobo Monkey out of terrarium...
[B]Returned: false[/B]
> ash change_mcd( 0 )
Resetting mind control device...
Mind control device reset.
[B]Returned: false[/B]
Code:
> ash adventure( 1, $location[ icy peak ] );
Visit to McLarge: Icy Peak in progress...
[2821] Icy Peak
Encounter: Knott Yeti
Strategy: D:\dloads\KoLMafia\ccs\peak.ccs [knott yeti]
Round 0: slyz wins initiative!
Round 1: slyz executes a macro!
Round 1: slyz attacks!
Round 2: knott yeti takes 257 damage.
Round 2: slyz wins the fight!
After Battle: Ultralord of the Hobo Jungle sits on your fallen opponent's body, blows a smoke ring, and winks at you.
You gain 900 Meat
You gain 11 Beefiness
You gain 21 Magicalness
You gain 10 Sarcasm
[B]Returned: true[/B]
Code:
> ash equip( $item[ perforated battle paddle ] )
Wielding perforated battle paddle...
Equipment changed.
[B]Returned: true[/B]
> ash use_skill( 1, $skill[ rage of the reindeer] )
Casting Rage of the Reindeer 1 times...
You acquire an effect: Rage of the Reindeer (duration: 10 Adventures)
Rage of the Reindeer was successfully cast.
[B]Returned: true[/B]
> ash outfit("castle")
Putting on outfit: castle
Equipment changed.
[B]Returned: true[/B]
> ash use_familiar( $familiar[ baby sandworm ] );
Putting Ultralord of the Hobo Jungle the Hobo Monkey back into terrarium...
Taking Dusty the Baby Sandworm out of terrarium...
string of dingle balls is better than (none). Switching items...
Putting on string of dingle balls...
Equipment changed.
[B]Returned: true[/B]
> ash change_mcd( 10 )
Resetting mind control device...
Mind control device reset.
[B]Returned: true[/B]
Before having this problem, I had just adventured until a goal was fulfilled. I can consistently reproduce this now:
Code:
> ash restore_mp( 10 )
[B]Returned: true[/B]
> goals add 1 yeti fur
Condition added: yeti fur
yeti fur
> adventure 10 icy peak
Request 1 of 10 (McLarge: Icy Peak) in progress...
[2822] Icy Peak
Encounter: Knott Yeti
Strategy: D:\dloads\KoLMafia\ccs\peak.ccs [knott yeti]
Round 0: slyz wins initiative!
Round 1: slyz executes a macro!
Round 1: slyz attacks!
Round 2: knott yeti takes 204 damage.
Round 2: slyz wins the fight!
You gain 566 Meat
After Battle: Boule does a couple of karate moves, then swivels his hips and gyrates his pelvis.
You acquire an item: yeti fur
You gain 6 Strengthliness
You gain 12 Enchantedness
You gain 7 Sarcasm
Conditions satisfied after 1 adventures.
> ash restore_mp( 10 )
[B]Returned: false[/B]
> adventure 1 icy peak
Visit to McLarge: Icy Peak in progress...
[2823] Icy Peak
Encounter: Knott Yeti
Strategy: D:\dloads\KoLMafia\ccs\peak.ccs [knott yeti]
Round 0: slyz wins initiative!
Round 1: slyz executes a macro!
Round 1: slyz attacks!
Round 2: knott yeti takes 200 damage.
Round 2: slyz wins the fight!
You gain 487 Meat
After Battle: Boule does a couple of karate moves, then swivels his hips and gyrates his pelvis.
You acquire an item: yeti fur
You gain 3 Muscleboundness
You gain 7 Magicalness
You gain 15 Chutzpah
Requests complete.
> ash restore_mp( 10 )
[B]Returned: true[/B]
Code:
> ash restore_mp( 10 )
[B]Returned: true[/B]
> goals add 1 steaming evil
Condition added: steaming evil
steaming evil
> adventure 1 icy peak
Visit to McLarge: Icy Peak in progress...
[2824] Icy Peak
Encounter: upgraded ram
Strategy: D:\dloads\KoLMafia\ccs\peak.ccs [default]
Round 0: slyz wins initiative!
Round 1: slyz executes a macro!
Round 1: slyz attacks!
Round 2: upgraded ram takes 200 damage.
Round 2: slyz wins the fight!
You gain 225 Meat
After Battle: Boule does a couple of karate moves, then swivels his hips and gyrates his pelvis.
You acquire an item: Ram's Face Lager
You gain 8 Beefiness
You gain 12 Enchantedness
You gain a Mysticality point!
You gain 6 Roguishness
[COLOR="#ff0000"]Conditions not satisfied after 1 adventure.[/COLOR]
> ash restore_mp( 10 )
[B]Returned: true[/B]