Difference between revisions of "Put display"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
(Created page with '{{#vardefine:name|put_display}} {{#vardefine:return_type|boolean}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:name…')
 
imported>Heeheehee
m (Save a few server hits, if someone actually copies this code and executes it.)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{#vardefine:name|put_display}}
+
{{
{{#vardefine:return_type|boolean}}
+
#vardefine:name|put_display}}{{
 +
#vardefine:return_type|boolean}}{{
  
{{FunctionPage|
+
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Item Management|
 
  
 
function1={{Function|
 
function1={{Function|
Line 19: Line 19:
 
function_description=Attempts to move {{pspan|qty}} of {{pspan|it}} to your display case from 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}} to your display case from your main inventory. Returns true if the move succeeds and false if it does not.|
  
needscode=yes|
+
code1={{CodeSample|
 +
title=Code Sample|
 +
description=The following code will put 1 of each Club, Diamond, Heart, and Space necklace into the display case.|
 +
code=<syntaxhighlight>
 +
batch_open();
 +
foreach necklace in $items[ 1995, 2016, 2017, 2018 ]
 +
{
 +
  if ( item_amount( necklace ) > 0 )
 +
      put_display( 1 , necklace );
 +
  else
 +
      print( "You don't have any " + necklace.to_plural() );
 +
}
 +
batch_close();
 +
</syntaxhighlight>
 +
}}|
 +
 
 +
 
  
 
see_also={{SeeAlso|put_closet|put_stash|take_display}}|
 
see_also={{SeeAlso|put_closet|put_stash|take_display}}|
 
cli_equiv=The CLI command "display" with the parameter "put" works similarly.
 
cli_equiv=The CLI command "display" with the parameter "put" works similarly.
 
}}
 
}}
 +
 +
[[Category:Item Management]]

Latest revision as of 17:45, 26 June 2010

Function Syntax

boolean put_display(int qty ,item it )

  • qty is the quantity to move
  • it is the item to move

Attempts to move qty of it to your display case from your main inventory. Returns true if the move succeeds and false if it does not.

Code Sample

The following code will put 1 of each Club, Diamond, Heart, and Space necklace into the display case.

batch_open();
foreach necklace in $items[ 1995, 2016, 2017, 2018 ]
{
   if ( item_amount( necklace ) > 0 )
      put_display( 1 , necklace );
   else
      print( "You don't have any " + necklace.to_plural() );
}
batch_close();

CLI Equivalent

The CLI command "display" with the parameter "put" works similarly.

See Also

put_closet() | put_stash() | take_display()