Available amount: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>Bale
added code sample
Line 18: Line 18:
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.|


needscode=yes|
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}}|
see_also={{SeeAlso|closet_amount|display_amount|equipped_amount|item_amount|shop_amount|stash_amount}}|
}}
}}

Revision as of 09:22, 10 March 2010

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.

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()