Difference between revisions of "Get inventory"
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…') |
imported>Slyz |
||
Line 14: | Line 14: | ||
return_also={{#var:return_also}}| | return_also={{#var:return_also}}| | ||
}}| | }}| | ||
− | function_description=Returns a map | + | function_description=Returns a map where each key is an item in your inventory, with the integer value its quantity.| |
code1={{CodeSample| | code1={{CodeSample| | ||
Line 26: | Line 26: | ||
put_closet( 1, it ) ; | put_closet( 1, it ) ; | ||
</syntaxhighlight>}}| | </syntaxhighlight>}}| | ||
− | |||
}} | }} |
Revision as of 18:18, 31 March 2010
Function Syntax
int [item] get_inventory()
Returns a map where each key is an item in your inventory, with the integer value its 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 ) ;