Retrieve item: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
imported>StDoodle
No edit summary
Line 1: Line 1:
{{function|
{{#vardefine:name|retrieve_item}}
name=retrieve_item|
{{#vardefine:return_type|boolean}}
returns=boolean|
description=uses KoLmafia internal logic to gather the items in the least destructive manner. ''See the “acquire” documentation in the CLI manual for more details.''|
p1=quantity|
p1t=int|
p1d=The quantity of the item you wish to retrieve|
p2=itemname|
p2t=item|
p2d=The name of the item.|
examplecode=# function to get your class-specific Epic Weapon hermit item
boolean get_epic_item()
{


  item[class] epic_items;
{{FunctionPage|
  epic_items[$class[seal clubber]] = $item[seal tooth];
name={{#var:name}}|
  epic_items[$class[turtle tamer]] = $item[chisel];
function_category=Item Management|
  epic_items[$class[pastamancer]] = $item[petrified noodles];
second_category=Adventuring|
  epic_items[$class[sauceror]] = $item[jabañero pepper];
  epic_items[$class[disco bandit]] = $item[banjo strings];
  epic_items[$class[accordion thief]] = $item[hot buttered roll];


  return retrieve_item(1, epic_items[my_class()]);
function1={{Function|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
parameter1={{Param|int|qty}}|
parameter2={{Param|item|get}}|
p1desc={{Pspan|qty}} is the quantity to acquire|
p2desc={{Pspan|get}} is the item to acquire|
}}|


}|
function_description=Uses KoLmafia's internal logic to gather the items in the least destructive manner. Returns true if items are acquired as specified and false if not.|
 
needscode=yes|
 
see_also={{SeeAlso|buy}}|
cli_equiv=The CLI command "acquire" works similarly.|
special=Unlike a few other ASH commands, retrieve_item() will still return false on attempts to acquire items that are not possible to get (such as a sparkly engagement ring).
}}
}}
{{RFI|What's the order-of-operations (create, NPC, mall)?|Are there exceptions to the info listed under Special?}}

Revision as of 15:10, 5 March 2010



needs(code_samples);

Function Syntax

boolean retrieve_item(int qty ,item get )

  • qty is the quantity to acquire
  • get is the item to acquire

Uses KoLmafia's internal logic to gather the items in the least destructive manner. Returns true if items are acquired as specified and false if not.

CLI Equivalent

The CLI command "acquire" works similarly.

See Also

buy()

Special

Unlike a few other ASH commands, retrieve_item() will still return false on attempts to acquire items that are not possible to get (such as a sparkly engagement ring).


Attention KoLmafia Experts!

We need your help; some details of this function's operation are unknown or unclear.

The following specific questions have been raised:

  • What's the order-of-operations (create, NPC, mall)?
  • Are there exceptions to the info listed under Special?