Use skill: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
m Linkified.
imported>Pineapple of Despair
Added missing single-cast ashref declarations, fixed a pXdef typo.
Line 7: Line 7:


function1={{Function|
function1={{Function|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
parameter1={{Param|skill|to_use}}|
}}|
function2={{Function|
name={{#var:name}}|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
aggregate={{#var:aggregate}}|
Line 15: Line 23:
}}|
}}|


function2={{Function|
function3={{Function|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
parameter1={{Param|skill|to_use}}|
parameter2={{Param|string|target}}|
}}|
 
function4={{Function|
name={{#var:name}}|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
aggregate={{#var:aggregate}}|
Line 23: Line 40:
parameter2={{Param|skill|to_use}}|
parameter2={{Param|skill|to_use}}|
parameter3={{Param|string|target}}|
parameter3={{Param|string|target}}|
p1desc={{Pspan|casts}} is the number of casts|
p1desc={{Pspan|casts}} is the (optional) number of casts|
p2desc={{Pspan|to_use}} is the skill to use|
p2desc={{Pspan|to_use}} is the skill to use|
p2desc={{Pspan|target}} is the recipient (optional, for use with buffs only)|
p3desc={{Pspan|target}} is the recipient (optional, for use with buffs only)|
}}|
}}|


function_description=Attempts to cast the skill {{pspan|to_use}} a number of times specified by {{pspan|casts}}. Defaults to casting on yourself, but you can specify a {{pspan|target}} for buffs.|
function_description=Attempts to cast the skill {{pspan|to_use}} a number of times specified by {{pspan|casts}}, or once if not specified. Defaults to casting on yourself, but you can specify a {{pspan|target}} for buffs.|


code1={{CodeSample|
code1={{CodeSample|
Line 68: Line 85:


}}
}}
{{RFI|The page of old listed the possibility of specifying casts for the consult version, but ashref does not; please clarify}}


[[Category:Skills and Effects]]|[[Category:In-combat Consulting]]
[[Category:Skills and Effects]]|[[Category:In-combat Consulting]]

Revision as of 22:11, 26 November 2011

Normal Use

Function Syntax

boolean use_skill(skill to_use )

boolean use_skill(int casts ,skill to_use )

boolean use_skill(skill to_use ,string target )

boolean use_skill(int casts ,skill to_use ,string target )

  • casts is the (optional) number of casts
  • to_use is the skill to use
  • target is the recipient (optional, for use with buffs only)

Attempts to cast the skill to_use a number of times specified by casts, or once if not specified. Defaults to casting on yourself, but you can specify a target for buffs.

Code Sample

This example will attempt to cast the specified skill as many times as it can with the MP the character has left.

effect chosen = $effect[ Empathy ];
use_skill( my_mp() / mp_cost( to_skill(chosen) )  , to_skill(chosen) );

CLI Equivalent

The CLI command "cast" functions similarly to the normal version of this function (with similar parameters).

In-combat Consulting

Function Syntax

buffer use_skill(skill to_use )

buffer use_skill(int casts ,skill to_use )

  • casts is the (optional) number of casts
  • to_use is the skill to use

Will loop the specified number of casts (default to 1 if omitted) using the specified skill to_use, never reconsulting the script until the loop is complete. One exception: this will not work with Lasagna Bandages, since it tries to cast the out-of-combat version of the skill. Using visit_url() is required for casting Lasagna Bandages in combat.

|