Item amount: Difference between revisions
Jump to navigation
Jump to search
imported>Zarqon m Redirecting to Item amount() |
imported>StDoodle No edit summary |
||
Line 1: | Line 1: | ||
# | {{#vardefine:name|item_amount}} | ||
{{#vardefine:return_type|int}} | |||
{{FunctionPage| | |||
name={{#var:name}}| | |||
function_category=Item Management| | |||
function1={{Function| | |||
name={{#var:name}}| | |||
aggregate={{#var:aggregate}}| | |||
return_type={{#var:return_type}}| | |||
return_also={{#var:return_also}}| | |||
parameter1={{Param|item|it}}| | |||
p1desc={{Pspan|it}} is the item to check for. | |||
}}| | |||
function_description=Returns the amount of an item you currently have in your inventory; does not include items in your Colossal Closet or Hagnk's storage.| | |||
code1={{CodeSample| | |||
title=Code Sample| | |||
description=This example function will return the total number of knob goblin firecrackers in your inventory, closet and Hagnk's.| | |||
code= | |||
<syntaxhighlight> | |||
int item_count() { | |||
item x = $item[knob goblin firecracker]; | |||
int counter = item_amount( x ) + closet_amount( x ) + storage_amount( x ); | |||
return counter; | |||
} | |||
</syntaxhighlight>}}| | |||
see_also={{SeeAlso|closet_amount|display_amount|equipped_amount|shop_amount|stash_amount|storage_amount}}| | |||
cli_equiv=The CLI command "inventory" functions similarly.| | |||
special=When not logged in, this function returns 0. | |||
}} |
Revision as of 22:12, 2 March 2010
Function Syntax
- it is the item to check for.
Returns the amount of an item you currently have in your inventory; does not include items in your Colossal Closet or Hagnk's storage.
Code Sample
This example function will return the total number of knob goblin firecrackers in your inventory, closet and Hagnk's.
int item_count() {
item x = $item[knob goblin firecracker];
int counter = item_amount( x ) + closet_amount( x ) + storage_amount( x );
return counter;
}
CLI Equivalent
The CLI command "inventory" functions similarly.
See Also
closet_amount() | display_amount() | equipped_amount() | shop_amount() | stash_amount() | storage_amount()
Special
When not logged in, this function returns 0.