Use: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle Created page with '{{#vardefine:name|use}} {{#vardefine:return_type|boolean}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:name}}| aggr…' |
imported>Eliteofdelete Added Chew reference |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{#vardefine:name|use}} | {{ | ||
{{#vardefine:return_type|boolean}} | #vardefine:name|use}}{{ | ||
#vardefine:return_type|boolean}}{{ | |||
FunctionPage| | |||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 17: | Line 17: | ||
}}| | }}| | ||
function_description=Attempts to use {{pspan|qty}} amount of item {{pspan|it}}. Returns true if the item is used or false if it fails to do so. Note that food must be "used" via eat() & drinks via drink(); attempting to use this function will result in an error message and a return value of false. Using this function for equipment will function the same as equip() would without the optional slot parameter. If this function is called with a non-usable item, a message saying so will print to the CLI and the function will return true.| | function_description=Attempts to use {{pspan|qty}} amount of item {{pspan|it}}. Returns true if the item is used or false if it fails to do so. Note that food must be "used" via eat() & drinks via drink() & spleen via chew(); attempting to use this function will result in an error message and a return value of false. Using this function for equipment will function the same as equip() would without the optional slot parameter. If this function is called with a non-usable item, a message saying so will print to the CLI and the function will return true.| | ||
code1={{CodeSample| | |||
title=Code Samples| | |||
description=The following example uses the festive warbear bank if you have one.| | |||
code= | |||
<syntaxhighlight> | |||
if (item_amount($item[festive warbear bank]) > 0) | |||
use(1, $item[festive warbear bank]); | |||
else print("You do not have a festive warbear bank.", "red"); | |||
</syntaxhighlight>| | |||
see_also={{SeeAlso|drink|eat|equip}}| | }}| | ||
see_also={{SeeAlso|drink|eat|equip|chew}}| | |||
cli_equiv=The CLI command "use" functions similarly.| | cli_equiv=The CLI command "use" functions similarly.| | ||
more_info=If {{pspan|qty}} is 0 or negative, no item will be used and the function will return true.| | |||
}} | }} | ||
[[Category:Item Management]] |
Latest revision as of 07:26, 17 November 2015
Function Syntax
boolean use(int qty ,item it )
- qty is the quantity to use
- it is the item to use
Attempts to use qty amount of item it. Returns true if the item is used or false if it fails to do so. Note that food must be "used" via eat() & drinks via drink() & spleen via chew(); attempting to use this function will result in an error message and a return value of false. Using this function for equipment will function the same as equip() would without the optional slot parameter. If this function is called with a non-usable item, a message saying so will print to the CLI and the function will return true.
Code Samples
The following example uses the festive warbear bank if you have one.
if (item_amount($item[festive warbear bank]) > 0)
use(1, $item[festive warbear bank]);
else print("You do not have a festive warbear bank.", "red");
CLI Equivalent
The CLI command "use" functions similarly.
See Also
More Information
If qty is 0 or negative, no item will be used and the function will return true.