<?xml version="1.0" encoding="utf-8"?>
<s1 title="ScriptResource"><p>The script commands in this section pertain to resource management. </p>
<p>
</p>
<ol><li><jump href="/wiki/Buy?highlight=%28%5CbScriptResource%5Cb%29">Buy</jump></li>
<li><jump href="/wiki/BuyPrice?highlight=%28%5CbScriptResource%5Cb%29">BuyPrice</jump></li>
<li><jump href="/wiki/CancelTrade?highlight=%28%5CbScriptResource%5Cb%29">CancelTrade</jump></li>
<li><jump href="/wiki/DumpResource?highlight=%28%5CbScriptResource%5Cb%29">DumpResource</jump></li>
<li><jump href="/wiki/MarketUpdate?highlight=%28%5CbScriptResource%5Cb%29">MarketUpdate</jump></li>
<li><jump href="/wiki/Sell?highlight=%28%5CbScriptResource%5Cb%29">Sell</jump></li>
<li><jump href="/wiki/SellPrice?highlight=%28%5CbScriptResource%5Cb%29">SellPrice</jump></li>
</ol>

<p> </p>
<p><s2 title="Buy">
<table><strong class="highlight"><![CDATA[]]></strong><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Usage: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>buy resource quantity price </p>
</td></tr><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Example: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>buy food 10000 6 </p>
</td></tr></table><p>Buys resources from the market. In the example above the script will try to buy 10,000 food at a bid price of 6. </p>
<p>Resource name must be among <em>food, lumber, stone &amp; iron,</em> and must be spelled out. </p>
<p>It is important to remember that conflicting <jump href="/wiki/Trade">Trade</jump> goals with <jump href="/wiki/TradePolicy">TradePolicy</jump> may sell the resources as fast as you can buy them via script. </p>
 </s2>
<s2 title="CancelTrade">
<table><strong class="highlight"><![CDATA[]]></strong><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Usage: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>canceltrade </p>
</td></tr><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Example: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>canceltrade </p>
</td></tr></table><p>Cancels all pending trades in current city. </p>
<p>You can also cancel trades by their tradeId: </p>
<table><strong class="highlight"><![CDATA[]]></strong><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Usage: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>canceltrade tradeId </p>
</td></tr><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Example: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>execute &quot;canceltrade &quot; + city.tradesArray[0].id </p>
</td></tr></table><p>This example will cancel the 1st trade in the city&apos;s current tradesArray (the oldest trade in the array will be at position 0) </p>
 </s2>
<s2 title="DumpResource">
<table><strong class="highlight"><![CDATA[]]></strong><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Usage: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>dumpresource xxx,yyy condition resource </p>
</td></tr><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Example: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>dumpresource 111,222 f:11000,g:44000 f:3000,g:9000 </p>
</td></tr></table><p>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 </p>
 </s2>
<s2 title="Sell">
<table><strong class="highlight"><![CDATA[]]></strong><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Usage: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>sell resource quantity price </p>
</td></tr><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Example: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>sell food 20000 8 </p>
</td></tr></table><p>Sells resources on the market. In the example above the script will try to sell 20,000 food at the offer price of 8. </p>
<p>Resource name must be among <em>food, lumber, stone &amp; iron,</em> and must be spelled out. </p>
<p>It is important to remember that conflicting <jump href="/wiki/Trade">Trade</jump> goals with <jump href="/wiki/TradePolicy">TradePolicy</jump> may buy the resources back as fast as you can sell them via script. </p>
 </p>
<p></p>

<br/>------------------------------------------------------------------------------<br/>
<p> <jump href="/wiki/CategoryCommands">CategoryCommands</jump> </p>
</s2></s1>