• 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

    Include all attachments?

    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