• 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 "getTravelTime"
    Differences between revisions 4 and 12 (spanning 8 versions)
    Revision 4 as of 2013-08-04 21:26:22
    Size: 1108
    Editor: tech
    Comment:
    Revision 12 as of 2013-08-20 14:47:28
    Size: 1366
    Editor: Romulus
    Comment:
    Deletions are marked like this. Additions are marked like this.
    Line 1: Line 1:
    this function will return the time in seconds it takes to march from point A to point B using a particular type of troops ## page was renamed from city.getTravelTime
    this function will return the time in seconds it takes to march from point A to point B using a particular type of troops, taking into account player's relevant tech levels for compass or horseback riding.
    Line 6: Line 7:
    fieldId1 and fieldId2 are the fieldId's which represent coordinates for point A and B, troopBean is a special object representing a single wave of troops of any type or combination, and type can be 2 for transport or reinforcement waves or 5 for attack or scout waves. fieldId1 and fieldId2 are the [[FieldId|fieldId]]'s which represent coordinates for point A and B, troopBean is a special object representing a single wave of troops of any type or combination, and type can be 2 for transport or reinforcement waves or 5 for attack or scout waves.
    Line 9: Line 10:

    coords="123,456"
    {{{
    coords = "123,456"
    Line 12: Line 13:
    // converts coords into fieldId
    Line 15: Line 17:
    Line 18: Line 19:
    transTime = city.getTravelTime(city.fieldId, targetId, troopBean, 2)
    // returns time to transport or reinforce target coords in seconds - from point A (city.fieldId) to point B (targetId) using specified troopBean
    transTime = city.getTravelTime(city.fieldId, targetId, troopBean, 2)  // returns time to transport or reinforce target coords in seconds - from point A (city.fieldId) to point B (targetId) using specified troopBean
    Line 21: Line 21:
    attackTime = city.getTravelTime(city.fieldId, targetId, troopBean, 5)
    // returns time to send attack or scout to targeth coords in seconds - from point A (city.fieldId) to point B (targetId) using specified troopBean
    attackTime = city.getTravelTime(city.fieldId, targetId, troopBean, 5)  // returns time to send attack or scout to target coords in seconds - from point A (city.fieldId) to point B (targetId) using specified troopBean
    }}}
    == Related Functions: ==
    [[GetFieldId|GetFieldId()]]
    Line 24: Line 26:
    [[GetTroops|GetTroops()]]
    Line 27: Line 29:
    CategoryFunctions ----
    ObjectCity

    this function will return the time in seconds it takes to march from point A to point B using a particular type of troops, taking into account player's relevant tech levels for compass or horseback riding.

    usage:

    city.getTravelTime(fieldId1,fieldId2,troopBean,type)

    fieldId1 and fieldId2 are the fieldId's which represent coordinates for point A and B, troopBean is a special object representing a single wave of troops of any type or combination, and type can be 2 for transport or reinforcement waves or 5 for attack or scout waves.

    example:

    coords = "123,456"
    targetId = GetFieldId(coords)
    // converts coords into fieldId
    
    troops = "s:100k"
    troopBean = GetTroops(troops)
    // converts troop string into troopBean object
    
    transTime = city.getTravelTime(city.fieldId, targetId, troopBean, 2)  // returns time to transport or reinforce target coords in seconds - from point A (city.fieldId) to point B (targetId) using specified troopBean
    
    attackTime = city.getTravelTime(city.fieldId, targetId, troopBean, 5)  // returns time to send attack or scout to target coords in seconds - from point A (city.fieldId) to point B (targetId) using specified troopBean

    GetFieldId()

    GetTroops()



    ObjectCity

    getTravelTime (last edited 2014-02-10 18:28:49 by Inanna)