Hermit: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
Created page with '{{#vardefine:name|hermit}} {{#vardefine:return_type|boolean}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| second_category=Adventuring| function1={{Fu…'
 
imported>Eliteofdelete
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{#vardefine:name|hermit}}
{{
{{#vardefine:return_type|boolean}}
#vardefine:name|hermit}}{{
#vardefine:return_type|boolean}}{{


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


function1={{Function|
function1={{Function|
Line 18: Line 17:
}}|
}}|


function_description=Attempts to acquire {{pspan|qty}} amount of item {{pspan|get}}. Will adventure in the sewer, buying 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.|
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>
<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.|


needscode=yes|
code1={{CodeSample|
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>|
 
}}|


cli_equiv=The CLI command "hermit" with the parameter "item" works similarly.|
cli_equiv=The CLI command "hermit" with the parameter "item" works similarly.|
}}
}}
{{RFI|What does this function return if you attempt to grab more clovers than available (true if it gets as many as possible, or false)?|What's the order of operations for chewing gum check vs. able to adventure check?|What does out of adventures return?}}
 
[[Category:Item Management]][[Category:Adventuring]]

Latest revision as of 03:38, 14 January 2015

Function Syntax

boolean hermit(int qty ,item get )

  • qty is the quantity to acquire
  • get is the hermit item to trade for

Attempts to acquire qty amount of item get. Will buy and use chewing gum on a string as needed. Reports success based on whether it acquired as many of item get as possible. If 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.

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.

Code Samples

The example acquires all the hermits clovers and reports how many it got.

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");

CLI Equivalent

The CLI command "hermit" with the parameter "item" works similarly.