Buy: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>StDoodle
mNo edit summary
Line 28: Line 28:
}}|
}}|


function_description=Buys stuff.|
function_description=Attempts to purchase {{pspan|qty}} amount of item {{pspan|it}}. If the optional maximum {{pspan|price}} is specified, it returns the integer amount of items purchased; otherwise it returns true if the purchase succeeded and false if it did not. Without the optional {{pspan|price}} parameter, first preference is given to NPC stores when attempting purchases, after which it will attempt to use the mall.|


code1={{CodeSample|
code1={{CodeSample|

Revision as of 23:33, 2 March 2010



Function Syntax

boolean buy(int qty ,item it )

int buy(int qty ,item it ,int price )

  • qty is the number to purchase
  • it is the item to purchase
  • price is the (optional) maximum price to spend per item

Attempts to purchase qty amount of item it. If the optional maximum price is specified, it returns the integer amount of items purchased; otherwise it returns true if the purchase succeeded and false if it did not. Without the optional price parameter, first preference is given to NPC stores when attempting purchases, after which it will attempt to use the mall.

Code Sample

Buy a broken skull.

buy(1 , $item[broken skull]);

CLI Equivalent

The CLI commands "buy" and "acquire" work similarly.

See Also

use()