This is nothing fancy, just a big list of newly available objects and functions that are not yet documented in the wiki. The number at the start is the bot version it was added in. Thanks to Dismayed for the changelog summary :) {{{ 2698 Added "isAvailable" to HeroBean object (returns true if hero is not busy and either mayor or idle) 2695 Eliminated MapCastles(x,y,r) [use more flexible CastleInRectangle(x1,y1,x2,y2) instead] 2693 Renamed updateDetailInfo() to UpdateDetailInfo() 2683 Renamed stateName() to StateName() (the function converts numeric castle's "state" property to name) 2676 Added 2 additional (optional) boolean parameters to CastlesInRectangle(): 5th parameter is whether to omit NPCs from results (default: Yes) 2676 6th parameter is whether to return array indexed by castle id (Yes) or zero-based (No) (default: No) Example: 2676 list = CastlesInRectangle(123, 234, 156, 274, false, true) // include NPCs into results, and also use castle id as index id = GetFieldId(142, 255) 2676 castle = list[id] // this works because of 6th parameter in CastlesInRectangle() call set to true ifgosub castle found // same as "ifgosub castle != null found" 2670 Added ResetMap function allowing to clear cached map data (used by rescanmap/rescanrec): a = ResetMap(x,y,radius) // resets circular area with center at x,y Example 2: a = ResetMap(x,y,width,height) // resets rectangular area with start at x,y In both examples, "a" is dummy variable (will be assigned null).2670 2670 Added support for city.x and city.y (returning x and y coordinates of the city) Example: x = GetX(city.fieldId) // x-coordinate of the city x = city.x // simpler way to do the same 2669 GetFieldType(str) - converts valley name to type GetFieldName(integer) - converts valley type to name 2669 FindField(cx, cy, distance, fieldType, [fieldLevel]) - returns array of fields within specified distance from cx,cy x = GetX(city.fieldId) 2669 y = GetY(city.fieldId) 2668 Resource objects can now be auto-converted to string as needed For example: 2668 echo city.myArmies[0].resource // outputs human-readable string representing resources carried by first army Renamed getResources() to GetResources() 2662 Added support for haunted castle items and increased army sizes (to be further refined) Reserved resources now include amount needed to do 1-time comforting if city has non-zero grievance 2651 Added support for array constructors (nested arrays constructors are fully supported) Example: 2651 colors = [ "green", "red", "yellow" ] fruits = [ "pear", "apple", "banana" ] 2651 echo colors[1] // outputs "red" echo fruits[0] // outputs "pear" 2651 str = colors[1] + " " + fruits[1] echo "I like " + str + "s" // outputs "I like red apples" 2651 Added support for object constructors (nested object constructors are fully supported) message = { user:"bucks", text:"What's wrong with you?" } 2651 execute "whisper " + message.user + " " + message.text Added support for unary -, + and ! (not) 2651 a = -2 < 3 // true b = !a // false 2651 text = "some text" xx = !text // false 2651 Added date() function d = date(2012, 9, 24, 10, 30) // note, months are counted from 0,output below is for EST time zone 2651 echo d.toString() // outputs "Wed Oct 24 10:30:00 GMT-0400 2012" echo d.toUTCString() // outputs "Wed Oct 24 14:30:00 2012 UTC" 2650 Changed first letter to capital in the following functions 2650 TroopBeanToString, GetTroops, GetFortifications 2650 Renamed "getFoodConsumeRate" to "foodConsumeRate" in troop bean Example: Find food consumtpion for a specified troop string 2650 mytroops = GetTroops("a:30k,b:40k,w:1,p:1,sw:1") // convert troop string to TroopBean object ifgoto mytroops continue 2650 echo "Error in troop string" end 2650 echo "Food consumption of " + TroopBeanToString(mytroops, ",") + " is " + mytroops.foodConsumeRate + " per hour" echo "Food consumption per 1 minute is " + mytroops.foodConsumption(60) 2644 Renamed FieldIdToCompareString() to FieldIdToCoords() Added "coords" property support to field beans 2644 field = city.fields[0] echo "Field 1 is " + field.name + ", coordinates are: " + FieldIdToCoords(field.id) // outputs something like "Field 1 is Forest, coordinates are: 123,456" 2644 echo "Field 1 is " + field.name + ", coordinates are: " + GetX(field.id) + "," + GetY(field.id) // same output echo "Field 1 is " + field.name + ", coordinates are: " + field.coords // same output 2643 - these functions (all use field id as parameter) renamed to start with upper-case letter: GetLevel, GetType, GetZoneName, GetX, GetY 2643 - added MapDistance(x1, y1, x2, y2) function returning distance between (x1,y1) an (x2,y2) on the map 2642 2635 New BuyPrice() and SellPrice() functions use up to 3 parameters: resource, amount, method resource (required): 0 - food, 1 - wood, 2 - stone, 3 - iron 2635 amount (optional, default = 1): desired amount of resource method (optional, default = 0): 0 - "now", 1 - "average" (see explanation below) 2635 Method 0 ("now" - default) returns the price to buy or sell the specified amount of resources without waiting. Method 1 ("average") returns average price needed to buy or sell the specified amount of resources 2635 BuyPrice(resource) is same as m_context.buyPrice(resource) SellPrice(resource) is same as m_context.sellPrice(resource) 2634 Added "return" (same as "gosubreturn") Added support for "NaN" (special constant representing "not a number" value) and isNaN() function 2634 a = NaN b = a + 2 2634 echo isNaN(b) // outputs "true" Added support for "Infinity" (special constant representing infinitly large number) and isFinite() function 2634 a = 0 b = 2 / a // division by zero! 2634 echo isFinite(b) // outputs "false" 2631 Added support for various map-related functions in expressions (function availability and exact names/parameters are subject to change!) Example 1 (prints list of up to 10 enemies, unsorted): 2631 enemies = SearchEnemyCastles(10) i = 0 2631 label loop1 ifgoto i >= enemies.length exit 2631 castle = enemies[i] i = i + 1 2631 echo "Enemy " + i + ":" fieldIdToCompareString(castle.id) castle.name castle.userName castle.allianceName castle.prestige castle.honor goto loop1 2631 label exit Example 2 (prints info for a specific map coordinates, uses cached info, if available) 2631 x = 123 y = 456 2631 id = GetFieIdId(x,y) label notyet 2631 castle = GetDetailInfo(id, true) ifgoto castle == null notyet 2631 echo "lord=" + castle.userName "alliance=" + castle.allianceName "R=" + castle.relation 2630 Added support for "<>" operator (same as "!=") in expressions Added inline support for the following math functions: 2630 abs(), acos(), asin(), atan(), atan2(), cos(), sin(), tan(), exp(), pow(), log(), 2630 ceil(), floor(), round(), max(), min() random(), sqrt() 2630 Added access to the following constants: PI, E, SQRT1_2 (square root of 2 divided by 2), SQRT2 (square root of 2) 2630 LN2 (logarithm of 2), LN10 (logarithm of 10), LOG10E (base 10 ogarithm of E), LOG2E (base 2 logarithm of E) Added support for various resource-related functions and constants 2630 res = RESOURCETYPE_WOOD echo "Resource type " + res + " is for " + ResourceNames[res] 2629 Variables can hold value of any time (number, string, array/function/oibject reference) Expressions are supported in ifgoto/ifgosub 2629 Example 1: Simple math a = 2 2629 b = 3 c = a + b // c is 5 now 2629 c = c + 1 // c is 6 now d = (a + b) (c - 1) 2629 echo a b c d // outputs 2 3 6 25 Example 2: String operations 2629 text1 = "Hello" text2 = "world" 2629 result = text1 + ", " + text2 + "!" len = result.length 2629 echo result // outputs "Hello, world!" echo len // 13 2629 echo result.indexOf("o") // 4 Example 3: References: 2629 echo "List of heroes in " + m_city.cityManager.name + ":" heroes = m_city.cityManager.heroes 2629 i = 0 count = heroes.length 2629 ifgoto i>=count done // note, round brackets are optional and spaces between operands are not required label loop1 2629 i = i + 1 echo i + ". " + heroes[i].name 2629 goto loop1 label done 2629 Example 4: Function references ask = m_context.buyPrice // note, buyPrice is a function! 2629 res = 0 label resloop 2629 echo "Current " + ResourceNames[res] + " price is " + ask(res) res = res + 1 Added "execute" command allowing to run arbitrary command with custom parameters, e.g. execute "buy food " + amount + " " + price // buy 5m food @ 22.5 Added "end" command (terminates script) 2607 Allow to check city/player (account) buffs from scripts: m_city.cityManager.hasBuff(XXX) // true if city has buff XXX applied 2607 m_context.hasBuff(XXX) // true if we have buff XXX applied m_context.buff(XXX) // returns BuffBean object or null if buff XXX is not applied 2607 m_city.cityManager.buff(XXX) // returns BuffBean object or null if buff XXX is not applied Example 1: Checking if city has buff applied 2607 ifgoto ( m_city.cityManager.hasBuff(ForceopenclosegateBuff ) == true ) gatesforced Example 2: Accessing individual player (account) buff properties 2607 print m_context.buff(StopTroopsUpkeepBuff).descName // the above would print "No food for your troops will be consumed under this status." if buff is applied 2607 m_context.truced // true if account is truced (including server merge truce) m_context.inTruceCooldown // true if account is in truce cooldown 2606 Recognize "null" as valid value in scripts 2603 m_context.marketReady() // set to false after (re)login, becomes true after market prices for all 4 resources are refreshed m_context.marketReady() // set to false after (re)login, becomes true after market prices for all 4 resources are refreshed 2603 m_context.findFirstCity() // "main" city object New functions (not all possible parameters are shown): 2603 m_city.cityManager.comfortingNeeds(1).needAmount // amount of food needed to do disaster relief m_city.cityManager.comfortingNeeds(2).needAmount // amount of food needed to do praying 2600 Added disaster relief/praying factor access via scripts (m_city.cityManager.PRFactor) Added display of food amount needed for disaster relief/praying and current PR factor 2595 IsHeroInCastle() now supports hero-strings ifgoto ( m_city.IsHeroInCastle(any:att>200) == true ) found Added "is_researching" (returns true if there is a research going on) 2561 Dropped round brackets and renamed m_city.cityManager.enemyArmies[x].startFieldCoords => m_city.cityManager.enemyArmies[x].startCoords 2561 m_city.cityManager.enemyArmies[x].targetFieldCoords => m_city.cityManager.enemyArmies[x].targetCoords m_city.cityManager.cityCoords => m_city.cityManager.coords 2557 m_city.cityManager.enemyArmies[x].startFieldCoords m_city.cityManager.enemyArmies[x].targetFieldCoords 2557 m_city.cityManager.cityCoords }}} ---- ScriptObjects