Difference between revisions of "Equip"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m (moved Equip() to Equip)
imported>Bale
m
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''[[boolean]] equip([[slot]] slottype, item itemtype)'''<br>
+
{{
'''[[boolean]] equip(item itemtype)'''
+
#vardefine:name|equip}}{{
 +
#vardefine:return_type|boolean}}{{
  
 +
FunctionPage|
 +
name={{#var:name}}|
  
Will attempt to equip the item. If the slot is not provided it will attempt to place it in the 'normal' position for the item. (A hat will be placed in a hat slot, a weapon in the mainhand etc.)
+
function1={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|item|equip_me}}|
 +
}}|
  
The return value indicates whether the item was succesfully equipped or not.
+
function2={{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|where}} is the slot to place the item in (optional)|
 +
p2desc={{Pspan|equip_me}} is the item to equip|
 +
}}|
  
Note: If no slot is selected, accessories will only be placed in empty slots.
+
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).  
<br><br>
+
*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.
<code>
+
*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.
equip($slot[acc3],$item[hardened slime belt]);
+
*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.
</code>
+
&nbsp;|
<br>
+
 
Attempts to equip the hardened slimt belt in the accessory 3 slot.
+
code1={{CodeSample|
<br><br>
+
title=Code Sample|
<code>
+
description=Equips the Swashbuckling Getup carefully to ensure that the parrot is in the second accessory slot.|
equip($item[rave whistle]);
+
code=
</code>
+
<syntaxhighlight>
<br>
+
equip($item[eyepatch]);
Attempts to equip the rave whistle as the main weapon.
+
equip($item[swashbuckling pants]);
 +
equip($slot[acc2], $item[stuffed shoulder parrot]);
 +
</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:Equipment]]

Revision as of 22:10, 21 May 2010

Function Syntax

boolean equip(item equip_me )

boolean equip(slot where ,item equip_me )

  • where is the slot to place the item in (optional)
  • equip_me is the item to equip

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.

 

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]);

CLI Equivalent

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

See Also

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