Storage amount: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle Created page with '{{#vardefine:name|storage_amount}} {{#vardefine:return_type|int}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:name}…' |
imported>Bale Changed in r17441 |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{#vardefine:name|storage_amount}} | {{ | ||
{{#vardefine:return_type|int}} | #vardefine:name|storage_amount}}{{ | ||
#vardefine:return_type|int}}{{ | |||
FunctionPage| | |||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 16: | Line 16: | ||
function_description=Returns the amount of the given item that are in storage at Hagnk's.| | function_description=Returns the amount of the given item that are in storage at Hagnk's.| | ||
code1={{CodeSample| | |||
title=Code Sample| | |||
description=The following code will check a pull list loaded from a text file.| | |||
code= | |||
<syntaxhighlight> | |||
int day = 2; | |||
int [int, item] static_pulls; //Items that are always included in a pull list. | |||
file_to_map( "static_pulls.txt" , static_pulls ); | |||
//Validate your pull list before you begin the day | |||
foreach it, req_num in static_pulls[ day ] | |||
{ | |||
if ( storage_amount( it ) < req_num ) | |||
print( "Uh-oh! You don't have enough of " + it + " to pull." , "red" ); | |||
else | |||
print( "You have enough " + it ); | |||
} | |||
</syntaxhighlight> | |||
|moreinfo=Note that [[take_storage]]() returns a boolean value indicating whether an attempt at pulling was successful. | |||
}}| | |||
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}}| | ||
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 01:11, 4 December 2016
Function Syntax
- it is the item to check
Returns the amount of the given item that are in storage at Hagnk's.
Code Sample
The following code will check a pull list loaded from a text file.
int day = 2;
int [int, item] static_pulls; //Items that are always included in a pull list.
file_to_map( "static_pulls.txt" , static_pulls );
//Validate your pull list before you begin the day
foreach it, req_num in static_pulls[ day ]
{
if ( storage_amount( it ) < req_num )
print( "Uh-oh! You don't have enough of " + it + " to pull." , "red" );
else
print( "You have enough " + it );
}
Note that take_storage() returns a boolean value indicating whether an attempt at pulling was successful.
See Also
closet_amount() | display_amount() | equipped_amount() | item_amount() | shop_amount() | stash_amount()
More Information
Information on handling free pulls is at Tips, Tricks and Workarounds.