Take storage: Difference between revisions
Jump to navigation
Jump to search
imported>Bale mNo edit summary |
imported>PhilmASTErpLus Added code sample (blatantly parallel to the one in storage_amount()) and removed needscode=yes |
||
Line 19: | Line 19: | ||
function_description=Attempts to move {{pspan|qty}} of {{pspan|it}} from Hagnk's Ancestral Storage to your main inventory. Returns true if the move succeeds and false if it does not.| | function_description=Attempts to move {{pspan|qty}} of {{pspan|it}} from Hagnk's Ancestral Storage to your main inventory. Returns true if the move succeeds and false if it does not.| | ||
code1={{CodeSample| | |||
title=Code Sample| | |||
description=The following code will use 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 ); | |||
foreach it, req_num in static_pulls[ day ] | |||
{ | |||
if ( !take_storage( req_num , it ) ) | |||
print( "Dang! Something went wrong while pulling " + it + ", maybe you don't have enough of those." , "red" ); | |||
else | |||
print( "Pulled " + req_num + " of " + it ); | |||
} | |||
</syntaxhighlight> | |||
}}| | |||
see_also={{SeeAlso|take_closet|take_display|take_stash}}| | see_also={{SeeAlso|take_closet|take_display|take_stash}}| |
Revision as of 17:58, 28 June 2010
Function Syntax
boolean take_storage(int qty ,item it )
- qty is the quantity to move
- it is the item to move
Attempts to move qty of it from Hagnk's Ancestral Storage to your main inventory. Returns true if the move succeeds and false if it does not.
Code Sample
The following code will use 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 );
foreach it, req_num in static_pulls[ day ]
{
if ( !take_storage( req_num , it ) )
print( "Dang! Something went wrong while pulling " + it + ", maybe you don't have enough of those." , "red" );
else
print( "Pulled " + req_num + " of " + it );
}
CLI Equivalent
The CLI commands "pull" and "hagnk" function similarly.