Adventuring: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
No edit summary
Ikzann (talk | contribs)
 
(39 intermediate revisions by 7 users not shown)
Line 1: Line 1:
== Part 5 - Adventuring ==
{{TOCright}}
<p><em>Go get &#8216;em, tiger!</em></p>
==General Adventuring==
{{flink|boolean|adventure|int|location|desc=Visits the desired location the the desired number of times. (''Sample'':[[%28ASHRM%29_Code_Samples#Sample_4:_Hedging|Hedging]])}}
{{Flink|boolean| adventure|int|location|desc=Visits the desired location the the desired number of times.}}
{{flink|boolean|adventure|int|location|string|desc=Visits the desired location a specified number of times, using a combat filter function defined elsewhere in your script.}}
{{Flink|boolean| adventure|int|location|string|desc=Visits the desired location a specified number of times, using a combat filter function defined elsewhere in your script.}}
{{flink|boolean|adv1|location|int|string|desc=Adventure exactly once in the specified location (even if it uses no turns). Chained choice adventures ARE followed. Int overrides default settings, and string is a filter, same as in [[adventure|adventure()]]}}
{{Flink|boolean| adv1|location|int|string|desc=Adventure exactly once in the specified location (even if it uses no turns). Chained choice adventures '''are''' followed. Int overrides default settings, and string is a filter, same as in [[adventure|adventure()]]}}
{{flink|void|add_item_condition|int|item|desc=Specifies adventuring conditions. With these in place, [[adventure|adventure()]] will successfully complete once the conditions are met.}}
{{FunctionEmbed|visit_url|format=signature|desc=yes}}
{{flink|void|council|desc=Visits the Council of Loathing.}}
{{Flink|string|get_counters|string|int|int|desc=Determine if a counter will expire in a specified
{{flink|item|guardians|desc=Climbs the Naughty Sorceress' Tower and passes the challenges it can, returning the first item needed to pass a failed stage.}}
period of time.}}
{{flink|int|tavern|desc=}}
{{Flink|void|council|desc=Visits the Council of Loathing.}}
{{flink|boolean|entryway|desc=}}
{{Flink|item|guardians|desc=Climbs the Naughty Sorceress' Tower and passes the challenges it can, returning the first item needed to pass a failed stage.}}
{{flink|boolean|hedgemaze|desc=}}
{{Flink|int|tavern|desc=Attempt to complete the tavern, and returns the number of squares visited}}
{{flink|boolean|chamber|desc=}}
{{Flink|boolean|entryway}}
{{flink|RETURN|NAME|PARAM1|PARAM2|desc=}}
{{Flink|boolean|hedgemaze}}
Attempts to perform the associated tasks. The return value indicates the success.<br />
{{Flink|boolean|chamber|desc=These three functions attempt to perform the associated tasks. The return value indicates the success.}}
See the [http://kolmafia.sourceforge.net/scripting.html CLI manual] for more details.<br />
{{Flink|location|my_location|desc=Returns the location where you last adventured.}}
<em>Sample</em>:[[%28ASHRM%29_Code_Samples#Sample_4:_Hedging|Hedging]]</p>
{{Flink|void|set_location|location|desc=Changes the value returned by my_location().}}
{{Flink|void|refresh_status|desc=Refreshes the side-pane character info (health, effects, etc.).}}
{{Flink|buffer|run_combat|desc=Uses the current KoLmafia settings to run a combat (for use with [[visit_url|visit_url()]]).}}
{{Flink|buffer|run_choice|desc=Chooses an option in the current choice adventure.}}
{{Flink|buffer|run_turn|desc=Works as run_combat() or run_choice( -1 ) depending on whether you are in combat or in a choice.}}
{{Flink|boolean|change_mcd|int|desc=Tries to set your +ML device to a specified setting and reports on success.}}
{{Flink|boolean|hermit|int|item|desc=Trades worthless items (adventuring in the sewer if needed) to the hermit for specified items.}}
==Goals and Conditions==
{{FunctionEmbed|add_item_condition|format=signature|desc=yes}}
{{Flink|string [int]|get_goals|desc=Lists all current goals.}}
{{Flink|boolean| is_goal|item|desc=Checks if a given item is a goal.}}
{{Flink|boolean|goal_exists|string|desc=Checks if there is currently a given type of goal.}}
{{Flink|void| remove_item_condition|int|item|desc=Removes adventuring conditions.}}
==About Monsters==
For all of the below functions that accept an optional monster parameter, the default value is your most recently-encountered monster (that means your current monster if you're in combat).


<p><strong>boolean train_familiar( int nGoal, string sGoal )</strong><br />
{{flink|int|jump_chance|{{opt|monster}}|{{opt|int}}|{{opt|int}}}}
Trains your currently-equipped familiar. sGoal can be either &#8220;base&#8221;, &#8220;buffed&#8221;, or &#8220;turns&#8221;, and nGoal is either the target weight or desired number of battles.</p>
{{flink|int|jump_chance|location|{{opt|int}}|{{opt|int}}|desc=Returns the chance of successfully getting the jump against the monster or in the location.}}
{{Flink|monster|last_monster|desc=Returns last monster encountered.}}
{{Flink|monster [int]|get_monsters|location|desc=Returns a map of potential monsters at a given location.}}
{{Flink|float [monster]|appearance_rates|location|{{opt|boolean}}|desc=Returns a map of the expected frequency of each monster at the specified location.}}
{{Flink|int|monster_attack|{{opt|monster}}|desc=Returns the starting/current attack value of the specified monster.}}
{{Flink|int|monster_defense|{{opt|monster}}|desc=Returns the starting/current defense value of the specified monster.}}
{{Flink|int|monster_hp|{{opt|monster}}|desc=Returns the starting/current HP of the specified monster.}}
{{Flink|int|monster_initiative|{{opt|monster}}|desc=Returns the starting/current initiative of the specified monster.}}
{{Flink|phylum|monster_phylum|{{opt|monster}}|desc=Returns the phylum of the specified monster.}}
{{Flink|int|expected_damage|{{opt|monster}}|desc=Returns the amount of damage you are expected to take each round from the specified monster.}}
{{Flink|element|monster_element|{{opt|monster}}|desc=Returns the elemental alignment of the specified monster.}}
{{Flink|monster|image_to_monster|string|desc=Looks up monster by image name.}}
{{Flink|boolean|is_banished|monster|desc=Returns true if the specified monster is banished}}


<p><strong>location my_location()</strong><br />
==Choice Adventures==
Returns the location where you last adventured. </p>
{{FunctionEmbed|available_choice_options|format=signature|desc=yes}}
{{flink|boolean|choice_follows_fight|desc=Returns <code>true</code> if the last finished combat is about to lead into a choice adventure.}}
{{flink|boolean|handling_choice|desc=Returns <code>true</code> if you are currently in a choice.}}
{{flink|int|last_choice|desc=Returns the ID of the current (or last) choice adventure you encountered.}}
{{FunctionEmbed|run_choice|format=signature|desc=yes}}


<p><strong>void refresh_status()</strong><br />
==Misc.==
Grabs a fresh copy of your sidebar, so that information on your health, effects, and such will be guaranteed accurate.  In theory, this is not necessary unless you are attempting to script your own custom combat function.</p>
{{Flink|int|get_auto_attack|desc=Returns your current auto-attack setting.}}
 
{{Flink|void|set_auto_attack|int|desc=Sets your auto-attack setting.}}
<p><strong>monster [int] get_monsters( [[%28ASHRM%29_Datatype_Constants#.24location.5Bconstant.5D|location place]] )</strong><br />
{{Flink|boolean|set_ccs|string|desc=Sets your custom combat script.}}
Returns an integer indexed map of potential monsters in the given location.</p>
{{Flink|buffer|read_ccs|string|desc=Reads the text of your custom combat script.}}
 
{{Flink|boolean|write_ccs|buffer|string|desc=Writes the text of your custom combat script.}}
<p><strong>float [monster] appearance_rates( [[%28ASHRM%29_Datatype_Constants#.24location.5Bconstant.5D|location place]] )</strong><br />
[[Category:Scripting]]
Returns a map containing the expected appearance rate for the known monsters in the specified location, normally in the range 0..100. The rate is 0 for bosses, semirare encounters (e.g. Knob Goblin Elite Guard Captain), and other one-time-only monsters, negative for ultra-rare monsters.<br />
The map also contains an entry for $monster[none], giving the expected rate of noncombat encounters. This is negative for locations where this isn't known, in which case the monster encounter rates are calculated as if the location was 100% combats.<br />
The results take combat rate modifiers into account. Queue effects, Olfaction, and monster banishers are not considered. Special mechanics (such as monsters that are unlocked by some action) are also not considered.</p>
 
<p><strong>int monster_base_attack( [[%28ASHRM%29_Datatype_Constants#.24monster.5Bconstant.5D|monster eek]] )<br />
int monster_base_defense( [[%28ASHRM%29_Datatype_Constants#.24monster.5Bconstant.5D|monster eek]] )<br />
int monster_base_hp( [[%28ASHRM%29_Datatype_Constants#.24monster.5Bconstant.5D|monster eek]] )</strong><br />
Returns the stats for the given monster. </p>
 
<strong>element monster_attack_element( monster )</strong><br />
<strong>element monster_defense_element( monster )</strong><br />
Returns the given monsters attack element and element which it can defend against.
 
<strong>buffer run_combat()</strong><br />
Uses the built in mafia combat to run a combat. For use with visit_url.

Latest revision as of 00:02, 9 January 2023

General Adventuring

boolean  adventure( int, location )

Visits the desired location the the desired number of times.

boolean  adventure( int, location, string )

Visits the desired location a specified number of times, using a combat filter function defined elsewhere in your script.

boolean  adv1( location, int, string )

Adventure exactly once in the specified location (even if it uses no turns). Chained choice adventures are followed. Int overrides default settings, and string is a filter, same as in adventure()

buffer visit_url()

Returns the original HTML source of the page being overridden inside a relay override script.

buffer visit_urlstring, boolean?, boolean? )

Visits a web page and returns its HTML source.

string get_counters( string, int, int )

Determine if a counter will expire in a specified period of time.

void council()

Visits the Council of Loathing.

item guardians()

Climbs the Naughty Sorceress' Tower and passes the challenges it can, returning the first item needed to pass a failed stage.

int tavern()

Attempt to complete the tavern, and returns the number of squares visited

boolean entryway()

boolean hedgemaze()

boolean chamber()

These three functions attempt to perform the associated tasks. The return value indicates the success.

location my_location()

Returns the location where you last adventured.

void set_location( location )

Changes the value returned by my_location().

void refresh_status()

Refreshes the side-pane character info (health, effects, etc.).

buffer run_combat()

Uses the current KoLmafia settings to run a combat (for use with visit_url()).

buffer run_choice()

Chooses an option in the current choice adventure.

buffer run_turn()

Works as run_combat() or run_choice( -1 ) depending on whether you are in combat or in a choice.

boolean change_mcd( int )

Tries to set your +ML device to a specified setting and reports on success.

boolean hermit( int, item )

Trades worthless items (adventuring in the sewer if needed) to the hermit for specified items.

Goals and Conditions

void add_item_conditionint, item )

void add_item_conditionitem, int )

Adds a number of the given item to the current auto-adventuring conditions.

string [int] get_goals()

Lists all current goals.

boolean  is_goal( item )

Checks if a given item is a goal.

boolean goal_exists( string )

Checks if there is currently a given type of goal.

void  remove_item_condition( int, item )

Removes adventuring conditions.

About Monsters

For all of the below functions that accept an optional monster parameter, the default value is your most recently-encountered monster (that means your current monster if you're in combat).

int jump_chance( [monster], [int], [int] )

int jump_chance( location, [int], [int] )

Returns the chance of successfully getting the jump against the monster or in the location.

monster last_monster()

Returns last monster encountered.

monster [int] get_monsters( location )

Returns a map of potential monsters at a given location.

float [monster] appearance_rates( location, [boolean] )

Returns a map of the expected frequency of each monster at the specified location.

int monster_attack( [monster] )

Returns the starting/current attack value of the specified monster.

int monster_defense( [monster] )

Returns the starting/current defense value of the specified monster.

int monster_hp( [monster] )

Returns the starting/current HP of the specified monster.

int monster_initiative( [monster] )

Returns the starting/current initiative of the specified monster.

phylum monster_phylum( [monster] )

Returns the phylum of the specified monster.

int expected_damage( [monster] )

Returns the amount of damage you are expected to take each round from the specified monster.

element monster_element( [monster] )

Returns the elemental alignment of the specified monster.

monster image_to_monster( string )

Looks up monster by image name.

boolean is_banished( monster )

Returns true if the specified monster is banished


Choice Adventures

string [int] available_choice_optionsboolean? )

Returns all available choice options in the current (or last) choice adventure the player encountered.

boolean choice_follows_fight()

Returns true if the last finished combat is about to lead into a choice adventure.

boolean handling_choice()

Returns true if you are currently in a choice.

int last_choice()

Returns the ID of the current (or last) choice adventure you encountered.

buffer run_choiceint, boolean?, string? )

Run the current choice adventure by selecting a choice number, optionally choosing to automate any resulting fight, and possibly specifying additional URL parameters.

buffer run_choiceint, string )

Run the current choice adventure by selecting a choice number and specifying additional URL parameters.

Misc.

int get_auto_attack()

Returns your current auto-attack setting.

void set_auto_attack( int )

Sets your auto-attack setting.

boolean set_ccs( string )

Sets your custom combat script.

buffer read_ccs( string )

Reads the text of your custom combat script.

boolean write_ccs( buffer, string )

Writes the text of your custom combat script.