Difference between revisions of "Available amount"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
(Created page with '{{#vardefine:name|available_amount}} {{#vardefine:return_type|int}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:nam…')
 
imported>Fredg1
(storage_amount())
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{#vardefine:name|available_amount}}
+
{{
{{#vardefine:return_type|int}}
+
#vardefine:name|available_amount}}{{
 +
#vardefine:return_type|int}}{{
  
{{FunctionPage|
+
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Item Management|
 
  
 
function1={{Function|
 
function1={{Function|
Line 15: Line 15:
 
}}|
 
}}|
  
function_description=Returns the total number available of a given item in all inventory sections accessible to your character based on current restrictions.|
+
function_description=Returns the total number available of a given item in all inventory sections accessible to your character based on current restrictions, including equipped items (for equipment). In Ronin, this includes free pulls, but does not include any other items in Hangk's Storage. Once out of Ronin/run, if [[KoLmafia_Properties#Global_Variables|autoSatisfyWithStorage]] is set to true, this includes items in Hangk's Storage.
 +
If [[KoLmafia_Properties#Global_Variables|autoSatisfyWithCloset]] is set to true, this includes closet. If [[KoLmafia_Properties#Global_Variables|autoSatisfyWithStash]] is set to true, this includes clan stash.|
  
see_also={{SeeAlso|closet_amount|display_amount|equipped_amount|item_amount|shop_amount|stash_amount}}|
+
code1={{CodeSample|
 +
title=Code Sample|
 +
description=Enumerates total number of scrolls of ancient forbidden unspeakable evil.|
 +
code=
 +
<syntaxhighlight>
 +
int current_afue = available_amount($item[scroll of ancient forbidden unspeakable evil]);
 +
// Calculate minimum of pens, paper and ink:
 +
int make_afue = available_amount($item[disintegrating quill pen]);
 +
make_afue = min(make_afue, available_amount($item[tattered scrap of paper]));
 +
make_afue = min(make_afue, available_amount($item[inkwell]));
 +
print("Currently possess "+ current_afue + " afue scrolls.");
 +
print("Can make another "+ make_afue +" scrolls from parts.");
 +
</syntaxhighlight>
 +
}}|
 +
 
 +
see_also={{SeeAlso|closet_amount|display_amount|equipped_amount|item_amount|shop_amount|stash_amount|storage_amount}}|
 +
more_info=Information on handling free pulls is at [[Tips, Tricks and Workarounds#Free Pulls|Tips, Tricks and Workarounds]].|
 
}}
 
}}
 +
 +
[[Category:Item Management]]

Latest revision as of 00:34, 23 June 2020

Function Syntax

int available_amount(item it )

  • it is the item to check

Returns the total number available of a given item in all inventory sections accessible to your character based on current restrictions, including equipped items (for equipment). In Ronin, this includes free pulls, but does not include any other items in Hangk's Storage. Once out of Ronin/run, if autoSatisfyWithStorage is set to true, this includes items in Hangk's Storage. If autoSatisfyWithCloset is set to true, this includes closet. If autoSatisfyWithStash is set to true, this includes clan stash.

Code Sample

Enumerates total number of scrolls of ancient forbidden unspeakable evil.

int current_afue = available_amount($item[scroll of ancient forbidden unspeakable evil]);
// Calculate minimum of pens, paper and ink:
int make_afue = available_amount($item[disintegrating quill pen]);
make_afue = min(make_afue, available_amount($item[tattered scrap of paper]));
make_afue = min(make_afue, available_amount($item[inkwell]));
print("Currently possess "+ current_afue + " afue scrolls.");
print("Can make another "+ make_afue +" scrolls from parts.");

See Also

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

More Information

Information on handling free pulls is at Tips, Tricks and Workarounds.