Buy: Difference between revisions
Jump to navigation
Jump to search
imported>Bale mNo edit summary |
imported>Bale less than 1 info. |
||
Line 28: | Line 28: | ||
}}| | }}| | ||
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.| | function_description=Attempts to purchase {{pspan|qty}} amount of item {{pspan|it}}. If {{pspan|qty}} is less than 1, the function will return true without purchasing anything. 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 08:21, 12 August 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 qty is less than 1, the function will return true without purchasing anything. 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.