Is displayable: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle Created page with '{{#vardefine:name|is_displayable}} {{#vardefine:return_type|boolean}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:na…' |
imported>PhilmASTErpLus Added code sample and removed needscode=yes. |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{#vardefine:name|is_displayable}} | {{ | ||
{{#vardefine:return_type|boolean}} | #vardefine:name|is_displayable}}{{ | ||
{{FunctionPage| | #vardefine:return_type|boolean}}{{ | ||
FunctionPage| | |||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 16: | Line 17: | ||
function_description=This function checks to see if the item {{pspan|check_me}} can be put in a display case, returning true if it can and false otherwise.| | function_description=This function checks to see if the item {{pspan|check_me}} can be put in a display case, returning true if it can and false otherwise.| | ||
code1={{CodeSample| | |||
title=Code Sample| | |||
description=The following code attempts to fill your display case with one of every item, only using the ones you have in your inventory. This is essentially a mock-up of [http://www.jickenwings.org/collections/index.cgi?query_value=holderofsecrets&query_type=player&last_query_type=&last_query_value=&Search=Search HolderofSecrets](Warning: large page), who is striving to get one of every item in the game.| | |||
code=<syntaxhighlight> | |||
batch_open(); | |||
foreach itm, quantity in get_inventory() | |||
{ | |||
if ( is_displayable( itm ) && display_amount( itm ) == 0 ) | |||
put_display( 1 , itm ); | |||
} | |||
batch_close(); | |||
</syntaxhighlight> | |||
|moreinfo=Note that [[put_display]]() returns a boolean value indicating whether the operation is successful or not. | |||
}}| | |||
see_also={{SeeAlso|is_giftable|is_tradeable}}| | see_also={{SeeAlso|is_giftable|is_tradeable}}| | ||
}} | }} | ||
[[Category:Item Management]] |
Latest revision as of 18:20, 28 June 2010
Function Syntax
boolean is_displayable(item check_me )
- check_me is an item to test
This function checks to see if the item check_me can be put in a display case, returning true if it can and false otherwise.
Code Sample
The following code attempts to fill your display case with one of every item, only using the ones you have in your inventory. This is essentially a mock-up of HolderofSecrets(Warning: large page), who is striving to get one of every item in the game.
batch_open();
foreach itm, quantity in get_inventory()
{
if ( is_displayable( itm ) && display_amount( itm ) == 0 )
put_display( 1 , itm );
}
batch_close();
Note that put_display() returns a boolean value indicating whether the operation is successful or not.