Can equip: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle Created page with '{{#vardefine:name|can_equip}} {{#vardefine:return_type|boolean}} {{FunctionPage| name={{#var:name}}| function_category=| function1={{Function| name={{#var:name}}| aggregate={{#…' |
imported>Heeheehee Update can_equip to account for various updates to kolmafia.session.EquipmentManager. |
||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{#vardefine:name|can_equip}} | {{ | ||
{{#vardefine:return_type|boolean}} | #vardefine:name|can_equip}}{{ | ||
#vardefine:return_type|boolean}}{{ | |||
FunctionPage| | |||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 11: | Line 11: | ||
return_type={{#var:return_type}}| | return_type={{#var:return_type}}| | ||
return_also={{#var:return_also}}| | return_also={{#var:return_also}}| | ||
parameter1={{Param| | parameter1={{Param|item|check_me}}| | ||
p1desc={{Pspan|}}| | p1desc={{Pspan|check_me}} is the item to check| | ||
}}| | }}| | ||
function_description=| | function_description=Returns true if, based on your current stats, you are capable of equipping {{pspan|check_me}} on your character, false if you cannot. Note that this function doesn't check for whether or not you actually have the item; just whether you're capable of equipping it. | | ||
code1={{CodeSample| | |||
title=Code Sample| | |||
description=Check to see if the character can equip a Hippo Poncho.| | |||
code= | |||
<syntaxhighlight> | |||
if(!have_skill($skill[torso awaregness])) | |||
print("Cannot equip a shirt if you don't know how to find your own torso!"); | |||
if(can_equip($item[hippo poncho])) | |||
print("You're sexy enough to wear a hippo poncho.", "green"); | |||
else print("You're not sexy enough to wear a hippo poncho.", "red"); | |||
</syntaxhighlight> | |||
}}| | |||
see_also={{SeeAlso|}} | see_also={{SeeAlso|have_equipped}}| | ||
special= Note that this, for the most part, only checks for stat requirements to equip an item, so, for example, checking for a chefstaff will return true if you meet the stat requirements to equip it, even if you don't have Spirit of Rigatoni or a sauce glove. However, Torso Awareness is checked if applicable, as are ascension restrictions and, to some extent, familiar type.| | |||
special= | | |||
}} | }} | ||
[[Category:Equipment]] |
Latest revision as of 19:43, 25 August 2012
Function Syntax
boolean can_equip(item check_me )
- check_me is the item to check
Returns true if, based on your current stats, you are capable of equipping check_me on your character, false if you cannot. Note that this function doesn't check for whether or not you actually have the item; just whether you're capable of equipping it.
Code Sample
Check to see if the character can equip a Hippo Poncho.
if(!have_skill($skill[torso awaregness]))
print("Cannot equip a shirt if you don't know how to find your own torso!");
if(can_equip($item[hippo poncho]))
print("You're sexy enough to wear a hippo poncho.", "green");
else print("You're not sexy enough to wear a hippo poncho.", "red");
See Also
Special
Note that this, for the most part, only checks for stat requirements to equip an item, so, for example, checking for a chefstaff will return true if you meet the stat requirements to equip it, even if you don't have Spirit of Rigatoni or a sauce glove. However, Torso Awareness is checked if applicable, as are ascension restrictions and, to some extent, familiar type.