Display amount: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
Created page with '{{#vardefine:name|display_amount}} {{#vardefine:return_type|int}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:name}…'
 
imported>Bale
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#vardefine:name|display_amount}}
{{
{{#vardefine:return_type|int}}
#vardefine:name|display_amount}}{{
#vardefine:return_type|int}}{{


{{FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Item Management|


function1={{Function|
function1={{Function|
Line 17: Line 17:
function_description=Returns the amount of a given item that is contained in your display case.|
function_description=Returns the amount of a given item that is contained in your display case.|


see_also={{SeeAlso|item_amount}}|
code1={{CodeSample|
title=Code Sample|
description=Reports on the amount of all Disco Bandit drinks in your display case.|
code=
<syntaxhighlight>
void report_drink(item drink) {
if(display_amount(drink) > 0)
print("In your DC are "+ display_amount(drink) +" "+ drink.to_plural());
}
 
foreach drink in get_related($item[tangarita], "zap")
report_drink(drink);
foreach drink in get_related($item[fuzzbump], "zap")
report_drink(drink);
</syntaxhighlight>
}}|
 
see_also={{SeeAlso|closet_amount|equipped_amount|item_amount|shop_amount|stash_amount|storage_amount}}|
}}
}}
[[Category:Item Management]]

Latest revision as of 21:46, 21 May 2010

Function Syntax

int display_amount(item it )

  • it is the item to check

Returns the amount of a given item that is contained in your display case.

Code Sample

Reports on the amount of all Disco Bandit drinks in your display case.

void report_drink(item drink) {
	if(display_amount(drink) > 0)
		print("In your DC are "+ display_amount(drink) +" "+ drink.to_plural());
}

foreach drink in get_related($item[tangarita], "zap")
	report_drink(drink);
foreach drink in get_related($item[fuzzbump], "zap")
	report_drink(drink);

See Also

closet_amount() | equipped_amount() | item_amount() | shop_amount() | stash_amount() | storage_amount()