Difference between revisions of "Take storage"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>Bale
(r11982)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{#vardefine:name|take_storage}}
+
{{
{{#vardefine:return_type|boolean}}
+
#vardefine:name|take_storage}}{{
 +
#vardefine:return_type|boolean}}{{
  
{{FunctionPage|
+
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Item Management|
 
  
 
function1={{Function|
 
function1={{Function|
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 retrieve an item that is a free pull, with one exception. If you are in Bad Moon, this command will not take the VIP Key from Storage.|
  
needscode=yes|
+
 
 +
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}}|
 +
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]].|
 
}}
 
}}
{{RFI|Is the CLI command storage similar, or does it just list what you have?}}
+
 
 +
[[Category:Item Management]]

Latest revision as of 20:56, 21 March 2013

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 retrieve an item that is a free pull, with one exception. If you are in Bad Moon, this command will not take the VIP Key from Storage.

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.