<?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>HeroFunctions</title><revhistory><revision><revnumber>3</revnumber><date>2015-02-24 10:17:58</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>2</revnumber><date>2015-02-08 15:58:56</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>1</revnumber><date>2015-02-08 07:34:41</date><authorinitials>LKD70</authorinitials></revision></revhistory></articleinfo><para>See also: <ulink url="http://guide.neatportal.com/wiki/HeroFunctions/wiki/Heroes#">Heroes</ulink></para><section><title>IsHeroInCastle</title><informaltable><tgroup cols="2"><colspec colname="col_0"/><colspec colname="col_1"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para>Usage: </para></entry><entry colsep="1" rowsep="1"><para>m_city.IsHeroInCastle(&quot;HeroName&quot;) </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>Example: </para></entry><entry colsep="1" rowsep="1"><para>m_city.IsHeroInCastle(&quot;LKD70&quot;) </para></entry></row></tbody></tgroup></informaltable><para>If the hero named &quot;LKD70&quot; is in the castle this will return true. A <ulink url="http://guide.neatportal.com/wiki/HeroFunctions/wiki/HeroString#">HeroString</ulink> can also be used instead of the hero name.  </para></section><section><title>TrainingHeroIsHere</title><informaltable><tgroup cols="2"><colspec colname="col_0"/><colspec colname="col_1"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para>Usage: </para></entry><entry colsep="1" rowsep="1"><para>m_city.cityManager.TrainingHeroIsHere </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>Example: </para></entry><entry colsep="1" rowsep="1"><para>echo m_city.cityManager.TrainingHeroIsHere</para></entry></row></tbody></tgroup></informaltable><para>If the specified TrainingHero is in the castle this will return true. </para></section><section><title>AnyIdleHero</title><informaltable><tgroup cols="2"><colspec colname="col_0"/><colspec colname="col_1"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para>Usage: </para></entry><entry colsep="1" rowsep="1"><para>m_city.AnyIdleHero(<ulink url="http://guide.neatportal.com/wiki/HeroFunctions/wiki/HeroString#">HeroString</ulink>) </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>Example: </para></entry><entry colsep="1" rowsep="1"><para>echo m_city.AnyIdleHero(&quot;any:attack&gt;1000&quot;)</para></entry></row></tbody></tgroup></informaltable><para>returns true if specified hero string matches any idle hero in the castle. </para><screen><![CDATA[targetValley = ("123,456")
]]><![CDATA[
if m_city.AnyIdleHero("any:att>100,att<300") if city.troops.archer>100k execute "attack "+targetValley+" any:att>100,att<300 a:25k,p:1,sw:1,c:1,cata:1,s:1"]]></screen><para>if there is a hero matching the criteria available, and city has more than 100k arch, send it marching on the valley.... </para><para>assumes you have the layers constantly being replaced, it could hang waiting for missing layer... so if you use scouts to transport res, leave them out of the march. </para><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="http://guide.neatportal.com/wiki/HeroFunctions/wiki/CategoryFunctions#">CategoryFunctions</ulink> </para></section></article>