Item amount

From Kolmafia
Revision as of 08:30, 19 November 2019 by imported>Fredg1 (adding available_amount in See Also)
Jump to navigation Jump to search

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 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.