Get inventory

From Kolmafia
Revision as of 18:15, 31 March 2010 by imported>Slyz (Created page with '{{ #vardefine:name|get_inventory}}{{ #vardefine:aggregate|yes}}{{ #vardefine:return_type|int [item]}}{{ FunctionPage| name={{#var:name}}| function_category=Item Management| fun…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

int [item] get_inventory()

Returns a map whose keys are the items in your inventory, associated with their quantity.

Simple Example

This example puts one of each item of your inventory in your closet if you have more than 5:

int[item] inventory = get_inventory() ;
foreach it in inventory
   if ( inventory[it] > 5 ) 
      put_closet( 1, it ) ;