Item amount: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>Fredg1
adds that it does not include equipped items
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Item Management|


function1={{Function|
function1={{Function|
Line 16: Line 15:
}}|
}}|


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.|
function_description=Returns the amount of an item you currently have in your inventory; does not include equipped items (for equipment), items in your Colossal Closet or Hagnk's storage.|


code1={{CodeSample|
code1={{CodeSample|
Line 30: Line 29:
</syntaxhighlight>}}|
</syntaxhighlight>}}|


see_also={{SeeAlso|closet_amount|display_amount|equipped_amount|shop_amount|stash_amount|storage_amount}}|
see_also={{SeeAlso|available_amount|closet_amount|display_amount|equipped_amount|shop_amount|stash_amount|storage_amount}}|
cli_equiv=The CLI command "inventory" functions similarly.|
cli_equiv=The CLI command "inventory" functions similarly.|
special=When not logged in, this function returns 0.
special=When not logged in, this function returns 0.
}}
}}
[[Category:Item Management]]

Latest revision as of 21:21, 24 November 2019

Function Syntax

int item_amount(item it )

  • it is the item to check for.

Returns the amount of an item you currently have in your inventory; does not include equipped items (for equipment), 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

available_amount() | closet_amount() | display_amount() | equipped_amount() | shop_amount() | stash_amount() | storage_amount()

Special

When not logged in, this function returns 0.