Buy
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