Difference between revisions of "Adv1"

From Kolmafia
Jump to navigation Jump to search
imported>Fredg1
m (adding run_choice() in the seeAlso)
imported>Taltamir
Line 21: Line 21:
  
 
<p>If {{Pspan|filter}} contains a semicolon it will use {{Pspan|filter}} as a macro.</p>
 
<p>If {{Pspan|filter}} contains a semicolon it will use {{Pspan|filter}} as a macro.</p>
<p>This function does not have to make use of its return value, but if you wish to do so, it will return true if all adventures were used, and false if it is unable to do so for any reason (not enough adventures, location unavailable, etc.).|
+
<p>This function does not have to make use of its return value, but if you wish to do so, it will return true if all adventures were used. It will return false if it is unable to do so for any reason (not enough adventures, location unavailable, etc.). It will also return false when you successfully adventured in a zone but mafia was put into PENDING state, which indicates that we might be done adventuring in this location (usually because we successfully finished the quest related action in that zone)
  
code1={{CodeSample|
+
|code1={{CodeSample|
 
title=Code Sample|
 
title=Code Sample|
 
description=Adventures 1 time at the Slime Tube. If an adventure takes no turns, possibly because the Gall Bladder was already squeezed, that adventure will still count. Counters will trigger as normal.|
 
description=Adventures 1 time at the Slime Tube. If an adventure takes no turns, possibly because the Gall Bladder was already squeezed, that adventure will still count. Counters will trigger as normal.|

Revision as of 04:48, 11 September 2020

Function Syntax

boolean adv1(location place ,int turnsUsed ,string filterFunc )

  • place is the adventuring location.
  • turnsUsed overrides the normal number of adventures that are expected to be consumed at this location, or -1 can be passed to use the default. Specifically, 0 will prevent any counters from triggering - of course, if an adventure actually is consumed, any counters that you kept from triggering will be lost.
  • filterFunc is a macro or the name of a combat filter function defined elsewhere in your script, with the same behavior as in the 3-paramater version of adventure(). An empty string can be passed to use your battle action or CCS as normal.

This will adventure exactly once in the specified place (even if it took no turns), although it will follow chained choice adventures for as long as you have preset options.

If filter contains a semicolon it will use filter as a macro.

This function does not have to make use of its return value, but if you wish to do so, it will return true if all adventures were used. It will return false if it is unable to do so for any reason (not enough adventures, location unavailable, etc.). It will also return false when you successfully adventured in a zone but mafia was put into PENDING state, which indicates that we might be done adventuring in this location (usually because we successfully finished the quest related action in that zone)

Code Sample

Adventures 1 time at the Slime Tube. If an adventure takes no turns, possibly because the Gall Bladder was already squeezed, that adventure will still count. Counters will trigger as normal.

adv1($location[slime tube], -1, "");

CLI Equivalent

None - "adv" will always try adventuring again if an adventure took no turns.

See Also

adventure() | run_combat() | run_choice()