Difference between revisions of "Item type"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>Bale
m
Line 5: Line 5:
 
FunctionPage|
 
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Equipment|
 
  
 
function1={{Function|
 
function1={{Function|
Line 32: Line 31:
 
special= For non-equipment, this function returns an empty string.|
 
special= For non-equipment, this function returns an empty string.|
 
}}
 
}}
 +
 +
[[Category:Equipment]]

Revision as of 22:11, 21 May 2010

Function Syntax

string item_type(item check_me )

  • check_me is the equipment to check

Returns the type of equipment that check_me is categorized as. Possible values are hat, (various weapon types), shield, offhand, pants, accessory, familiar equipment, shirt, container, hp restore, mp restore, hp+mp restore, food, booze, drink helper, food helper, and familiar larva.

Simple Example

A universal consume function.

if(item_type(it)=="food") eat(qty,it);
else if(item_type(it)=="booze") drink(qty,it);
else use(qty,it);
// Note: this example doesn't check your drunkenness, so it isn't practical for normal use.


See Also

weapon_hands() | weapon_type()

Special

For non-equipment, this function returns an empty string.