Size: 4122
Comment:
|
Size: 4235
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
<<TOC>> | <<TableOfContents>> |
Line 3: | Line 3: |
## page was renamed from GetBuildingLevel == getBuildingLevel(buildingType) == |
== getBuildingLevel == |
Line 9: | Line 8: |
this example finds the level of the !MarketPlace(23) | This example finds the level of the Market (typeID = 23). . {{{ echo city.getBuildingLevel(23) }}} |
Line 11: | Line 13: |
This example cancels all trades if the number of trades is equal to the level of the Market (typeID = 23). | |
Line 15: | Line 18: |
This sample cancels all trades if the number of trades is equal to the Level of the Market Place... (Hence the Market is full) | |
Line 17: | Line 19: |
. {{{ echo city.getBuildingLevel(23) }}} 10<<BR>>Script stopped == getBuildingByTypeId(buildingType) == |
== getBuildingByTypeId == |
Line 28: | Line 25: |
For example, to find your highest level barrack (typeId = 2): | For example, to find your highest level barrack (typeID = 2): |
Line 39: | Line 36: |
== getBuildingByPosId(pos) == | == getBuildingByPosId == |
Line 54: | Line 51: |
== countBuilding(buildingType,minLevel,maxLevel) == | == countBuilding == |
Line 59: | Line 56: |
The above example gives the total count of all iron mines between level 1 and 10. | This example gives the total count of all iron mines (typeID = 6) between level 1 and 10: . {{{ totalmines = city.countBuilding(6,1,10) }}} This example will check if you have at least 3 sawmills (typeID = 4) at level 5 or higher: . {{{ if city.countBuilding(4,5,10) >= 3 echo "I have at least 3 level 5+ sawmills." }}} |
getBuildingLevel
Usage: |
city.getBuildingLevel ( BuildingTypes ) |
Example: |
level = city.getBuildingLevel(23) |
This example finds the level of the Market (typeID = 23).
echo city.getBuildingLevel(23)
This example cancels all trades if the number of trades is equal to the level of the Market (typeID = 23).
if city.tradesArray.length == city.getBuildingLevel(23) canceltrade
getBuildingByTypeId
Usage: |
city.getBuildingByTypeId(buildingType) |
Example: |
city.getBuildingByTypeId(23) |
This function returns an object for the building with the highest level of that typeId. For example, to find your highest level barrack (typeID = 2):
echo city.getBuildingByTypeId(2).level
Valid parameters for this object are level, name, positionId, startTime, endTime, typeId, and status. For example you can echo city.getBuildingByTypeId(2).name or city.getBuildingByTypeId(2).status.
See also: BuildingTypes
getBuildingByPosId
Usage: |
city.getBuildingByPosId(pos) |
Example: |
city.getBuildingByPosId(2) |
This example finds the name of the building at position 2:
echo city.getBuildingByPosId(2).name
You can find the positions with this:
countBuilding
Usage: |
city.countBuilding(buildingType,minLevel,maxLevel) |
Example: |
totalmines = city.countBuilding(6,1,10) |
This example gives the total count of all iron mines (typeID = 6) between level 1 and 10:
totalmines = city.countBuilding(6,1,10)
This example will check if you have at least 3 sawmills (typeID = 4) at level 5 or higher:
if city.countBuilding(4,5,10) >= 3 echo "I have at least 3 level 5+ sawmills."