Get your references right



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 References.

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.

How to use a reference


All references are based on the following format:

reference {operator} value

Every valid reference will return a value in the log tab if preceeded by echo.

If you try to grab a reference that does not exist it will give a 1069 error.

An example is trying to echo the heroname from marching army number 6 when you have only got 5 armies marching.


e.g.:

echo m_context.sellPrice(0) will show you the current price of food
To make it easier on the eyes you can add a comment on what it is in front

e.g.:

echo "food is now sold for " + m_context.sellPrice(0)

To use this reference in a script you need a comparable, an ifgoto or an ifgosub command and a label to go to.

e.g.:
ifgoto (m_context.sellPrice(0) < 5) buyfood
That will tell the bot to find a label named buyfood if the price of food is less than 5.
Next step is tying the two parts together:

1: label checkfoodprice
2: ifgoto ( m_context.sellPrice(0) < 5 ) buyfood
3: loop

4: label buyfood
5: buy food 9999999 5
6: goto checkfoodprice

A simple script like that will keep checking the price of food and post a bid every time it drops below 5.
Make sure to get your spelling right. Scripts are case sensitive. If the reference is fieldId, fieldid or FieldId won't work.
The same applies for correct spacing. Miss a space and your reference won't work.

Correct way -> ifgoto ( m_context.sellPrice(0) < 5 ) buyfood
Wrong way -> ifgoto ( m_context.sellPrice(0) < 5) buyfood
Wrong way -> ifgoto ( m_context.sellPrice(0) < 5 ) buyfood
Wrong way -> ifgoto ( m_context.sellPrice (0)< 5) buyfood
Wrong way -> ifgoto (m_context.sellPrice(0) <5 ) buyfood
Wrong way -> ifgoto (m_context.sellPrice (0)<5) buyfood

Taking the time to write references properly the first time around can save you hours and days of debugging later.




What is Array?



Basically it is the number in the list. You can refer to the number in the list by changing the array number:

e.g. 1: echo m_city.cityManager.tradesArray[0].resType
where 0 is the first in the list and 9 is the last in the market window.


Market references




If you just want to check the prices for the various resources use the following lines.
echo "sellPrice food " + m_context.sellPrice(0)

echo "buyPrice food " + m_context.buyPrice(0)
The first line will check the current sell price on food posted in the market and the second will check the highest posted bid.

To differentiate between resources you can replace 0 with 1, 2, or 3 for wood, stone, and iron respectively.
You can also type the res name out as shown below.
echo "–sellPrice food " + m_city.cityManager.sellPrice(food)

You can check for the amount being traded with the following line:
echo m_city.cityManager.tradesArray[0].amount

What is being traded? To see the resource name being traded use this:
echo m_city.cityManager.tradesArray[0].resourceName
The following will return the resnumber being traded.
echo m_city.cityManager.tradesArray[0].resType

Is it buying or selling?
echo m_city.cityManager.tradesArray[0].tradeTypeName
echo m_city.cityManager.tradesArray[0].tradeType
1 means selling, 0 means buying

What price is being used in the trade?
echo m_city.cityManager.tradesArray[0].price

Curious about what evony calls your trade?
echo m_city.cityManager.tradesArray[0].id

How much has it moved so far?
echo m_city.cityManager.tradesArray[0].dealedAmount
echo m_city.cityManager.tradesArray[0].dealedTotal

War references


Incoming enemies


Do we have incoming armies?
echo m_city.cityManager.hasEnemyArmies
This line returns either True or False.
echo m_city.cityManager.hasEnemyArmiesWithin(60)
This one lets you check if they are closer than 60 seconds.

How many attacks are coming?
echo m_city.cityManager.NumberOfRealAttacks

What is the attackers lordname, cityname and alliance?
echo m_city.cityManager.enemyArmies[0].king
echo m_city.cityManager.enemyArmies[0].startPosName
echo m_city.cityManager.enemyArmies[0].alliance

Check if enemy is carrying resources:
echo m_city.cityManager.enemyArmies[0].resource.food
echo m_city.cityManager.enemyArmies[0].resource.wood
echo m_city.cityManager.enemyArmies[0].resource.stone
echo m_city.cityManager.enemyArmies[0].resource.iron

Check what troops enemy is sending:
echo m_city.cityManager.enemyArmies[0].troop.peasants
echo m_city.cityManager.enemyArmies[0].troop.militia
echo m_city.cityManager.enemyArmies[0].troop.scouter
echo m_city.cityManager.enemyArmies[0].troop.pikemen
echo m_city.cityManager.enemyArmies[0].troop.swordsmen
echo m_city.cityManager.enemyArmies[0].troop.archer
echo m_city.cityManager.enemyArmies[0].troop.lightCavalry
echo m_city.cityManager.enemyArmies[0].troop.heavyCavalry
echo m_city.cityManager.enemyArmies[0].troop.carriage
echo m_city.cityManager.enemyArmies[0].troop.ballista
echo m_city.cityManager.enemyArmies[0].troop.batteringRam
echo m_city.cityManager.enemyArmies[0].troop.catapult

What hero is the enemy sending (lvl, name)?
echo m_city.cityManager.enemyArmies[0].heroLevel
echo m_city.cityManager.enemyArmies[0].hero


CategoryHowTo

References-Kento11 (last edited 2013-08-07 18:16:13 by Inanna)