Difference between revisions of "Get inventory"

From Kolmafia
Jump to navigation Jump to search
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…')
(No difference)

Revision as of 18:15, 31 March 2010

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 ) ;