Difference between pages "Soulsauce cost" and "Equip"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Darzil
(Created page with "{{ #vardefine:name|soulsauce_cost}}{{ #vardefine:return_type|int}}{{ FunctionPage| name={{#var:name}}| function1={{Function| name={{#var:name}}| aggregate={{#var:aggregate}...")
 
(add new overloads for equipping familiars directly and code example)
 
Line 1: Line 1:
 
{{
 
{{
#vardefine:name|soulsauce_cost}}{{
+
#vardefine:name|equip}}{{
#vardefine:return_type|int}}{{
+
#vardefine:return_type|boolean}}{{
  
 
FunctionPage|
 
FunctionPage|
 +
name={{#var:name}}|
 +
 +
function1={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|item|equip_me}}|
 +
}}|
  
 +
function2={{Function|
 
name={{#var:name}}|
 
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|item|equip_me}}|
 +
parameter2={{Param|slot|where}}|
 +
 +
}}|
  
function1={{Function|
+
function3={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|slot|where}}|
 +
parameter2={{Param|item|equip_me}}|
 +
p1desc={{Pspan|equip_me}} is the item to equip|
 +
p2desc={{Pspan|where}} is the slot to place the item in|
 +
}}|
 +
 
 +
function4={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|item|equip_me}}|
 +
parameter2={{Param|familiar|fam}}|
 +
 
 +
}}|
 +
 
 +
function5={{Function|
 
name={{#var:name}}|
 
name={{#var:name}}|
 
aggregate={{#var:aggregate}}|
 
aggregate={{#var:aggregate}}|
 
return_type={{#var:return_type}}|
 
return_type={{#var:return_type}}|
 
return_also={{#var:return_also}}|
 
return_also={{#var:return_also}}|
parameter1={{Param|skill|use_me}}|
+
parameter1={{Param|familiar|fam}}|
p1desc={{Pspan|use_me}} is the skill to check the cost of|
+
parameter2={{Param|item|equip_me}}|
 +
p1desc={{Pspan|equip_me}} is the item to equip|
 +
p2desc={{Pspan|where}} is the familiar to equip the item on|
 
}}|
 
}}|
  
function_description=Returns the Soulsauce cost for the next cast of the given skill {{pspan|use_me}}.
+
function_description=Attempts to equip the item {{pspan|equip_me}} in the slot {{pspan|where}} if specified, and returns true if the operation was successful, and false if it was not. If parameter {{pspan|where}} is not specified, it defaults to the "standard" place for such an item (main-hand for 1-handed weapons, first open slot for accessories or acc1 if no slots are open).
 +
*If {{pspan|where}} is specified and {{pspan|equip_me}} is set to $item[none], this function will unequip whatever is in slot {{pspan|where}} and return true.
 +
*If {{pspan|where}} is not specified and {{pspan|equip_me}} is set to $item[none], the function aborts and you get a funky error because that makes no sense.
 +
*If you cannot equip {{pspan|equip_me}}, or {{pspan|where}} is supplied and the item cannot be used in that slot, you will be given an error message and this function will return false.
 +
*The overload for equipping a familiar with {{pspan|equip_me}} can be used to equip familiars with familiar equipment without requiring the familiar to be your currently active familiar. This will return false if you don't have (or can't use) the familiar or if the familiar can't equip the item you are attempting to equip.
 +
 |
 +
 
 +
code1={{CodeSample|
 +
title=Code Sample|
 +
description=Equips the Swashbuckling Getup carefully to ensure that the parrot is in the second accessory slot.|
 +
code=
 +
<syntaxhighlight>
 +
equip($item[eyepatch]);
 +
equip($item[swashbuckling pants]);
 +
equip($slot[acc2], $item[stuffed shoulder parrot]);
 +
</syntaxhighlight>
 +
}}|
 +
 
 +
code2={{CodeSample|
 +
title=Code Sample|
 +
description=Equips the blue plate on the Shorter-Order Cook without switching to it first.|
 +
code=
 +
<syntaxhighlight>
 +
equip($familiar[shorter-order cook], $item[blue plate]);
 +
</syntaxhighlight>
 +
}}|
  
 +
see_also={{SeeAlso|can_equip|equipped_amount|equipped_item|have_equipped}}|
 +
cli_equiv=The CLI commands "equip" (and others, for specific slots) function similarly.|
 
}}
 
}}
  
[[Category:Skills and Effects]]
+
[[Category:Equipment]]

Latest revision as of 16:49, 12 April 2024

Function Syntax

boolean equip(item equip_me )

boolean equip(item equip_me ,slot where )

boolean equip(slot where ,item equip_me )

  • equip_me is the item to equip
  • where is the slot to place the item in

boolean equip(item equip_me ,familiar fam )

boolean equip(familiar fam ,item equip_me )

  • equip_me is the item to equip
  • where is the familiar to equip the item on

Attempts to equip the item equip_me in the slot where if specified, and returns true if the operation was successful, and false if it was not. If parameter where is not specified, it defaults to the "standard" place for such an item (main-hand for 1-handed weapons, first open slot for accessories or acc1 if no slots are open).

  • If where is specified and equip_me is set to $item[none], this function will unequip whatever is in slot where and return true.
  • If where is not specified and equip_me is set to $item[none], the function aborts and you get a funky error because that makes no sense.
  • If you cannot equip equip_me, or where is supplied and the item cannot be used in that slot, you will be given an error message and this function will return false.
  • The overload for equipping a familiar with equip_me can be used to equip familiars with familiar equipment without requiring the familiar to be your currently active familiar. This will return false if you don't have (or can't use) the familiar or if the familiar can't equip the item you are attempting to equip.

 

Code Sample

Equips the Swashbuckling Getup carefully to ensure that the parrot is in the second accessory slot.

equip($item[eyepatch]);
equip($item[swashbuckling pants]);
equip($slot[acc2], $item[stuffed shoulder parrot]);

Code Sample

Equips the blue plate on the Shorter-Order Cook without switching to it first.

equip($familiar[shorter-order cook], $item[blue plate]);

CLI Equivalent

The CLI commands "equip" (and others, for specific slots) function similarly.

See Also

can_equip() | equipped_amount() | equipped_item() | have_equipped()