The script commands in this section pertain to resource management.
Buy
Usage: |
buy resource quantity price |
Example: |
buy food 10000 6 |
Buys resources from the market. In the example above the script will try to buy 10,000 food at a bid price of 6.
Resource name must be among food, lumber, stone & iron, and must be spelled out.
It is important to remember that conflicting Trade goals with TradePolicy may sell the resources as fast as you can buy them via script.
CancelTrade
Usage: |
canceltrade |
Example: |
canceltrade |
Cancels all pending trades in current city.
You can also cancel trades by their tradeId:
Usage: |
canceltrade tradeId |
Example: |
execute "canceltrade " + city.tradesArray[0].id |
This example will cancel the 1st trade in the city's current tradesArray (the oldest trade in the array will be at position 0)
DumpResource
Usage: |
dumpresource xxx,yyy condition resource |
Example: |
dumpresource 111,222 f:11000,g:44000 f:3000,g:9000 |
This is used to transport an amount of resources over a specified threshold to another city. In the example above, when food reaches 11,000 and gold reaches 44,000, it will tranport 3,000 food and 9,000 gold to the city at 111,222
Sell
Usage: |
sell resource quantity price |
Example: |
sell food 20000 8 |
Sells resources on the market. In the example above the script will try to sell 20,000 food at the offer price of 8.
Resource name must be among food, lumber, stone & iron, and must be spelled out.
It is important to remember that conflicting Trade goals with TradePolicy may buy the resources back as fast as you can sell them via script.