Difference between revisions of "Take storage"

From Kolmafia
Jump to navigation Jump to search
imported>PhilmASTErpLus
(Added code sample (blatantly parallel to the one in storage_amount()) and removed needscode=yes)
imported>Bale
(free pull info)
Line 17: Line 17:
 
}}|
 
}}|
  
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. This will not retrieve an item that is a free pull.|
  
  
Line 41: Line 41:
 
see_also={{SeeAlso|take_closet|take_display|take_stash}}|
 
see_also={{SeeAlso|take_closet|take_display|take_stash}}|
 
cli_equiv=The CLI commands "pull" and "hagnk" function similarly.|
 
cli_equiv=The CLI commands "pull" and "hagnk" function similarly.|
 +
more_info=Information on handling free pulls is at [[Tips, Tricks and Workarounds#Free Pulls|Tips, Tricks and Workarounds]].|
 
}}
 
}}
  
 
[[Category:Item Management]]
 
[[Category:Item Management]]

Revision as of 06:30, 25 September 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. This will not retrieve an item that is a free pull.

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.

See Also

take_closet() | take_display() | take_stash()

More Information

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