<?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>City</title><revhistory><revision><revnumber>28</revnumber><date>2015-09-08 02:07:47</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>27</revnumber><date>2015-09-08 01:52:54</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>26</revnumber><date>2015-09-08 01:51:59</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>25</revnumber><date>2015-04-17 01:41:54</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>24</revnumber><date>2015-04-17 01:02:33</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>23</revnumber><date>2015-04-17 00:46:29</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>22</revnumber><date>2015-04-17 00:42:29</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>21</revnumber><date>2015-04-17 00:40:23</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>20</revnumber><date>2015-03-22 05:34:52</date><authorinitials>tech</authorinitials></revision><revision><revnumber>19</revnumber><date>2015-03-22 05:34:01</date><authorinitials>tech</authorinitials></revision><revision><revnumber>18</revnumber><date>2015-03-22 05:21:20</date><authorinitials>tech</authorinitials></revision><revision><revnumber>17</revnumber><date>2015-03-22 05:20:29</date><authorinitials>tech</authorinitials></revision><revision><revnumber>16</revnumber><date>2015-03-19 07:18:36</date><authorinitials>tech</authorinitials></revision><revision><revnumber>15</revnumber><date>2015-03-19 06:14:06</date><authorinitials>tech</authorinitials></revision><revision><revnumber>14</revnumber><date>2015-03-19 06:13:05</date><authorinitials>tech</authorinitials></revision><revision><revnumber>13</revnumber><date>2015-03-19 06:11:12</date><authorinitials>tech</authorinitials></revision><revision><revnumber>12</revnumber><date>2015-03-19 06:09:40</date><authorinitials>tech</authorinitials></revision><revision><revnumber>11</revnumber><date>2014-12-09 07:01:10</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>10</revnumber><date>2014-12-09 07:00:05</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>9</revnumber><date>2014-10-22 11:33:38</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>8</revnumber><date>2014-10-10 23:46:58</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>7</revnumber><date>2014-10-09 10:05:33</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>6</revnumber><date>2014-09-18 12:07:14</date><authorinitials>tech</authorinitials></revision><revision><revnumber>5</revnumber><date>2014-08-11 19:21:30</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>4</revnumber><date>2014-07-28 22:26:10</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>3</revnumber><date>2014-07-28 22:09:42</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>2</revnumber><date>2014-07-28 18:55:39</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>1</revnumber><date>2014-02-10 19:02:23</date><authorinitials>Inanna</authorinitials></revision></revhistory></articleinfo><para>The City objects can reference details about the city the script is run in. </para><para><emphasis role="strong">City objects can be referenced as:</emphasis> </para><itemizedlist><listitem override="none"><para><emphasis>m_city.cityManager.property <emphasis role="strong">or</emphasis> city.property</emphasis> </para></listitem></itemizedlist><para>The .property at the end is how you will specify which detail you are referencing. Using the table below, you can for example get the name of the city with c<emphasis>ity.name</emphasis>. </para><para><emphasis role="strong">Properties</emphasis> </para><informaltable><tgroup cols="3"><colspec colname="col_0"/><colspec colname="col_1"/><colspec colname="col_2"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para><emphasis role="strong">Property </emphasis> </para></entry><entry colsep="1" rowsep="1"><para><emphasis role="strong">Type</emphasis> </para></entry><entry colsep="1" rowsep="1"><para><emphasis role="strong">Description </emphasis> </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>brokenGates </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if the current cities gates are broken. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>buildCityLocations </para></entry><entry colsep="1" rowsep="1"><para>array </para></entry><entry colsep="1" rowsep="1"><para>Contains the <ulink url="http://guide.neatportal.com/wiki/City/wiki/FieldId#">FieldId</ulink> of each coordinates scheduled for a (real) city to be built. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><ulink url="http://guide.neatportal.com/wiki/City/wiki/Building#">buildings</ulink> </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Contains information about the buildings in your city. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>buffs </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Returns an object of the current cities buffs. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><ulink url="http://guide.neatportal.com/wiki/City/wiki/Castle#">Castle</ulink> </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>checkFeastingHallSpace </para></entry><entry colsep="1" rowsep="1"><para>Boolean </para></entry><entry colsep="1" rowsep="1"><para>Looks to see if you have an open slot in your Feasting Hall. NOTE: Counts one spot in Hall for Training Hero if not in that town. Returns True / False </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>cityHasGoalErrors </para></entry><entry colsep="1" rowsep="1"><para>Boolean </para></entry><entry colsep="1" rowsep="1"><para>Is set to true in case if there was an exception (internal error) during goal processing OR if there are no goals at all (e.g. only comments)... i.e. simple syntax error will not set it to true... </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>cityNameCoords() </para></entry><entry colsep="1" rowsep="1"><para>string </para></entry><entry colsep="1" rowsep="1"><para>Returns the city name and (coords) in the format shown on the city tabs.  </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>coords </para></entry><entry colsep="1" rowsep="1"><para>String </para></entry><entry colsep="1" rowsep="1"><para>Gives the coordinates of the city </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>debugMask </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the (bitmask?) numeric showing which debug options are currently enabled. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>directionChange </para></entry><entry colsep="1" rowsep="1"><para>Boolean </para></entry><entry colsep="1" rowsep="1"><para>Internal bot usage only. Used by medal hunting to set to true every time army is recalled, and then it forces citymanager to do 1 cycle without auto-recalling troops from valleys. Returns: True / False </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>distanceSettings </para></entry><entry colsep="1" rowsep="1"><para>Array </para></entry><entry colsep="1" rowsep="1"><para>Returns all 5 values of <ulink url="http://guide.neatportal.com/wiki/City/wiki/DistancePolicy#">DistancePolicy</ulink> for the city. distanceSettings[0] through distanceSettings[4] will return the value for npc farming, npc building, medal hunting, valley acquisition, and map scanning in order. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>enemyArmies </para></entry><entry colsep="1" rowsep="1"><para>ArrayCollection </para></entry><entry colsep="1" rowsep="1"><para>Contains information about incoming enemy armies. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>estResource </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"><para>(type is EstimateResource) </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><ulink url="http://guide.neatportal.com/wiki/City/wiki/Field#">fields</ulink> </para></entry><entry colsep="1" rowsep="1"><para>ArrayCollection </para></entry><entry colsep="1" rowsep="1"><para>Array of <ulink url="http://guide.neatportal.com/wiki/City/wiki/Field#">Field</ulink> Objects representing fields (valleys and flats) owned by current city. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>fieldId </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>fieldId of current city coords. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>findHeroByName(&quot;heroname&quot;) </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>if the hero is found it will display the heroes object. Else it will return null.</para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><ulink url="http://guide.neatportal.com/wiki/City/wiki/Fortification#">fortification</ulink> </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Contains information about the wall defences in your city. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>fortificationProduceQueue </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>fortificationQueueStatus </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Tells if wall building status has started up or not.  0 = ready 1 = not ready </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>fortificationRequirement </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>friendlyArmies </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Contains information about incoming alliance armies. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>furtherInitNeeded </para></entry><entry colsep="1" rowsep="1"><para>Boolean </para></entry><entry colsep="1" rowsep="1"><para>Tells True / False if town has had the first focus set on a town. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>GateControl </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Shows current status of the city gates. 0 = Auto 1 = Open 2 = Closed </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>getActiveBuilding() </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>If you're building it will return the object of that building, otherwise it will return null. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>getActiveResearch() </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>If you're researching it will return the object of that research, otherwise it will return null. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>getConfig(&quot;&quot;) </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Outputs value of a config goal. Example: echo city.getConfig(&quot;hero&quot;) will echo the status of 'config hero' goal. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>getMaxArmySize() </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Shows the maximum amount of army troops possible. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><ulink url="http://guide.neatportal.com/wiki/City/wiki/GetTechLevel#">GetTechLevel()</ulink> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the current level of the tech provided. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><ulink url="http://guide.neatportal.com/wiki/City/wiki/getTravelTime#">getTravelTime</ulink> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the time in seconds it takes to march from point A to point B using a particular type of troops, taking into account player's relevant tech levels for compass or horseback riding. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>hasEnemyArmies </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if the city has enemy armies, otherwise returns false. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>hasEnemyArmiesWithin() </para></entry><entry colsep="1" rowsep="1"><para>Boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if there are enemy armies incoming within x seconds. Optionally use hasEnemyArmiesWithin(x, true) to return true if there are enemy armies incoming within x seconds, or if the beacon is too low to see the time. Returns false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>hasResourceForArmy() </para></entry><entry colsep="1" rowsep="1"><para>Boolean </para></entry><entry colsep="1" rowsep="1"><para>Shows if you have the resources to build the army specified. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>haunted </para></entry><entry colsep="1" rowsep="1"><para>Boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if the current city has a haunted or Christmas castle item applied. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><ulink url="http://guide.neatportal.com/wiki/City/wiki/Heroes#">Heroes</ulink> </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Contains information about the heroes in your city. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>id </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Gives the number ID of town that is ran in </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>incomingResources(sec) </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Contains information about resources incoming to the city within specified time in seconds </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>innheroes </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Contains information about the heroes in the inn. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>innStatus </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the ready / not ready status for the inn in that town. 0 = ready 1 = not ready </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isDebugging(32768) </para></entry><entry colsep="1" rowsep="1"><para>Boolean </para></entry><entry colsep="1" rowsep="1"><para>Shows if script debugging is On or Off (True or False). </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>mapInitState </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Tells if map screen has loaded yet. 0 - OK 1 - pending 2 - init needed </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>myArmies </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Contains information about your own armies. Same as selfArmies. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>name </para></entry><entry colsep="1" rowsep="1"><para>String </para></entry><entry colsep="1" rowsep="1"><para>Gives the name of the town it's run in. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>NumberOfRealAttacks </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the number of real (non-junk) attacks incoming to the city. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>pendingProductionRates </para></entry><entry colsep="1" rowsep="1"><para>array </para></entry><entry colsep="1" rowsep="1"><para>? </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>PRFactor </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>rallySpotAvailable() </para></entry><entry colsep="1" rowsep="1"><para>Boolean </para></entry><entry colsep="1" rowsep="1"><para>Shows if you have a rally spot free. Optional parameters: (reserveSlotForTH, optional extraSlots). </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>researches </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"><para>(array coll.) </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>reservedResource </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"><para>(type is resource bean) </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><ulink url="http://guide.neatportal.com/wiki/City/wiki/CityResource#">resource</ulink> </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Contains information about the resources in your city. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>resourceFieldType </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the numeric type of valley the city will acquire with valley acquisition, based on resource fields built. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>ResourceProduction </para></entry><entry colsep="1" rowsep="1"><para>string </para></entry><entry colsep="1" rowsep="1"><para>Returns the current % distribution of workers for resource production. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>selfArmies </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>Contains information about your own armies. Same as myArmies. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>timeSlot </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Gives the order of towns that the bot reads from 0-X, where X = The number of towns you have starting at 0 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>tradesArray </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>TrainingHeroIsHere </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>trainingHeroName </para></entry><entry colsep="1" rowsep="1"><para>String </para></entry><entry colsep="1" rowsep="1"><para>Returns the name of the town's listed training hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>transingTradesArray </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>troop </para></entry><entry colsep="1" rowsep="1"><para>object </para></entry><entry colsep="1" rowsep="1"><para>(object type is <ulink url="http://guide.neatportal.com/wiki/City/wiki/troop#">TroopBean</ulink>) </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>troopQueueStatus </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Tells if troop building status has started up or not. 0 = ready 1 = not ready </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>troopStillInProduction </para></entry><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>x </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Outputs the cities x location on the map. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>y </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Outputs the cities y location on the map. </para></entry></row></tbody></tgroup></informaltable><para><emphasis role="strong">Examples</emphasis> </para><itemizedlist><listitem override="none"><screen><![CDATA[//Check the status of my embassy
ifgoto (city.castle.allowAlliance) itsOpen
goto itsClosed
]]><![CDATA[
label itsOpen
echo "My embassy is open"
end
]]><![CDATA[
label itsClosed
echo "My embassy is closed"
end]]></screen></listitem></itemizedlist><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="http://guide.neatportal.com/wiki/City/wiki/ScriptObjects#">ScriptObjects</ulink> </para></article>