Difference between revisions of "Item type"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
imported>Icon315
Line 15: Line 15:
 
}}|
 
}}|
  
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.|
+
function_description=Returns the type of item that {{pspan|check_me}} is categorized as by KoLmafia. Possible values are all equipment types (see {{kolwiki|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|

Revision as of 21:45, 5 August 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.