Equip: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
Typo caught.
add new overloads for equipping familiars directly and code example
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Equipment|


function1={{Function|
function1={{Function|
Line 16: Line 15:


function2={{Function|
function2={{Function|
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}}|
}}|
function3={{Function|
name={{#var:name}}|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
aggregate={{#var:aggregate}}|
Line 22: Line 31:
parameter1={{Param|slot|where}}|
parameter1={{Param|slot|where}}|
parameter2={{Param|item|equip_me}}|
parameter2={{Param|item|equip_me}}|
p1desc={{Pspan|where}} is the slot to place the item in (optional)|
p1desc={{Pspan|equip_me}} is the item to equip|
p2desc={{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}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
parameter1={{Param|familiar|fam}}|
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|
}}|
}}|


Line 30: Line 60:
*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 {{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.
*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.
 |
 |


Line 40: Line 71:
equip($item[swashbuckling pants]);
equip($item[swashbuckling pants]);
equip($slot[acc2], $item[stuffed shoulder parrot]);
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>
</syntaxhighlight>
}}|
}}|
Line 46: Line 86:
cli_equiv=The CLI commands "equip" (and others, for specific slots) function similarly.|
cli_equiv=The CLI commands "equip" (and others, for specific slots) function similarly.|
}}
}}
[[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()