Item type: Difference between revisions
Jump to navigation
Jump to search
changed category |
imported>StDoodle No edit summary |
||
Line 12: | Line 12: | ||
return_also={{#var:return_also}}| | return_also={{#var:return_also}}| | ||
parameter1={{Param|item|check_me}}| | parameter1={{Param|item|check_me}}| | ||
p1desc={{Pspan|check_me}} is the | p1desc={{Pspan|check_me}} is the item to check| | ||
}}| | }}| | ||
function_description=Returns the type of | function_description=Returns the type of item that {{pspan|check_me}} is categorized as by KoLmafia. Possible values are all equipment types (see [http://kol.coldfront.net/thekolwiki/index.php/Category:Weapons Category:Weapons] on Coldfront) or other types (such as hp restore, mp restore, hp+mp restore, food, booze, drink helper, food helper, and familiar larva) that KoLmafia has a programmed action that the item is associated with.| | ||
code1={{CodeSample| | code1={{CodeSample| | ||
Line 26: | Line 26: | ||
else use(qty,it); | else use(qty,it); | ||
// Note: this example doesn't check your drunkenness, so it isn't practical for normal use. | // Note: this example doesn't check your drunkenness, so it isn't practical for normal use. | ||
</syntaxhighlight>}} | </syntaxhighlight>}}| | ||
special= For items that KoLmafia doesn't have a programmed function for, this function returns an empty string.| | |||
special= For | |||
}} | }} | ||
[[Category:Item Management]] | [[Category:Item Management]] |
Revision as of 15:00, 7 July 2010
Function Syntax
string item_type(item check_me )
- check_me is the item to check
Returns the type of item that check_me is categorized as by KoLmafia. Possible values are all equipment types (see Category:Weapons on Coldfront) or other types (such as hp restore, mp restore, hp+mp restore, food, booze, drink helper, food helper, and familiar larva) that KoLmafia has a programmed action that the item is associated with.
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.
Special
For items that KoLmafia doesn't have a programmed function for, this function returns an empty string.