Difference between pages "Hermit" and "Use"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Eliteofdelete
 
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…')
 
Line 1: Line 1:
{{
+
{{#vardefine:name|use}}
#vardefine:name|hermit}}{{
+
{{#vardefine:return_type|boolean}}
#vardefine:return_type|boolean}}{{
 
  
FunctionPage|
+
{{FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
 +
function_category=Item Management|
  
 
function1={{Function|
 
function1={{Function|
Line 12: Line 12:
 
return_also={{#var:return_also}}|
 
return_also={{#var:return_also}}|
 
parameter1={{Param|int|qty}}|
 
parameter1={{Param|int|qty}}|
parameter2={{Param|item|get}}|
+
parameter2={{Param|item|it}}|
p1desc={{pspan|qty}} is the quantity to acquire|
+
p1desc={{pspan|qty}} is the quantity to use|
p2desc={{pspan|get}} is the hermit item to trade for|
+
p2desc={{pspan|it}} is the item to use|
 
}}|
 
}}|
  
function_description=Attempts to acquire {{pspan|qty}} amount of item {{pspan|get}}. Will buy and use chewing gum on a string as needed. Reports success based on whether it acquired as many of item {{pspan|get}} as possible. If {{pspan|get}} is not a hermit item, this function will return true. This function will fail to return any value and abort completely if unable to buy the required chewing gum on a string.</p>
+
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.|
<p>If the hermit does not have enough ten-leaf clovers in stock to satisfy a request, it will acquire as many as possible and then return false.|
 
  
code1={{CodeSample|
+
needscode=yes|
title=Code Samples|
 
description=The example acquires all the hermits clovers and reports how many it got.|
 
code=
 
<syntaxhighlight>
 
int amount = item_amount($item[disassembled clover]) + item_amount($item[ten-leaf clover]);
 
hermit(999, $item[ten-leaf clover]);
 
amount = item_amount($item[disassembled clover]) + item_amount($item[ten-leaf clover]) - amount;
 
print("You acquired "+amount+" clovers.", "blue");
 
  
</syntaxhighlight>|
+
see_also={{SeeAlso|drink|eat|equip}}|
 
+
cli_equiv=The CLI command "use" functions similarly.|
}}|
 
 
 
cli_equiv=The CLI command "hermit" with the parameter "item" works similarly.|
 
 
}}
 
}}
 
[[Category:Item Management]][[Category:Adventuring]]
 

Revision as of 14:32, 5 March 2010



needs(code_samples);

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(); 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.

CLI Equivalent

The CLI command "use" functions similarly.

See Also

drink() | eat() | equip()