<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>References-Kento11</title><revhistory><revision><revnumber>9</revnumber><date>2013-08-07 18:16:13</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>8</revnumber><date>2013-01-02 22:18:18</date><authorinitials>Kento11</authorinitials></revision><revision><revnumber>7</revnumber><date>2012-11-06 02:19:07</date><authorinitials>Susannah</authorinitials></revision><revision><revnumber>6</revnumber><date>2012-11-06 02:15:51</date><authorinitials>Susannah</authorinitials></revision><revision><revnumber>5</revnumber><date>2012-11-06 02:13:29</date><authorinitials>Susannah</authorinitials></revision><revision><revnumber>4</revnumber><date>2012-10-11 00:37:20</date><authorinitials>Kento11</authorinitials></revision><revision><revnumber>3</revnumber><date>2012-10-02 18:59:42</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>2</revnumber><date>2012-10-02 17:28:13</date><authorinitials>Romulus</authorinitials></revision><revision><revnumber>1</revnumber><date>2012-10-01 16:52:23</date><authorinitials>Kento11</authorinitials></revision></revhistory></articleinfo><section><title>Get your references right</title><para>  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's list at <ulink url="http://guide.neatportal.com/wiki/References-Kento11/wiki/References#">References</ulink>. </para><para>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. </para><section><title>How to use a reference</title><para>  All references are based on the following format: </para><para>reference {operator} value </para><para>  Every valid reference will return a value in the log tab if preceeded by echo. </para><para>If you try to grab a reference that does not exist it will give a 1069 error. </para><para>An example is trying to echo the heroname from marching army number 6 when you have only got 5 armies marching. </para><para>  e.g.: </para><para>echo m_context.sellPrice(0) will show you the current price of food</para><para>  To make it easier on the eyes you can add a comment on what it is in front</para><para>e.g.: </para><para>echo &quot;food is now sold for &quot; + m_context.sellPrice(0) </para><para>To use this reference in a script you need a comparable, an ifgoto or an ifgosub command and a label to go to. </para><para>  e.g.: </para><para>  ifgoto (m_context.sellPrice(0) &lt; 5) buyfood </para><para>  That will tell the bot to find a label named buyfood if the price of food is less than 5. </para><para>  Next step is tying the two parts together: </para><para>  1: label checkfoodprice</para><para>  2: ifgoto ( m_context.sellPrice(0) &lt; 5 ) buyfood</para><para>  3: loop </para><para>  4: label buyfood</para><para>  5: buy food 9999999 5</para><para>  6: goto checkfoodprice</para><para>  A simple script like that will keep checking the price of food and post a bid every time it drops below 5. </para><para> Make sure to get your spelling right. Scripts are case sensitive. If the reference is fieldId, fieldid or <ulink url="http://guide.neatportal.com/wiki/References-Kento11/wiki/FieldId#">FieldId</ulink> won't work.</para><para> The same applies for correct spacing. Miss a space and your reference won't work. </para><para> Correct way -&gt;  ifgoto ( m_context.sellPrice(0) &lt; 5 ) buyfood</para><para> Wrong way   -&gt;  ifgoto ( m_context.sellPrice(0) &lt; 5) buyfood</para><para> Wrong way   -&gt;  ifgoto ( m_context.sellPrice(0) &lt; 5 ) buyfood</para><para> Wrong way   -&gt;  ifgoto (  m_context.sellPrice (0)&lt; 5) buyfood</para><para> Wrong way   -&gt;  ifgoto (m_context.sellPrice(0) &lt;5 ) buyfood</para><para> Wrong way   -&gt;  ifgoto (m_context.sellPrice (0)&lt;5) buyfood</para><para> Taking the time to write references properly the first time around can save you hours and days of debugging later. </para></section><section><title>What is Array?</title><para>  Basically it is the number in the list. You can refer to the number in the list by changing the array number: </para><para>  e.g. 1: echo m_city.cityManager.tradesArray[0].resType </para><para>  where 0 is the first in the list and 9 is the last in the market window. </para></section><section><title>Market references</title><para>  If you just want to check the prices for the various resources use the following lines. </para><para>  echo &quot;sellPrice food &quot; + m_context.sellPrice(0) </para><para>echo &quot;buyPrice food &quot; + m_context.buyPrice(0)</para><para> The first line will check the current sell price on food posted in the market and the second will check the highest posted bid. </para><para>   To differentiate between resources you can replace 0 with 1, 2, or 3 for wood, stone, and iron respectively.  </para><para>  You can also type the res name out as shown below.  </para><para>  echo &quot;–sellPrice food &quot; + m_city.cityManager.sellPrice(food) </para><para>  You can check for the amount being traded with the following line: </para><para>  echo m_city.cityManager.tradesArray[0].amount </para><para>  What is being traded? To see the resource name being traded use this: </para><para>  echo m_city.cityManager.tradesArray[0].resourceName</para><para>  The following will return the resnumber being traded.  </para><para>  echo m_city.cityManager.tradesArray[0].resType</para><para>  Is it buying or selling?  </para><para>  echo m_city.cityManager.tradesArray[0].tradeTypeName</para><para>echo m_city.cityManager.tradesArray[0].tradeType</para><para>  1 means selling, 0 means buying </para><para>  What price is being used in the trade? </para><para> echo m_city.cityManager.tradesArray[0].price</para><para>  Curious about what evony calls your trade?</para><para>echo m_city.cityManager.tradesArray[0].id</para><para>  How much has it moved so far? </para><para>echo m_city.cityManager.tradesArray[0].dealedAmount</para><para>echo m_city.cityManager.tradesArray[0].dealedTotal</para></section><section><title>War references</title><section><title>Incoming enemies</title><para> Do we have incoming armies?</para><para>echo m_city.cityManager.hasEnemyArmies</para><para>  This line returns either True or False. </para><para>echo m_city.cityManager.hasEnemyArmiesWithin(60)</para><para> This one lets you check if they are closer than 60 seconds.</para><para> How many attacks are coming?</para><para>echo m_city.cityManager.<ulink url="http://guide.neatportal.com/wiki/References-Kento11/wiki/NumberOfRealAttacks#">NumberOfRealAttacks</ulink></para><para> What is the attackers lordname, cityname and alliance?</para><para>echo m_city.cityManager.enemyArmies[0].king</para><para>echo m_city.cityManager.enemyArmies[0].startPosName</para><para>echo m_city.cityManager.enemyArmies[0].alliance</para><para> Check if enemy is carrying resources:</para><para>echo m_city.cityManager.enemyArmies[0].resource.food</para><para> echo m_city.cityManager.enemyArmies[0].resource.wood</para><para> echo m_city.cityManager.enemyArmies[0].resource.stone</para><para> echo m_city.cityManager.enemyArmies[0].resource.iron</para><para> Check what troops enemy is sending:</para><para> echo m_city.cityManager.enemyArmies[0].troop.peasants</para><para> echo m_city.cityManager.enemyArmies[0].troop.militia</para><para> echo m_city.cityManager.enemyArmies[0].troop.scouter</para><para> echo m_city.cityManager.enemyArmies[0].troop.pikemen</para><para> echo m_city.cityManager.enemyArmies[0].troop.swordsmen</para><para> echo m_city.cityManager.enemyArmies[0].troop.archer</para><para> echo m_city.cityManager.enemyArmies[0].troop.lightCavalry</para><para> echo m_city.cityManager.enemyArmies[0].troop.heavyCavalry</para><para> echo m_city.cityManager.enemyArmies[0].troop.carriage</para><para> echo m_city.cityManager.enemyArmies[0].troop.ballista</para><para> echo m_city.cityManager.enemyArmies[0].troop.batteringRam</para><para> echo m_city.cityManager.enemyArmies[0].troop.catapult</para><para> What hero is the enemy sending (lvl, name)?</para><para> echo m_city.cityManager.enemyArmies[0].heroLevel</para><para> echo m_city.cityManager.enemyArmies[0].hero</para><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="http://guide.neatportal.com/wiki/References-Kento11/wiki/CategoryHowTo#">CategoryHowTo</ulink> </para></section></section></section></article>