• My Pages
  • Comments
  • Add Link
  • Subscribe
  • Subscribe User
  • Edit (GUI)
  • Edit (Text)
  • Rename Page
  • Copy Page
  • Load Page
  • Save Page
  • Delete Page
  • Attachments
  • Check Spelling
  • Diffs
  • Info
  • Revert to this revision
  • XML
  • Render as Docbook
  • Print View
  • Raw Text
  • Delete Cache
  • Like Pages
  • Local Site Map
  • Remove Spam
  • Package Pages
  • Sync Pages
    • Diff for "BuildingFunctions"
    Differences between revisions 1 and 13 (spanning 12 versions)
    Revision 1 as of 2014-11-23 21:52:32
    Size: 4122
    Editor: Inanna
    Comment:
    Revision 13 as of 2016-02-01 18:02:03
    Size: 6924
    Editor: Inanna
    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)
    ==
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start; " tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em; ">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.getBuildingLevel ( BuildingTypes ) ||
    See also: [[Building|Building Objects]]<<BR>>
    See also: [[BuildingTypes|Building Types|]]

    == g
    etBuildingLevel ==
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start; " tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em; ">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.getBuildingLevel(!BuildingType) ||
    Line 9: Line 11:
    this example finds the level of the !MarketPlace(23) This example finds the level of the Market (typeID = 23).
     . {{{
    echo city.getBui
    ldingLevel(23)
    }}}
    Line 11: Line 16:
    This example cancels all trades if the number of trades is equal to the level of the Market (typeID = 23).
    Line 15: Line 21:
    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 22:
     . {{{
    echo city.
    getBuildingLevel(23)
    }}}
     10<<
    BR>>Script stopped

    == getBuildingB
    yTypeId(buildingType) ==
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start;" tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.getBuildingByTypeId(buildingType) ||
    == getBuildingByTypeId ==
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start;" tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.getBuildingByTypeId(!BuildingType) ||
    Line 28: Line 28:
    For example, to find your highest level barrack (typeId = 2): For example, to find your highest level barrack (typeID = 2):
    Line 37: Line 37:
    See also: BuildingTypes

    == getBuildingByPosId(pos) ==
    == getBuildingByPosId ==
    Line 52: Line 50:
    {{http://imageshack.us/a/img820/7558/positionid1.png}} {{http://imageshack.us/a/img10/8545/positionid2.png}} {{http://i47.tinypic.com/21c5gro.jpg}} {{http://i.imgur.com/r1Voz7t.png}}
    Line 54: Line 52:
    == countBuilding(buildingType,minLevel,maxLevel) ==
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start; " tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em; ">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.countBuilding([[BuildingTypes|buildingType]],minLevel,maxLevel) ||
    ||<#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;                    ">Example: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">totalmines = city.countBuilding(6,1,10) ||
    == countBuilding ==
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start; " tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em; ">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.countBuilding(!BuildingType[,!MinLevel[,!MaxLevel]]) ||
    ||<#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">Example: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">totalmines = city.countBuilding(6,1,10) ||
    Line 59: Line 57:
    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."
    }}}

    The !MinLevel and !MaxLevel parameters in countBuilding are optional. If you do not specify a minimum level, it defaults to level 1. If you do not specify a maximum level, it defaults to level 10.

    == hasBuilding ==
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start; " tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em; ">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.hasBuilding(typeId[,!Minlevel]) ||
    ||<#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">Example: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.hasBuilding(2,10) ||

    This function allows you to check if you have a building of a certain typeId of at least a specified level. The !MinLevel is optional. If you do not specify a minimum level, it defaults to level 1.
     
    In the example above, the check would return true if the city had a level 10 barrack in it.

    == getTownHallLevel ==
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start; " tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em; ">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.getTownHallLevel() ||
    ||<#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">Example: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">echo city.getTownHallLevel() ||

    This function returns the level of the townhall in the city.

    == getWallLevel ==
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start; " tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em; ">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">city.getWallLevel() ||
    ||<#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">Example: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">echo city.getWallLevel() ||

    This function returns the level of the wall in the city.

    See also: Building Objects
    See also: Building Types

    getBuildingLevel

    Usage:

    city.getBuildingLevel(BuildingType)

    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.

    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:

    http://i47.tinypic.com/21c5gro.jpg http://i.imgur.com/r1Voz7t.png

    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."

    The MinLevel and MaxLevel parameters in countBuilding are optional. If you do not specify a minimum level, it defaults to level 1. If you do not specify a maximum level, it defaults to level 10.

    hasBuilding

    Usage:

    city.hasBuilding(typeId[,!Minlevel])

    Example:

    city.hasBuilding(2,10)

    This function allows you to check if you have a building of a certain typeId of at least a specified level. The MinLevel is optional. If you do not specify a minimum level, it defaults to level 1.

    In the example above, the check would return true if the city had a level 10 barrack in it.

    getTownHallLevel

    Usage:

    city.getTownHallLevel()

    Example:

    echo city.getTownHallLevel()

    This function returns the level of the townhall in the city.

    getWallLevel

    Usage:

    city.getWallLevel()

    Example:

    echo city.getWallLevel()

    This function returns the level of the wall in the city.


    CategoryFunctions

    BuildingFunctions (last edited 2016-02-01 18:02:03 by Inanna)