a

Thursday, February 12, 2015

HeroPolicy

heropolicy
Syntax: heropolicy [/herolist] [/useexcalibur] [/usewealthofnations] [/useartofwar] [/useonwar] [/useepitomeofmilitarysilence] [/useanabisis] [/reward] [noreward] [/dismiss] [/upgrade] [/noupgrade] [/mayor] [/train] [/remote] [/level] [/farmer] [/spam] [/valley] [/gearing] [/nogearing] [/troops]
Example: heropolicy /herolist:any:loyalty<100 /dismiss

This goal is highly customizable, many of the features you can use with heropolicy are also usable through other goals, but this will allow you to attach specific policies to specific heroes. The majority of the above switches should be self explanatory. troops attaches a troop string(Such as a:100k,s:20k), to a hero, and is used for npc farming.

Monday, February 9, 2015

QueryMap

New Feature in 20150124 beta.

Command querymap- This command allows a wide range of queries of the detailed map information that the BOT collects. It is a generalization of
the searchcastle and searchenemies commands that exist today. You can ask more complex questions and show other types of data.

Syntax-

querymap SELECT item {, item}* FROM cursorName {, cursorName}* WHERE pred { AND pred}*

The syntax is patterned after the SQL language with some significant limitations. The language allows the use of 
multiple cursors, so the language allows JOINS. However, the only logical connector between predicates is AND.
To accomplish the effect of an OR will require running multiple queries and combining the results offline. There 
is also no ability to sort or group items. There are also no aggregate operators.

The items in the select list are either one of the two built in functions, COORDS() or DISTANCE() (described further below) or a field reference or a constant value, e.g., 1, or foo (note: DO NOT include string values in quotes). A field reference is of the form:


where x is the name of a cursor and name is a field name in the map detail information. They include:

name canSend type id flag canScout honor canTrans furlough level canLoot canOccupy canDeclaredWar zoneName prestige colonialStatus distance declaredWarStartTime colonialRelation declaredWarStatus ownerPlayerId powerLevel castleId retrieveDate userName relation allianceName canColonize lastsentDate suzerain freshMan state npc

A cursor name is just a name you make up, starting with a letter and followed by numbers or letters. It represents an independent set of the map detail items. So, if I use two cursors, x and y, my predicates can compare the attributes of any two detail items in the map. It can be very useful when trying to express a query, but be careful. Each cursor add a nested loop to the query execution. If we have 1000 items in the map and our predicate evaluation takes 1 millisecond, a query with only one cursor will require one second (i.e., 1000 * .001sec). However, if we add another cursor, the time can go as high as 1000 sec, (i.e., 1000 * 1000 * 0.001sec). In executing the query, we try to optimize, but consider yourself warned.

The where clause consists of one or more predicates seperated by "AND". That is, a row will only be listed if all the predicates are true. A predicate consists of two items as in the select clause separated by a comparison operator (<, <=, =, >, >=, !=). The = and != operators can be used on string valued items. If the item is essentially a numeric value it can be used with the other operators as well.

Example-

The following query will show all of the level 14 HCs currently in the BOTs map. You can use scanrec to ensure that the query is complete.

querymap SELECT COORDS(x.id), x.userName, x.zoneName FROM x WHERE x.level = 14

This query uses a single cursor x. The only predicate in the WHERE clause compares the level field of the map detail item referenced by x
to the constant value "14". If it is equal, then the map detail is included in the result. The select list includes three items:

  1. COORDS(x.id) - The id field of the detail item is an internal representation of the location of the item used by Evony. The COORDS() is a built in function that converts the id to x,y style coords. Another builtin function is DISTANCE(x.id, y.id). This function will calculate the distance between the item referred to by x and one referred to by y.
  2. x.userName - This is user name of the player that owns this item.
  3. x.zoneName - This is the name of the state where the item is located.
Here is what the results of running this query might look like:

===*begin SELECT COORDS(x.id), x.userName, x.zoneName FROM x WHERE x.level = 14===
COORDS() userName zoneName
693,363 BLOODCRIP MORAVIA
759,363 mindblow MORAVIA
429,429 ScaryGoof BAVARIA
561,429 Cateran BAVARIA
165,561 BuckMassen UPPER LORRAINE
===end SELECT COORDS(x.id), x.userName, x.zoneName FROM x WHERE x.level = 14 (5)===

Here is a more complex example:

querymap SELECT x.type, x.name, x.userName, x.zoneName, COORDS(x.id) FROM x, y WHERE DISTANCE(x.id, y.id) < 3 AND y.userName = HHGoA AND y.type = 11 AND x.type = 6 AND x.canOccupy = true

This query uses two cursors. The x cursor represents Lakes that can be taken by the user issuing the query. The y cursor represents cities owned by the user HHGoA. The first predicate in the where clause tests that the distance between the two items is less than 3miles. Next, the owner of the y item is required to be owned by the user HHGoA. (Items where this is not true will be ignored for cursor y). Next, we check to make sure the type of the y item is 11, i.e., a city. Then we check that the x item is of type 6, i.e., a lake. Finally, we check that the canOccupy field of the x item is true. This ensures that we can take it.

Here are some sample results for this query:

===*begin SELECT x.type, x.name, x.userName, x.zoneName, COORDS(x.id) FROM x, y WHERE DISTANCE(x.id, y.id) < 3 AND y.userName = HHGoA AND y.type = 11 AND x.type = 6 AND x.canOccupy = true===
x.type x.name x.userName x.zoneName COORDS()
6 Lake BigJimSlade MORAVIA 684,294
6 Lake Cimmeron MORAVIA 615,299
6 Lake jimmvalhor BAVARIA 429,426
6 Lake BAVARIA 427,433
===end SELECT x.type, x.name, x.userName, x.zoneName, COORDS(x.id) FROM x, y WHERE DISTANCE(x.id, y.id) < 3 AND y.userName = HHGoA AND y.type = 11 AND x.type = 6 AND x.canOccupy = true (4)=== 

The interpretation of the type field is:

Value Interpretation
1 Forest
2 Desert
3 Hill
4 Swamp
5 Grassland
6 Lake
10 Flat
11 Castle
12 NPC

Thursday, December 4, 2014