Difference between revisions of "Item type"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
(Created page with '{{#vardefine:name|item_type}} {{#vardefine:return_type|string}} {{FunctionPage| name={{#var:name}}| function_category=Equipment| function1={{Function| name={{#var:name}}| aggre…')
 
imported>Aventuristo
(Added list of return values)
 
(14 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{#vardefine:name|item_type}}
+
{{
{{#vardefine:return_type|string}}
+
#vardefine:name|item_type}}{{
 +
#vardefine:return_type|string}}{{
  
{{FunctionPage|
+
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Equipment|
 
  
 
function1={{Function|
 
function1={{Function|
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 equipment to check|
+
p1desc={{Pspan|check_me}} is the item to check|
 
}}|
 
}}|
  
function_description=Returns the type of equipment that {{pspan|check_me}} is categorized as. Possible values are hat, sword, staff, chefstaff, whip, shield, offhand, pants, accessory, familiar equipment, shirt and container.|
+
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, pasta guardian, and familiar larva) that KoLmafia has a programmed action that the item is associated with.|
  
needscode=yes|
+
code1={{CodeSample|
 +
title=Simple Example|
 +
description=A universal consume function.|
 +
code=
 +
<syntaxhighlight>
 +
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.
 +
</syntaxhighlight>}}|
 +
 
 +
special= For items that KoLmafia doesn't have a programmed function for, this function returns an empty string.|
  
see_also={{SeeAlso|weapon_hands|weapon_type}}|
 
special= For non-equipment, this function returns an empty string.|
 
 
}}
 
}}
{{RFI|Please edit in any missing values.}}
+
 
 +
As of October 2017, possible return values for this function are:
 +
{| cellpadding="0" cellspacing="3px" border="0px"
 +
|style="width: 20%"| ...weapon
 +
|style="width: 20%"| accessory
 +
|style="width: 20%"| accordion
 +
|style="width: 20%"| artsything
 +
|style="width: 20%"| 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
 +
|}
 +
 
 +
[[Category:Item Management]]

Latest revision as of 20:07, 27 October 2017

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