1188
Comment:
|
6460
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
How to use a reference 101 | == Get your references right == |
Line 3: | Line 3: |
<<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>> === How to use a reference === <<BR>> |
|
Line 6: | Line 13: |
<<BR>> <<BR>> | |
Line 10: | Line 17: |
Line 11: | Line 19: |
<<BR>> <<BR>> <<BR>> | |
Line 15: | Line 22: |
print 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 |
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>> |
Line 21: | Line 28: |
<<BR>> <<BR>> | |
Line 24: | Line 31: |
<<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 |
|
Line 25: | Line 61: |
e.g. | <<BR>> <<BR>> <<BR>> === What is Array? === <<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>> |
Line 27: | Line 72: |
ifgoto ( m_context.sellPrice(0) < 5 ) buyfood | === Market references === <<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) ) |
Line 29: | Line 78: |
That will tell the bot to find a label named buyfood if the price of food is less than 5 Next step is tieing 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 |
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>> === War references === <<BR>> ==== Incoming enemies ==== <<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>> ---- CategoryHowTo |
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. You will find most of the commonly used references but for the total list use Dismayed's list.
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 print.
If you try to grab a reference that does not exist it will give a 1069 error.
An example is trying to print the heroname from marching army number 6 when you have only got 5 armies marching.
e.g
print 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
print 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 tieing 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?
Basicall it is the number in the list. You can refer to the number in the list by changing the array number
e.g. 1: print ( 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.
print sellPrice food ( m_context.sellPrice(0) )
print 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 differenciate between the different 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.
print x –sellPrice food m_city.cityManager.sellPrice(food)
You can check for the amount being traded with the following line
print ( m_city.cityManager.tradesArray[0].amount )
What is being traded? To see the resource name being traded use this
print ( m_city.cityManager.tradesArray[0].resourceName )
The following will return the resnumber being traded.
print ( m_city.cityManager.tradesArray[0].resType )
Is it buying or selling?
print ( m_city.cityManager.tradesArray[0].tradeTypeName )
print ( m_city.cityManager.tradesArray[0].tradeType )
1 means selling 0 means buying
What price is being used in the trade?
print ( m_city.cityManager.tradesArray[0].price )
Curious about what evony calls your trade?
print ( m_city.cityManager.tradesArray[0].id )
How much has it moved so far?
print ( m_city.cityManager.tradesArray[0].dealedAmount )
print ( m_city.cityManager.tradesArray[0].dealedTotal )
War references
Incoming enemies
Do we have incoming armies?
print m_city.cityManager.hasEnemyArmies
This line returns either True or False.
print m_city.cityManager.hasEnemyArmiesWithin(60)
This one lets you check if they are closer than 60 seconds
How many attacks are coming?
print m_city.cityManager.NumberOfRealAttacks
What is the attackers lordname, cityname and alliance?
print m_city.cityManager.enemyArmies[0].king
print m_city.cityManager.enemyArmies[0].startPosName
print m_city.cityManager.enemyArmies[0].alliance
Check if enemy is carrying resources
print m_city.cityManager.enemyArmies[0].resource.food
print m_city.cityManager.enemyArmies[0].resource.wood
print m_city.cityManager.enemyArmies[0].resource.stone
print m_city.cityManager.enemyArmies[0].resource.iron
Check what troops enemy is sending
print m_city.cityManager.enemyArmies[0].troop.peasants
print m_city.cityManager.enemyArmies[0].troop.militia
print m_city.cityManager.enemyArmies[0].troop.scouter
print m_city.cityManager.enemyArmies[0].troop.pikemen
print m_city.cityManager.enemyArmies[0].troop.swordsmen
print m_city.cityManager.enemyArmies[0].troop.archer
print m_city.cityManager.enemyArmies[0].troop.lightCavalry
print m_city.cityManager.enemyArmies[0].troop.heavyCavalry
print m_city.cityManager.enemyArmies[0].troop.carriage
print m_city.cityManager.enemyArmies[0].troop.ballista
print m_city.cityManager.enemyArmies[0].troop.batteringRam
print m_city.cityManager.enemyArmies[0].troop.catapult
What hero is the enemy sending lvl, name?
print m_city.cityManager.enemyArmies[0].heroLevel
print m_city.cityManager.enemyArmies[0].hero