Put display: Difference between revisions
Jump to navigation
Jump to search
imported>PhilmASTErpLus Added code sample |
imported>Heeheehee m Save a few server hits, if someone actually copies this code and executes it. |
||
(One intermediate revision by one other user not shown) | |||
Line 22: | Line 22: | ||
title=Code Sample| | title=Code Sample| | ||
description=The following code will put 1 of each Club, Diamond, Heart, and Space necklace into the display case.| | description=The following code will put 1 of each Club, Diamond, Heart, and Space necklace into the display case.| | ||
code= | code=<syntaxhighlight> | ||
<syntaxhighlight> | batch_open(); | ||
foreach necklace in $items[ 1995, 2016, 2017, 2018 ] | foreach necklace in $items[ 1995, 2016, 2017, 2018 ] | ||
{ | { | ||
Line 31: | Line 31: | ||
print( "You don't have any " + necklace.to_plural() ); | print( "You don't have any " + necklace.to_plural() ); | ||
} | } | ||
</syntaxhighlight> | batch_close(); | ||
</syntaxhighlight> | |||
}}| | |||
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.