item_type()

From KoLMafia
Jump to: navigation, search

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, pasta guardian, 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.


As of October 2017, possible return values for this function are:

...weapon accessory accordion artsything autopult
avatar potion axe bag banjo basket
bazooka blowgun bong book boomerang
bootskin bootspur booze bow can
can of beans card catapult chainsaw chefstaff
claw club container (This includes back items) crop crossbow
cymbals disco ball dodgeball doggie bag dragnet
drill drink helper drum euphemisms familiar equipment
familiar larva fish flail flamethrower flute
folder food food helper forearm replacement frisbee
giftapult guitar gun hammer handcannon
hat horn hose kazoo knife
knife-glove knuckles laser cannon leafblower mace
machine gun offhand pants pasta guardian pistol
pliers polearm polearm? prism radio
rattle rifle rod sack saucepan
saw shield shirt shotgun sitar
sixgun sling slingshot snowsack spade
spear spleen item spring staff sticker
superball switchblade sword theremin totem
umbrella utensil violin wand whip
whistle yoyo zap wand