• 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 "Travelinfo"
    Differences between revisions 1 and 7 (spanning 6 versions)
    Revision 1 as of 2013-01-08 15:14:58
    Size: 872
    Editor: Kento11
    Comment:
    Revision 7 as of 2015-09-08 19:04:50
    Size: 854
    Editor: Romulus
    Comment:
    Deletions are marked like this. Additions are marked like this.
    Line 1: Line 1:
    Describe Travelinfo in variables here. ## page was renamed from Travelinfo in variables
    Example on how to get information similar to that obtained from the TravelInfo script command for use in variables.
    Line 3: Line 4:
    Example made by Romulus on how to use information otherwise obtained from the travelinfo script command for use in variables.
    {{{
    Line 16: Line 16:
    echo "Attack time: " + round(attackTime) + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(attackTime * 2))
    echo "Reinforce time: " + round(transTime) + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(transTime * 2))
    echo "Attack time: " + attackTime + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(attackTime * 2))
    echo "Reinforce time: " + transTime + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(transTime * 2))
    }}}
    Line 19: Line 20:
    CategoryScriptingLanguage ScriptExamples

    Example on how to get information similar to that obtained from the TravelInfo script command for use in variables.

    tr = "a:94k,t:2k,w:2k,s:2k"
    x = city.x + 20
    y = city.y + 30
    
    targetId = GetFieldId(x, y)
    trBean = GetTroops(tr)
    attackTime = city.getTravelTime(city.fieldId, targetId, trBean, 5)
    transTime = city.getTravelTime(city.fieldId, targetId, trBean, 2)
    carryingLoad = city.getCarryingLoad(trBean)
    echo "Distance to " + city.coords + ": " + FormatDistance(city.fieldId, targetId)
    echo "Carrying load: " + carryingLoad
    echo "Attack time: " + attackTime + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(attackTime * 2))
    echo "Reinforce time: " + transTime + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(transTime * 2))


    ScriptExamples

    Travelinfo (last edited 2015-09-08 19:04:50 by Romulus)