BUY <item> <qty> <price> [have-left] time: 0 days priority: 1

Buy quantity of the given item for no more than price each.

If quantity is zero, any pending buy order for the indicated item will be canceled.

Only one pending buy order may be active for each item at a time. If two buy orders are issued for the same item, and the first has not yet completed, the second buy order will replace the first.

Buys and sells are only matched in cities, where markets may be found to execute trades. However, buy and sell may be issued anywhere.

If the a match is found with a seller, the trade will be executed immediately. Otherwise, the trade will be saved until a match with a seller may be found.

Example:

> buy 79 3 5
Try to buy three iron [79] for 5 gold each.

If there is a seller of iron in the city, selling for 5 gold or less, the trade will be executed:

1: Bought three iron [79] for 15 gold.

Otherwise, the buy will be placed on the character's pending trades list:

Pending trades:

trade    price    qty   item
-----    -----    ---   ----
buy        5      3   iron [79]

At the end of the turn, the buy order will appear in the city's market report:

Market report:

trade    who    price    qty   item
-----    ---    -----    ---   ----
  buy   2019        5      3   iron [79]

A trade will match between a buyer and a seller if the buyer's price is greater than or equal to the seller's price. The actual price that the trade will be made at is the seller's price.

Have-left is an amount of gold that the character will not spend on this trade. For instance, if the unit issued buy 79 2 10 5, this would mean `Buy two iron [79] for 10 gold each, but not if I'll have less than 5 gold left over.' If the character had 15 gold, only one of the iron would be bought.