Difference between revisions of "Use skill"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>StDoodle
Line 1: Line 1:
'''[[string]] use_skill([[skill]] touse)'''<br>
+
{{
'''[[boolean]] use_skill(int count, [[skill]] touse)'''
+
#vardefine:name|use_skill}}{{
 +
#vardefine:return_type|boolean}}=Normal Use={{
  
Attempts to use the skill listed as 'touse'.
+
FunctionPage|
 +
name={{#var:name}}|
 +
function_category=Skills and Effects|
  
The one returning a string is more helpful for battle as it will return the page html. Whereas the second will just say whether you have the skill or not.
+
function1={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|int|casts}}|
 +
parameter2={{Param|skill|to_use}}|
 +
}}|
  
This example will attempt to cast the specified skill as many times as it can with the MP the character has left.<br>
+
function2={{Function|
<p><pre>
+
name={{#var:name}}|
effect chosen = $effect[Empathy];
+
aggregate={{#var:aggregate}}|
use_skill(my_mp()/mp_cost(to_skill(chosen)),to_skill(chosen));
+
return_type={{#var:return_type}}|
</pre></p>
+
return_also={{#var:return_also}}|
{{Format}}
+
parameter1={{Param|int|casts}}|
 +
parameter2={{Param|skill|to_use}}|
 +
parameter3={{Param|string|target}}|
 +
p1desc={{Pspan|casts}} is the number of casts|
 +
p2desc={{Pspan|to_use}} is the skill to use|
 +
p2desc={{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.|
 +
}}=In-combat Consulting={{
 +
 
 +
FunctionPage|
 +
name={{#var:name}}|
 +
function_category=In-combat Consulting|
 +
 
 +
function1={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type=string|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|skill|to_use}}|
 +
}}|
 +
 
 +
function2={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type=string|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|int|casts}}|
 +
parameter2={{Param|skill|to_use}}|
 +
p1desc={{Pspan|casts}} is the (optional) number of casts|
 +
p2desc={{Pspan|to_use}} is the skill to use|
 +
}}|
 +
 
 +
function_description=Will loop the specified number of {{pspan|casts}} (default of one time) using the specified skill {{pspan|to_use}}, never reconsulting the script until the loop is complete.|
 +
 
 +
code1={{CodeSample|
 +
title=Code Sample|
 +
description=This example will attempt to cast the specified skill as many times as it can with the MP the character has left.|
 +
code=
 +
<syntaxhighlight>
 +
effect chosen = $effect[ Empathy ];
 +
use_skill( my_mp() / mp_cost( to_skill(chosen) ) ,to_skill(chosen) );
 +
</syntaxhighlight>}}|
 +
 
 +
cli_equiv=The CLI command "cast" functions similarly to the normal version of this function (with similar parameters).|
 +
}}

Revision as of 01:35, 9 March 2010

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
  • target is the recipient (optional, for use with buffs only)

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

In-combat Consulting

Function Syntax

string use_skill(skill to_use )

string 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 of one time) using the specified skill to_use, never reconsulting the script until the loop is complete.

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).