Use skill: Difference between revisions
imported>StDoodle mNo edit summary |
imported>Heeheehee Correct the claim that use_skill returns different things depending on calling context, as opposed to type of parameters passed. |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
There are two forms of this function. In a combat consult script, this returns a buffer, but otherwise it returns a boolean. Note both forms below. | |||
{{ | {{ | ||
#vardefine:name|use_skill}}{{ | #vardefine:name|use_skill}}{{ | ||
Line 5: | Line 7: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 26: | Line 27: | ||
p1desc={{Pspan|casts}} is the number of casts| | p1desc={{Pspan|casts}} is the number of casts| | ||
p2desc={{Pspan|to_use}} is the skill to use| | p2desc={{Pspan|to_use}} is the skill to use| | ||
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 46: | Line 47: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 59: | Line 59: | ||
name={{#var:name}}| | name={{#var:name}}| | ||
aggregate={{#var:aggregate}}| | aggregate={{#var:aggregate}}| | ||
return_type= | return_type=boolean| | ||
return_also={{#var:return_also}}| | return_also={{#var:return_also}}| | ||
parameter1={{Param|int|casts}}| | parameter1={{Param|int|casts}}| | ||
Line 67: | Line 67: | ||
}}| | }}| | ||
function_description= | function_description=If the two-argument form is used in-combat, it will loop the specified number of {{pspan|casts}} using the specified skill {{pspan|to_use}}, never reconsulting the script until the loop is complete or the monster is defeated. The single-argument form will use the skill, then return the HTML response text. One exception: this will not work with Lasagna Bandages, since it tries to cast the out-of-combat version of the skill. Using {{f|visit_url}} is required for casting Lasagna Bandages in combat.| | ||
}} | }} | ||
{{RFI| | |||
[[Category:Skills and Effects]][[Category:In-combat Consulting]] | |||
{{RFI|Confirm: Is visit_url() still needed for Lasagna Bandages?}} |
Latest revision as of 01:34, 26 March 2015
There are two forms of this function. In a combat consult script, this returns a buffer, but otherwise it returns a boolean. Note both forms below.
Normal Use
Function Syntax
boolean use_skill(int casts ,skill to_use )
boolean use_skill(int casts ,skill to_use ,string target )
- casts is the 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 )
boolean use_skill(int casts ,skill to_use )
- casts is the (optional) number of casts
- to_use is the skill to use
If the two-argument form is used in-combat, it will loop the specified number of casts using the specified skill to_use, never reconsulting the script until the loop is complete or the monster is defeated. The single-argument form will use the skill, then return the HTML response text. 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.
Attention KoLmafia Experts!
We need your help; some details of this function's operation are unknown or unclear.
The following specific question has been raised:
- Confirm: Is visit_url() still needed for Lasagna Bandages?