(→Heroes) |
m (→Edited City References: color) |
||
(55 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | ''' | + | '''TEMPORARY COPY - NEEDS REFORMATTED STILL'''<br> |
− | + | ||
+ | <font color="red"> | ||
+ | '''All of the following references have been tested.</font> The results, including the script used to access the variables is availible in the [[Reference Test]] section of this wiki'''. | ||
+ | |||
+ | Every effort has been made in an attempt to make them work. An examination of the code, for example, showed that 'taxrate' was non-functional due to being spelt incorrectly in the Evony code. The proper syntax for all variables is demonstated in the test. | ||
+ | |||
+ | Those that returned errors and could not be made to work were deleted from the output. Generally, this means that no reference to them could be found within the code. | ||
+ | |||
==Script References== | ==Script References== | ||
Line 8: | Line 15: | ||
Resources, Troops, Walldefenses, & Miscellaneous City Information can be referenced from within a script. | Resources, Troops, Walldefenses, & Miscellaneous City Information can be referenced from within a script. | ||
− | <br> | + | Note: All references must begin with ‘m_city.’ |
+ | |||
+ | <br> | ||
+ | |||
+ | When used within a script references are gereally compared to a desired limit in order to determine whether or not to perform the action or subroutine indicated. | ||
+ | |||
+ | '''Format:''' ifgoto ( [''reference''] [''operator''] [''value''] ) [''label'']<br> | ||
+ | '''Format:''' ifgosub ( [''reference''] [''operator''] [''value''] ) [''label'']<br> | ||
+ | '''Example:''' ifgosub ( m_city.cityManager.troop.lightCavalry < 20000 ) buildcav | ||
+ | |||
+ | Proper spacing and spelling is essential. | ||
+ | |||
+ | In certain cases the reference returns only a true/false in which case it will compare as either 0 if false or 1 if true. | ||
− | + | Creating a script that is both easy to use and functional can be a tricky task for a seasoned veteran, much more so to a raw beginner. Remember, this is your city and troops you are attempting to control, a slight slip in logic can lead to disaster. To avoid such pitfalls it is reccommended that you check out the [[Tips and Tricks]] section of this wiki. | |
− | + | A test script has been created to test the output of all of the following references. The script and its resulting output can be found at the [[Reference Test]] page.[[Welcome to Scripts]] | |
+ | <br> | ||
+ | |||
+ | <br> | ||
==Material Resources== | ==Material Resources== | ||
Line 46: | Line 68: | ||
Examples : | Examples : | ||
− | <blockquote>//===================================================<br> // Check current amount of Wood, if greater than 10,000 gosub JumpToTraining<br> // Check if enough Iron is Being Produced, if not, gosub buildMoreMines<br> //=================================================== </blockquote><pre> ifgosub ( m_city. | + | <blockquote>//===================================================<br> // Check current amount of Wood, if greater than 10,000 gosub JumpToTraining<br> // Check if enough Iron is Being Produced, if not, gosub buildMoreMines<br> //=================================================== </blockquote><pre> ifgosub ( m_city.cityManager.resource.wood.amount > 10000 ) JumpToTraining |
− | ifgosub ( m_city. | + | ifgosub ( m_city.cityManager.resource.iron.increaseRate < 5000 ) buildMoreMines |
</pre> | </pre> | ||
==Troops== | ==Troops== | ||
Line 97: | Line 119: | ||
Example : | Example : | ||
− | <pre> ifgosub ( m_city. | + | <pre> ifgosub ( m_city.cityManager.troop.archer < 100000 ) buildArchers |
− | ifgosub ( m_city. | + | ifgosub ( m_city.cityManager.troop.heavyCavalry < 100000 ) buildPhracts |
− | ifgosub ( m_city. | + | ifgosub ( m_city.cityManager.troop.catapults < 15000 ) buildPults |
</pre> | </pre> | ||
<br> | <br> | ||
Line 155: | Line 177: | ||
|- | |- | ||
| gold<br> | | gold<br> | ||
− | | m_city. | + | | m_city.cityManager.resource.gold<br> |
| '.amount' is not needed to display total<br> | | '.amount' is not needed to display total<br> | ||
|- | |- | ||
| complaint<br> | | complaint<br> | ||
− | | m_city. | + | | m_city.cityManager.resource.complaint<br> |
| Public Grievances<br> | | Public Grievances<br> | ||
|- | |- | ||
| curPopulation<br> | | curPopulation<br> | ||
− | | m_city. | + | | m_city.cityManager.resource.curPopulation<br> |
| <br> | | <br> | ||
|- | |- | ||
| maxPopulation<br> | | maxPopulation<br> | ||
− | | m_city. | + | | m_city.cityManager.resource.maxPopulation<br> |
| <br> | | <br> | ||
|- | |- | ||
| heroSalary<br> | | heroSalary<br> | ||
− | | m_city. | + | | m_city.cityManager.resource.heroSalary<br> |
| <br> | | <br> | ||
|- | |- | ||
| support<br> | | support<br> | ||
− | | m_city. | + | | m_city.cityManager.resource.support<br> |
| Loyalty<br> | | Loyalty<br> | ||
|- | |- | ||
| taxIncome<br> | | taxIncome<br> | ||
− | | m_city. | + | | m_city.cityManager.resource.taxIncome<br> |
| <br> | | <br> | ||
|- | |- | ||
| hasEnemy<br> | | hasEnemy<br> | ||
− | | m_city. | + | | m_city.cityManager.hasEnemy<br> |
| Not Sure if this one actually works, I've tried it & while under attack still displays false<br> | | Not Sure if this one actually works, I've tried it & while under attack still displays false<br> | ||
|} | |} | ||
Line 191: | Line 213: | ||
<br> | <br> | ||
− | <br> | + | ==Edited City References== |
+ | |||
+ | <font color="brown"> | ||
+ | '''All of the following references '''have''' been tested. The results, including the script used to access the variables is availible in the [[Reference Test]] section of this wiki'''.</font> <font color="orange">Exceptions in orange.</font> | ||
+ | |||
+ | Every effort has been made in an attempt to make them work. An examination of the code, for example, showed that 'taxrate' was non-functional due to being spelt incorrectly in the Evony code. | ||
+ | |||
+ | Those that returned errors and could not be made to work were deleted from the output. | ||
+ | |||
+ | <br> | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! style="text-align: center;" | Reference<br> | ||
+ | ! style="text-align: center;" | Usage<br> | ||
+ | ! style="text-align: center;" | Notes<br> | ||
+ | |- | ||
+ | | m_city.AnyIdleHero(any)<br> | ||
+ | | Checks for an idle hero.<br> | ||
+ | | Either true or false.<br> | ||
+ | |- | ||
+ | | m_city.AnyIdleHero(ATK295)<br> | ||
+ | | Checks if hero ATK295 is idle.<br> | ||
+ | | Either true or false.<br> | ||
+ | |- | ||
+ | | m_city.IsHeroInCastle(HeroName)<br> | ||
+ | | Checks if hero HeroName is based in this castle.<br> | ||
+ | | Either true or false.<br> | ||
+ | |- | ||
+ | | <br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.allowAlliance<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.buildings[#]<br> | ||
+ | | [object BuildingBean]<br> | ||
+ | | Any use?<br> | ||
+ | |- | ||
+ | | m_city.cityManager.buildings[#].endTime<br> | ||
+ | | Construction end time.<br> | ||
+ | | 0 if finnished.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.buildings[#].level<br> | ||
+ | | Building level that is in location #<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.buildings[#].name<br> | ||
+ | | Building type for building #<br> | ||
+ | | e.g. Farm, Cottage (# = 0 - Number of buildings ... 73 max)<br> | ||
+ | |- | ||
+ | | m_city.cityManager.buildings[#].positionId<br> | ||
+ | | Gives the position id of building number #<br> | ||
+ | | e.g. 1015 outside city, 27 inside city (# = 0 - 73)<br> | ||
+ | |- | ||
+ | | m_city.cityManager.buildings[#].startTime<br> | ||
+ | | Construction start time.<br> | ||
+ | | 0 if complete.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.buildings[#].status<br> | ||
+ | | Construction status.<br> | ||
+ | | 0 = no construction, 1 = upgrading<br> | ||
+ | |- | ||
+ | | m_city.cityManager.buildings[#].typeId<br> | ||
+ | | Numeric type of building.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.fields[#].id<br> | ||
+ | | Valley Id of valley No #.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.fields[#].level<br> | ||
+ | | Level of valley No #<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.fields[#].name<br> | ||
+ | | Type of valley No #.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.fields[#].status<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.fields[#].type<br> | ||
+ | | Numeric type of valley.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.fortification.abatis<br> | ||
+ | | Number of abatis<br> | ||
+ | | Does not include those in queue.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.fortification.arrowTower<br> | ||
+ | | Number of archers towers.<br> | ||
+ | | Does not include those in queue.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.fortification.rockfall<br> | ||
+ | | Number of trebuchev.<br> | ||
+ | | Does not include those in queue.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.fortification.rollingLogs<br> | ||
+ | | Number of rolling logs<br> | ||
+ | | Does not include those in queue.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.fortification.trap<br> | ||
+ | | Number of traps.<br> | ||
+ | | Does not include those in queue.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.goOutForBattle<br> | ||
+ | | <font color="orange">'''true''' => gates open, '''false''' => gates closed.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.hasEnemy<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].experience<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].id<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].itemAmount<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].itemId<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].level<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].logoUrl<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].loyalty<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].management<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].managementAdded<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].managementBuffAdded<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].name<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].power<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].powerAdded<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].powerBuffAdded<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].remainPoint<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].staus<br> | ||
+ | | <font color="orange">0 = IDLE, 1 = MAYOR, 2 = DEFENDING, 3 = MARCHING, 4 = CAPTIVE, 5 = RETURNING</font><br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].stratagem<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].stratagemAdded<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].stratagemBuffAdded<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.heros[#].upgradeExp<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.id<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.logUrl<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.name<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.buildPeople<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.complaint<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.curPopulation<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.food.amount<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.food.increaseRate<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.food.max<br> | ||
+ | | Figure at which production stops.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.food.storePercent<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.food.workPeople<br> | ||
+ | | Number of people tied up in food production.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.gold<br> | ||
+ | | The amount of gold on hand.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.gold.amount<br> | ||
+ | | Appending '.amount' to this reference creates an error.<br> | ||
+ | | Proper usage is above.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.gold.increaseRate<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.heroSalary<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.iron.amount<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.iron.increaseRate<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.iron.max<br> | ||
+ | | Figure at which production stops.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.iron.storePercent<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.iron.workPeople<br> | ||
+ | | Number of people tied up in iron production.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.maxPopulation<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.stone.amount<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.stone.increaseRate<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.stone.max<br> | ||
+ | | Figure at which production stops.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.stone.storePercent<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.stone.workPeople<br> | ||
+ | | Number of people tied up in stone production.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.support<br> | ||
+ | | Loyalty of city.<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.taxIncome<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.taxRate<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.troopCostFood<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.wood.amount<br> | ||
+ | | Current amount of wood<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.wood.increaseRate<br> | ||
+ | | Total Resource Rate of Production<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.wood.max<br> | ||
+ | | Figure at which production stops.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.wood.storePercent<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.wood.workPeople<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.resource.workPeople<br> | ||
+ | | <br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.status<br> | ||
+ | | <br> | ||
+ | | Unknown.<br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.archer<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.ballista<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.batteringRam<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.carriage<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.catapult<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.heavyCavalry<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.lightCavalry<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.militia<br> | ||
+ | | Number of warriors that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.peasants<br> | ||
+ | | Number of workers that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.pikemen<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.scouter<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |- | ||
+ | | m_city.cityManager.troop.swordsmen<br> | ||
+ | | Number of this troop type that are in city but not active.<br> | ||
+ | | <br> | ||
+ | |} | ||
+ | |||
+ | ==Market Prices== | ||
+ | |||
+ | Beginning with version 2070, anew reference class,'' m_context,'' has been added. The first members are calls to the current market prices of each commodity.<br> | ||
+ | <br> | ||
+ | To find the current buy/sell price of any resource: | ||
+ | |||
+ | {| border="1" | ||
+ | |- | ||
+ | !style="text-align: center;" |Reference:<br> | ||
+ | !style="text-align: center;" |Usage:<br> | ||
+ | !style="text-align: center;" |Example:<br> | ||
+ | |- | ||
+ | |sellprice()<br> | ||
+ | |m_context.sellprice(x)<br> | ||
+ | |m_context.sellprice(0)<br> | ||
+ | |- | ||
+ | |buyprice<br> | ||
+ | |m_context.buyprice(x)<br> | ||
+ | |m_context.buyprice(2)<br> | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | <br> | ||
+ | The constants for each resource: | ||
+ | |||
+ | {| border="1" | ||
+ | |- | ||
+ | !Commodity<br> | ||
+ | ! x <br> | ||
+ | |- | ||
+ | |Food||0<br> | ||
+ | |- | ||
+ | |Lumber||1<br> | ||
+ | |- | ||
+ | |Stone||2<br> | ||
+ | |- | ||
+ | |Iron||3<br> | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | Example: a completely runnable 5 minute script... | ||
+ | |||
+ | |||
+ | 1: label check_market | ||
+ | 2: ifgoto ( m_city.cityManager.resource.gold < 400000000 ) we_are_broke | ||
+ | 3: ifgoto ( m_context.buyPrice(1) < 32 ) buywood | ||
+ | 4: ifgoto ( m_context.buyPrice(3) < 30 ) buyiron | ||
+ | 5: label we_are_broke | ||
+ | 6: ifgoto ( m_city.cityManager.resource.gold < 50000 ) we_are_really_broke | ||
+ | 7: ifgoto ( m_context.sellPrice(1) > 35 ) sellwood | ||
+ | 8: ifgoto ( m_context.sellPrice(1) > 38 ) selliron | ||
+ | 9: goto check_market | ||
+ | 10: label we_are_really_broke | ||
+ | 11: ifgoto ( m_city.cityManager.resource.lumber.amount < 30000 ) and_we_have_no_wood | ||
+ | 12: sell lumber 1000 20 | ||
+ | 13: repeat 20 | ||
+ | 14: goto we_are_broke | ||
+ | 15: label and_we_have_ne_wood | ||
+ | 16: ifgoto ( m_city.cityManager.resource.iron.amount < 30000 ) uhoh | ||
+ | 17: sell iron 1000 20 | ||
+ | 18: repeat 20 | ||
+ | 19: goto we_are_broke | ||
+ | 20: label uhoh | ||
+ | 21: sleep rnd:250 | ||
+ | 22: goto we_are_really_broke | ||
+ | 23: label sellwood | ||
+ | 24: sell lumber 500000 35 | ||
+ | 25: goto check_market | ||
+ | 26: label selliron | ||
+ | 27: sell iron 500000 38 | ||
+ | 28: goto check_market | ||
+ | 29: label buywood | ||
+ | 30: buy lumber 500000 32 | ||
+ | 31: goto checkmarket | ||
+ | 32: label buyiron | ||
+ | 33: buy iron 500000 30 | ||
+ | 34: goto checkmarket | ||
<br> | <br> |
Latest revision as of 00:42, 23 September 2011
TEMPORARY COPY - NEEDS REFORMATTED STILL
All of the following references have been tested. The results, including the script used to access the variables is availible in the Reference Test section of this wiki.
Every effort has been made in an attempt to make them work. An examination of the code, for example, showed that 'taxrate' was non-functional due to being spelt incorrectly in the Evony code. The proper syntax for all variables is demonstated in the test.
Those that returned errors and could not be made to work were deleted from the output. Generally, this means that no reference to them could be found within the code.
Contents
Script References
References allow for the smooth operation of a City.
Resources, Troops, Walldefenses, & Miscellaneous City Information can be referenced from within a script.
Note: All references must begin with ‘m_city.’
When used within a script references are gereally compared to a desired limit in order to determine whether or not to perform the action or subroutine indicated.
Format: ifgoto ( [reference] [operator] [value] ) [label]
Format: ifgosub ( [reference] [operator] [value] ) [label]
Example: ifgosub ( m_city.cityManager.troop.lightCavalry < 20000 ) buildcav
Proper spacing and spelling is essential.
In certain cases the reference returns only a true/false in which case it will compare as either 0 if false or 1 if true.
Creating a script that is both easy to use and functional can be a tricky task for a seasoned veteran, much more so to a raw beginner. Remember, this is your city and troops you are attempting to control, a slight slip in logic can lead to disaster. To avoid such pitfalls it is reccommended that you check out the Tips and Tricks section of this wiki.
A test script has been created to test the output of all of the following references. The script and its resulting output can be found at the Reference Test page.Welcome to Scripts
Material Resources
Applicable Resources : food, wood, stone, iron
Summary of Reference Resource Parameters | ||
amount |
|
current amount of resources |
increaseRate |
|
Total Resource Rate of Production |
max |
|
Max Production of Resources at Current Levels |
storeRercent |
|
Storage Percentage |
workPeople |
|
Total number of workers used in production of the resource |
Examples :
//===================================================
// Check current amount of Wood, if greater than 10,000 gosub JumpToTraining
// Check if enough Iron is Being Produced, if not, gosub buildMoreMines
//===================================================
ifgosub ( m_city.cityManager.resource.wood.amount > 10000 ) JumpToTraining ifgosub ( m_city.cityManager.resource.iron.increaseRate < 5000 ) buildMoreMines
Troops
Reference Troops Names to EvoBot Equivalent | |
archer |
arch,a |
ballista |
balli,b |
batteringRam |
ram,r |
carriage |
tran,t |
catapult |
pult,cp |
heavyCavalry |
cata |
lightCavalry |
cav |
militia |
warr,w |
peasants |
worker,wo |
pikemen |
pike,p |
scouter |
scout,s |
swordsmen |
sword,sw |
Example :
ifgosub ( m_city.cityManager.troop.archer < 100000 ) buildArchers ifgosub ( m_city.cityManager.troop.heavyCavalry < 100000 ) buildPhracts ifgosub ( m_city.cityManager.troop.catapults < 15000 ) buildPults
IsHeroInCastle
Arg : m_city.IsHeroInCastle(heroname)
Explanation : Checks your city for a named Hero.
*Note: Checks only if your city has hero registered not if he/she is idle.
Coded Example :
ifgoto ( m_city.IsHeroInCastle(AtkA) == true ) buildArcher ifgoto ( m_city.IsHeroInCastle(AtkS) == true ) buildScout ifgoto ( m_city.IsHeroInCastle(AtkP) == true ) buildPike ifgoto ( m_city.IsHeroInCastle(AtkW) == true ) buildWarr ifgoto ( m_city.IsHeroInCastle(AtkSw) == true ) buildSword // label buildArcher …
Note : Reference Must be spelled & spaced exactly as shown.
AnyIdleHero
Arg : m_city.AnyIdleHero(heroname/any)
Explanation : Checks your city for a named Hero or any Hero that is idle.
Coded Example :
//=======================================
// Attack lvl5 NPC
// goto Check subroutine
// train archers
// Check if ATK295 is Idle, if yes then goto TrainBig
// CHeck if any Hero is Idle, if yes then return to Farming
//=======================================
attack XXX,YYY any b:400,t:400 gosub Check … // label Check train a:2000 any all ifgosub ( m_city.AnyIdleHero(ATK295) == true ) TrainBig ifgoto ( m_city.AnyIdleHero(any) == true ) goBack sleep 600 loop Check 0 label goBack gosubreturn // label TrainBig train cata:400 any all gosubreturn
Note : Reference Must be spelled & spaced exactly as shown.
City References
Note : Reference Must be spelled & spaced exactly as shown.
Reference |
Usage |
*Notes |
gold |
m_city.cityManager.resource.gold |
'.amount' is not needed to display total |
complaint |
m_city.cityManager.resource.complaint |
Public Grievances |
curPopulation |
m_city.cityManager.resource.curPopulation |
|
maxPopulation |
m_city.cityManager.resource.maxPopulation |
|
heroSalary |
m_city.cityManager.resource.heroSalary |
|
support |
m_city.cityManager.resource.support |
Loyalty |
taxIncome |
m_city.cityManager.resource.taxIncome |
|
hasEnemy |
m_city.cityManager.hasEnemy |
Not Sure if this one actually works, I've tried it & while under attack still displays false |
Edited City References
All of the following references have been tested. The results, including the script used to access the variables is availible in the Reference Test section of this wiki. Exceptions in orange.
Every effort has been made in an attempt to make them work. An examination of the code, for example, showed that 'taxrate' was non-functional due to being spelt incorrectly in the Evony code.
Those that returned errors and could not be made to work were deleted from the output.
Reference |
Usage |
Notes | |
---|---|---|---|
m_city.AnyIdleHero(any) |
Checks for an idle hero. |
Either true or false. | |
m_city.AnyIdleHero(ATK295) |
Checks if hero ATK295 is idle. |
Either true or false. | |
m_city.IsHeroInCastle(HeroName) |
Checks if hero HeroName is based in this castle. |
Either true or false. | |
|
|
| |
m_city.cityManager.allowAlliance |
|
Unknown. | |
m_city.cityManager.buildings[#] |
[object BuildingBean] |
Any use? | |
m_city.cityManager.buildings[#].endTime |
Construction end time. |
0 if finnished. | |
m_city.cityManager.buildings[#].level |
Building level that is in location # |
| |
m_city.cityManager.buildings[#].name |
Building type for building # |
e.g. Farm, Cottage (# = 0 - Number of buildings ... 73 max) | |
m_city.cityManager.buildings[#].positionId |
Gives the position id of building number # |
e.g. 1015 outside city, 27 inside city (# = 0 - 73) | |
m_city.cityManager.buildings[#].startTime |
Construction start time. |
0 if complete. | |
m_city.cityManager.buildings[#].status |
Construction status. |
0 = no construction, 1 = upgrading | |
m_city.cityManager.buildings[#].typeId |
Numeric type of building. |
| |
m_city.cityManager.fields[#].id |
Valley Id of valley No #. |
| |
m_city.cityManager.fields[#].level |
Level of valley No # |
| |
m_city.cityManager.fields[#].name |
Type of valley No #. |
| |
m_city.cityManager.fields[#].status |
|
Unknown. | |
m_city.cityManager.fields[#].type |
Numeric type of valley. |
| |
m_city.cityManager.fortification.abatis |
Number of abatis |
Does not include those in queue. | |
m_city.cityManager.fortification.arrowTower |
Number of archers towers. |
Does not include those in queue. | |
m_city.cityManager.fortification.rockfall |
Number of trebuchev. |
Does not include those in queue. | |
m_city.cityManager.fortification.rollingLogs |
Number of rolling logs |
Does not include those in queue. | |
m_city.cityManager.fortification.trap |
Number of traps. |
Does not include those in queue. | |
m_city.cityManager.goOutForBattle |
true => gates open, false => gates closed. |
| |
m_city.cityManager.hasEnemy |
|
Unknown. | |
m_city.cityManager.heros[#].experience |
|
Unknown. | |
m_city.cityManager.heros[#].id |
|
Unknown. | |
m_city.cityManager.heros[#].itemAmount |
|
Unknown. | |
m_city.cityManager.heros[#].itemId |
|
Unknown. | |
m_city.cityManager.heros[#].level |
|
Unknown. | |
m_city.cityManager.heros[#].logoUrl |
|
Unknown. | |
m_city.cityManager.heros[#].loyalty |
|
Unknown. | |
m_city.cityManager.heros[#].management |
|
Unknown. | |
m_city.cityManager.heros[#].managementAdded |
|
Unknown. | |
m_city.cityManager.heros[#].managementBuffAdded |
|
Unknown. | |
m_city.cityManager.heros[#].name |
|
| |
m_city.cityManager.heros[#].power |
|
| |
m_city.cityManager.heros[#].powerAdded |
|
| |
m_city.cityManager.heros[#].powerBuffAdded |
|
| |
m_city.cityManager.heros[#].remainPoint |
|
| |
m_city.cityManager.heros[#].staus |
0 = IDLE, 1 = MAYOR, 2 = DEFENDING, 3 = MARCHING, 4 = CAPTIVE, 5 = RETURNING |
| |
m_city.cityManager.heros[#].stratagem |
|
| |
m_city.cityManager.heros[#].stratagemAdded |
|
| |
m_city.cityManager.heros[#].stratagemBuffAdded |
|
| |
m_city.cityManager.heros[#].upgradeExp |
|
| |
m_city.cityManager.id |
|
| |
m_city.cityManager.logUrl |
|
Unknown. | |
m_city.cityManager.name |
|
| |
m_city.cityManager.resource.buildPeople |
|
| |
m_city.cityManager.resource.complaint |
|
| |
m_city.cityManager.resource.curPopulation |
|
| |
m_city.cityManager.resource.food.amount |
|
| |
m_city.cityManager.resource.food.increaseRate |
|
| |
m_city.cityManager.resource.food.max |
Figure at which production stops. |
| |
m_city.cityManager.resource.food.storePercent |
|
| |
m_city.cityManager.resource.food.workPeople |
Number of people tied up in food production. |
| |
m_city.cityManager.resource.gold |
The amount of gold on hand. |
| |
m_city.cityManager.resource.gold.amount |
Appending '.amount' to this reference creates an error. |
Proper usage is above. | |
m_city.cityManager.resource.gold.increaseRate |
|
| |
m_city.cityManager.resource.heroSalary |
|
| |
m_city.cityManager.resource.iron.amount |
|
| |
m_city.cityManager.resource.iron.increaseRate |
|
| |
m_city.cityManager.resource.iron.max |
Figure at which production stops. |
| |
m_city.cityManager.resource.iron.storePercent |
|
| |
m_city.cityManager.resource.iron.workPeople |
Number of people tied up in iron production. |
| |
m_city.cityManager.resource.maxPopulation |
|
| |
m_city.cityManager.resource.stone.amount |
|
| |
m_city.cityManager.resource.stone.increaseRate |
|
| |
m_city.cityManager.resource.stone.max |
Figure at which production stops. |
| |
m_city.cityManager.resource.stone.storePercent |
|
| |
m_city.cityManager.resource.stone.workPeople |
Number of people tied up in stone production. |
| |
m_city.cityManager.resource.support |
Loyalty of city. |
|
|
m_city.cityManager.resource.taxIncome |
|
| |
m_city.cityManager.resource.taxRate |
|
| |
m_city.cityManager.resource.troopCostFood |
|
| |
m_city.cityManager.resource.wood.amount |
Current amount of wood |
| |
m_city.cityManager.resource.wood.increaseRate |
Total Resource Rate of Production |
| |
m_city.cityManager.resource.wood.max |
Figure at which production stops. |
| |
m_city.cityManager.resource.wood.storePercent |
|
| |
m_city.cityManager.resource.wood.workPeople |
|
| |
m_city.cityManager.resource.workPeople |
|
| |
m_city.cityManager.status |
|
Unknown. | |
m_city.cityManager.troop.archer |
Number of this troop type that are in city but not active. |
| |
m_city.cityManager.troop.ballista |
Number of this troop type that are in city but not active. |
| |
m_city.cityManager.troop.batteringRam |
Number of this troop type that are in city but not active. |
| |
m_city.cityManager.troop.carriage |
Number of this troop type that are in city but not active. |
| |
m_city.cityManager.troop.catapult |
Number of this troop type that are in city but not active. |
| |
m_city.cityManager.troop.heavyCavalry |
Number of this troop type that are in city but not active. |
| |
m_city.cityManager.troop.lightCavalry |
Number of this troop type that are in city but not active. |
| |
m_city.cityManager.troop.militia |
Number of warriors that are in city but not active. |
| |
m_city.cityManager.troop.peasants |
Number of workers that are in city but not active. |
| |
m_city.cityManager.troop.pikemen |
Number of this troop type that are in city but not active. |
| |
m_city.cityManager.troop.scouter |
Number of this troop type that are in city but not active. |
| |
m_city.cityManager.troop.swordsmen |
Number of this troop type that are in city but not active. |
|
Market Prices
Beginning with version 2070, anew reference class, m_context, has been added. The first members are calls to the current market prices of each commodity.
To find the current buy/sell price of any resource:
Reference: |
Usage: |
Example: |
---|---|---|
sellprice() |
m_context.sellprice(x) |
m_context.sellprice(0) |
buyprice |
m_context.buyprice(x) |
m_context.buyprice(2) |
The constants for each resource:
Commodity |
x |
---|---|
Food | 0 |
Lumber | 1 |
Stone | 2 |
Iron | 3 |
Example: a completely runnable 5 minute script...
1: label check_market 2: ifgoto ( m_city.cityManager.resource.gold < 400000000 ) we_are_broke 3: ifgoto ( m_context.buyPrice(1) < 32 ) buywood 4: ifgoto ( m_context.buyPrice(3) < 30 ) buyiron 5: label we_are_broke 6: ifgoto ( m_city.cityManager.resource.gold < 50000 ) we_are_really_broke 7: ifgoto ( m_context.sellPrice(1) > 35 ) sellwood 8: ifgoto ( m_context.sellPrice(1) > 38 ) selliron 9: goto check_market 10: label we_are_really_broke 11: ifgoto ( m_city.cityManager.resource.lumber.amount < 30000 ) and_we_have_no_wood 12: sell lumber 1000 20 13: repeat 20 14: goto we_are_broke 15: label and_we_have_ne_wood 16: ifgoto ( m_city.cityManager.resource.iron.amount < 30000 ) uhoh 17: sell iron 1000 20 18: repeat 20 19: goto we_are_broke 20: label uhoh 21: sleep rnd:250 22: goto we_are_really_broke 23: label sellwood 24: sell lumber 500000 35 25: goto check_market 26: label selliron 27: sell iron 500000 38 28: goto check_market 29: label buywood 30: buy lumber 500000 32 31: goto checkmarket 32: label buyiron 33: buy iron 500000 30 34: goto checkmarket