6460
Comment:
|
← Revision 9 as of 2013-08-07 18:16:13 ⇥
6357
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
<<TableOfContents>> <<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's list at [[References]]. <<BR>> | |
Line 3: | Line 4: |
<<TableOfContents>> <<BR>> <<BR>> This is not going to be a complete list of available references in NEAT. Look at it as a getting started guide. You will find most of the commonly used references but for the total list use Dismayed's list. <<BR>> <<BR>> |
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>> |
Line 9: | Line 7: |
<<BR>> All references are based on the following format |
<<BR>> All references are based on the following format: |
Line 12: | Line 9: |
( reference {operator} value ) <<BR>> <<BR>> every valid reference will return a value in the log tab if preceeded by print. |
reference {operator} value <<BR>> <<BR>> Every valid reference will return a value in the log tab if preceeded by echo. |
Line 16: | Line 11: |
If you try to grab a reference that does not exist it will give a 1069 error. | If you try to grab a reference that does not exist it will give a 1069 error. |
Line 18: | Line 13: |
An example is trying to print the heroname from marching army number 6 when you have only got 5 armies marching. <<BR>> <<BR>> <<BR>> e.g |
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.: |
Line 22: | Line 15: |
print 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>> |
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>> |
Line 25: | Line 17: |
e.g | e.g.: |
Line 27: | Line 19: |
print food is now sold for ( m_context.sellPrice(0) ) <<BR>> <<BR>> |
echo "food is now sold for " + m_context.sellPrice(0) <<BR>> <<BR>> |
Line 30: | Line 21: |
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) < 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 tieing the two parts together <<BR>> <<BR>> 1: label checkfoodprice<<BR>> 2: ifgoto ( m_context.sellPrice(0) < 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 FieldId won't work.<<BR>> The same applies for correct spacing. Miss a space and your reference won't work. <<BR>><<BR>> Correct way -> ifgoto ( m_context.sellPrice(0) < 5 ) buyfood<<BR>> Wrong way -> ifgoto ( m_context.sellPrice(0) < 5) buyfood<<BR>> Wrong way -> ifgoto ( m_context.sellPrice(0) < 5 ) buyfood<<BR>> Wrong way -> ifgoto ( m_context.sellPrice (0)< 5) buyfood<<BR>> Wrong way -> ifgoto (m_context.sellPrice(0) <5 ) buyfood<<BR>> Wrong way -> ifgoto (m_context.sellPrice (0)<5) buyfood<<BR>> <<BR>> Taking the time to write references properly the first time around can save you hours and days of debugging later |
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) < 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) < 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 FieldId won't work.<<BR>> The same applies for correct spacing. Miss a space and your reference won't work. <<BR>><<BR>> Correct way -> ifgoto ( m_context.sellPrice(0) < 5 ) buyfood<<BR>> Wrong way -> ifgoto ( m_context.sellPrice(0) < 5) buyfood<<BR>> Wrong way -> ifgoto ( m_context.sellPrice(0) < 5 ) buyfood<<BR>> Wrong way -> ifgoto ( m_context.sellPrice (0)< 5) buyfood<<BR>> Wrong way -> ifgoto (m_context.sellPrice(0) <5 ) buyfood<<BR>> Wrong way -> ifgoto (m_context.sellPrice (0)<5) buyfood<<BR>> <<BR>> Taking the time to write references properly the first time around can save you hours and days of debugging later. |
Line 61: | Line 23: |
<<BR>> <<BR>> <<BR>> | <<BR>> <<BR>> <<BR>> |
Line 63: | Line 26: |
<<BR>> <<BR>> Basicall 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: print ( 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>> |
<<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>> |
Line 73: | Line 29: |
<<BR>> <<BR>> <<BR>> If you just want to check the prices for the various resources use the following lines. <<BR>> print sellPrice food ( m_context.sellPrice(0) ) |
<<BR>> <<BR>> <<BR>> If you just want to check the prices for the various resources use the following lines. <<BR>> echo "sellPrice food " + m_context.sellPrice(0) |
Line 78: | Line 31: |
print buyPrice food ( 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 differenciate between the different 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>> print x –sellPrice food m_city.cityManager.sellPrice(food) <<BR>> <<BR>> You can check for the amount being traded with the following line <<BR>> print ( m_city.cityManager.tradesArray[0].amount ) <<BR>> <<BR>> What is being traded? To see the resource name being traded use this <<BR>> print ( m_city.cityManager.tradesArray[0].resourceName ) <<BR>> The following will return the resnumber being traded. <<BR>> print ( m_city.cityManager.tradesArray[0].resType ) <<BR>> <<BR>> Is it buying or selling? <<BR>> print ( m_city.cityManager.tradesArray[0].tradeTypeName ) <<BR>> print ( m_city.cityManager.tradesArray[0].tradeType ) <<BR>> 1 means selling 0 means buying <<BR>> <<BR>> What price is being used in the trade? <<BR>> print ( m_city.cityManager.tradesArray[0].price ) <<BR>> <<BR>> Curious about what evony calls your trade?<<BR>> print ( m_city.cityManager.tradesArray[0].id ) <<BR>> <<BR>> How much has it moved so far? <<BR>> print ( m_city.cityManager.tradesArray[0].dealedAmount ) <<BR>> print ( m_city.cityManager.tradesArray[0].dealedTotal ) <<BR>> <<BR>> |
echo "buyPrice food " + 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 "–sellPrice food " + 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>> |
Line 123: | Line 35: |
Line 124: | Line 37: |
<<BR>> Do we have incoming armies?<<BR>> print m_city.cityManager.hasEnemyArmies<<BR>> This line returns either True or False. <<BR>> print 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>> print m_city.cityManager.NumberOfRealAttacks<<BR>> <<BR>> What is the attackers lordname, cityname and alliance?<<BR>> print m_city.cityManager.enemyArmies[0].king<<BR>> print m_city.cityManager.enemyArmies[0].startPosName<<BR>> print m_city.cityManager.enemyArmies[0].alliance<<BR>> <<BR>> Check if enemy is carrying resources<<BR>> print m_city.cityManager.enemyArmies[0].resource.food<<BR>> print m_city.cityManager.enemyArmies[0].resource.wood<<BR>> print m_city.cityManager.enemyArmies[0].resource.stone<<BR>> print m_city.cityManager.enemyArmies[0].resource.iron<<BR>> <<BR>> Check what troops enemy is sending<<BR>> print m_city.cityManager.enemyArmies[0].troop.peasants<<BR>> print m_city.cityManager.enemyArmies[0].troop.militia<<BR>> print m_city.cityManager.enemyArmies[0].troop.scouter<<BR>> print m_city.cityManager.enemyArmies[0].troop.pikemen<<BR>> print m_city.cityManager.enemyArmies[0].troop.swordsmen<<BR>> print m_city.cityManager.enemyArmies[0].troop.archer<<BR>> print m_city.cityManager.enemyArmies[0].troop.lightCavalry<<BR>> print m_city.cityManager.enemyArmies[0].troop.heavyCavalry<<BR>> print m_city.cityManager.enemyArmies[0].troop.carriage<<BR>> print m_city.cityManager.enemyArmies[0].troop.ballista<<BR>> print m_city.cityManager.enemyArmies[0].troop.batteringRam<<BR>> print m_city.cityManager.enemyArmies[0].troop.catapult<<BR>> <<BR>> What hero is the enemy sending lvl, name?<<BR>> print m_city.cityManager.enemyArmies[0].heroLevel<<BR>> print m_city.cityManager.enemyArmies[0].hero<<BR>> |
<<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.NumberOfRealAttacks<<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>> |
Get your references right
Contents
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