<?xml version="1.0" encoding="utf-8"?>
<s1 title="References-Kento11"><p></p>
<s2 id="Get your references right" title="Get your references right">
<p><p>Contents</p>
<ol><li>
<link anchor="G">Get your references right</link><ol><li>
<link anchor="H">How to use a reference</link></li>
<li>
<link anchor="W">What is Array?</link></li>
<li>
<link anchor="M">Market references</link></li>
<li>
<link anchor="W-1">War references</link><ol><li>
<link anchor="I">Incoming enemies</link></li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
<p> <br/>
 <br/>
  This is not going to be a complete list of available references in NEAT. Look at it as a getting-started guide. For the total list use Dismayed&apos;s list at <jump href="/wiki/References">References</jump>. <br/>
 </p>
<p>This guide is discontinued. While it  still works there are a lot of new scripting possibilities. A lot of  references can be written differently as well. <br/>
 <br/>
 </p>
<p></p>
<s3 id="How to use a reference" title="How to use a reference">
<p><br/>
  All references are based on the following format: </p>
<p>reference {operator} value <br/>
 <br/>
  Every valid reference will return a value in the log tab if preceeded by echo. </p>
<p>If you try to grab a reference that does not exist it will give a 1069 error. </p>
<p>An example is trying to echo the heroname from marching army number 6 when you have only got 5 armies marching. <br/>
 <br/>
 <br/>
  e.g.: </p>
<p>echo m_context.sellPrice(0) will show you the current price of food<br/>
  To make it easier on the eyes you can add a comment on what it is in front<br/>
 </p>
<p>e.g.: </p>
<p>echo &quot;food is now sold for &quot; + m_context.sellPrice(0) <br/>
 <br/>
 </p>
<p>To use this reference in a script you need a comparable, an ifgoto or an ifgosub command and a label to go to. <br/>
 <br/>
  e.g.: <br/>
  ifgoto (m_context.sellPrice(0) &lt; 5) buyfood <br/>
  That will tell the bot to find a label named buyfood if the price of food is less than 5. <br/>
  Next step is tying the two parts together: <br/>
 <br/>
  1: label checkfoodprice<br/>
  2: ifgoto ( m_context.sellPrice(0) &lt; 5 ) buyfood<br/>
  3: loop <br/>
  <br/>
  4: label buyfood<br/>
  5: buy food 9999999 5<br/>
  6: goto checkfoodprice<br/>
  <br/>
  A simple script like that will keep checking the price of food and post a bid every time it drops below 5. <br/>
 Make sure to get your spelling right. Scripts are case sensitive. If the reference is fieldId, fieldid or <jump href="/wiki/FieldId">FieldId</jump> won&apos;t work.<br/>
 The same applies for correct spacing. Miss a space and your reference won&apos;t work. <br/>
<br/>
 Correct way -&gt;  ifgoto ( m_context.sellPrice(0) &lt; 5 ) buyfood<br/>
 Wrong way   -&gt;  ifgoto ( m_context.sellPrice(0) &lt; 5) buyfood<br/>
 Wrong way   -&gt;  ifgoto ( m_context.sellPrice(0) &lt; 5 ) buyfood<br/>
 Wrong way   -&gt;  ifgoto (  m_context.sellPrice (0)&lt; 5) buyfood<br/>
 Wrong way   -&gt;  ifgoto (m_context.sellPrice(0) &lt;5 ) buyfood<br/>
 Wrong way   -&gt;  ifgoto (m_context.sellPrice (0)&lt;5) buyfood<br/>
 <br/>
 Taking the time to write references properly the first time around can save you hours and days of debugging later. </p>
<p><br/>
 <br/>
 <br/>
 </p>
<p></p>
</s3>
<s3 id="What is Array?" title="What is Array?">
<p><br/>
 <br/>
  Basically it is the number in the list. You can refer to the number in the list by changing the array number: <br/>
 <br/>
  e.g. 1: echo m_city.cityManager.tradesArray[0].resType <br/>
  where 0 is the first in the list and 9 is the last in the market window. <br/>
 <br/>
 <br/>
 </p>
<p></p>
</s3>
<s3 id="Market references" title="Market references">
<p><br/>
 <br/>
 <br/>
  If you just want to check the prices for the various resources use the following lines. <br/>
  echo &quot;sellPrice food &quot; + m_context.sellPrice(0) </p>
<p>echo &quot;buyPrice food &quot; + m_context.buyPrice(0)<br/>
 The first line will check the current sell price on food posted in the market and the second will check the highest posted bid. <br/>
<br/>
   To differentiate between resources you can replace 0 with 1, 2, or 3 for wood, stone, and iron respectively.  <br/>
  You can also type the res name out as shown below.  <br/>
  echo &quot;–sellPrice food &quot; + m_city.cityManager.sellPrice(food) <br/>
 <br/>
  You can check for the amount being traded with the following line: <br/>
  echo m_city.cityManager.tradesArray[0].amount <br/>
 <br/>
  What is being traded? To see the resource name being traded use this: <br/>
  echo m_city.cityManager.tradesArray[0].resourceName<br/>
  The following will return the resnumber being traded.  <br/>
  echo m_city.cityManager.tradesArray[0].resType<br/>
 <br/>
  Is it buying or selling?  <br/>
  echo m_city.cityManager.tradesArray[0].tradeTypeName<br/>
echo m_city.cityManager.tradesArray[0].tradeType<br/>
  1 means selling, 0 means buying <br/>
 <br/>
  What price is being used in the trade? <br/>
 echo m_city.cityManager.tradesArray[0].price<br/>
 <br/>
  Curious about what evony calls your trade?<br/>
echo m_city.cityManager.tradesArray[0].id<br/>
 <br/>
  How much has it moved so far? <br/>
echo m_city.cityManager.tradesArray[0].dealedAmount<br/>
echo m_city.cityManager.tradesArray[0].dealedTotal<br/>
 <br/>
 </p>
<p></p>
</s3>
<s3 id="War references" title="War references">
<p><br/>
 </p>
<p></p>
<s4 id="Incoming enemies" title="Incoming enemies">
<p><br/>
 Do we have incoming armies?<br/>
echo m_city.cityManager.hasEnemyArmies<br/>
  This line returns either True or False. <br/>
echo m_city.cityManager.hasEnemyArmiesWithin(60)<br/>
 This one lets you check if they are closer than 60 seconds.<br/>
 <br/>
 How many attacks are coming?<br/>
echo m_city.cityManager.<jump href="/wiki/NumberOfRealAttacks" class="nonexistent">NumberOfRealAttacks</jump><br/>
 <br/>
 What is the attackers lordname, cityname and alliance?<br/>
echo m_city.cityManager.enemyArmies[0].king<br/>
echo m_city.cityManager.enemyArmies[0].startPosName<br/>
echo m_city.cityManager.enemyArmies[0].alliance<br/>
 <br/>
 Check if enemy is carrying resources:<br/>
echo m_city.cityManager.enemyArmies[0].resource.food<br/>
 echo m_city.cityManager.enemyArmies[0].resource.wood<br/>
 echo m_city.cityManager.enemyArmies[0].resource.stone<br/>
 echo m_city.cityManager.enemyArmies[0].resource.iron<br/>
 <br/>
 Check what troops enemy is sending:<br/>
 echo m_city.cityManager.enemyArmies[0].troop.peasants<br/>
 echo m_city.cityManager.enemyArmies[0].troop.militia<br/>
 echo m_city.cityManager.enemyArmies[0].troop.scouter<br/>
 echo m_city.cityManager.enemyArmies[0].troop.pikemen<br/>
 echo m_city.cityManager.enemyArmies[0].troop.swordsmen<br/>
 echo m_city.cityManager.enemyArmies[0].troop.archer<br/>
 echo m_city.cityManager.enemyArmies[0].troop.lightCavalry<br/>
 echo m_city.cityManager.enemyArmies[0].troop.heavyCavalry<br/>
 echo m_city.cityManager.enemyArmies[0].troop.carriage<br/>
 echo m_city.cityManager.enemyArmies[0].troop.ballista<br/>
 echo m_city.cityManager.enemyArmies[0].troop.batteringRam<br/>
 echo m_city.cityManager.enemyArmies[0].troop.catapult<br/>
 <br/>
 What hero is the enemy sending (lvl, name)?<br/>
 echo m_city.cityManager.enemyArmies[0].heroLevel<br/>
 echo m_city.cityManager.enemyArmies[0].hero<br/>
 </p>
<p></p>

<br/>------------------------------------------------------------------------------<br/>
<p> <jump href="/wiki/CategoryHowTo">CategoryHowTo</jump> </p>
</s4></s3></s2></s1>