• 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 "TroopAndResourceTotals"
    Differences between revisions 1 and 26 (spanning 25 versions)
    Revision 1 as of 2013-11-21 02:30:04
    Size: 952
    Editor: Inanna
    Comment:
    Revision 26 as of 2015-04-26 02:36:41
    Size: 2776
    Editor: Inanna
    Comment:
    Deletions are marked like this. Additions are marked like this.
    Line 1: Line 1:
    This script will echo your troop totals for each city and for your entire account. This script will echo your troop & resource totals for each city and for your entire account. <<BR>>
    Line 3: Line 3:
    '''THIS VERSION REQUIRES NEATBOT 3145T OR LATER.''' <<BR>>
    For older bots, use the script in the second code box below.
    Line 4: Line 6:
    // gets total troops in all cities // --------------------------------
    // Troop & Resource Totals
    // --------------------------------
    res = GetResources("f:0")
    troops = GetTroops("a:0")
    upkeep = 0
    cities.forEach(CreateFunction("city,ind,arr","troops.add(city.cityManager.getAvailableTroop())||city.cityManager.estResource.addTo(res)||upkeep+=city.cityManager.resource.troopCostFood"))
    echo "{CenterPad("\nTOTAL TROOPS:\n", 43, "=")}\n{TroopBeanToString(troops,"\n")}\nUpkeep:{FormatNumber(upkeep)}\n\n{CenterPad("\nTOTAL RESOURCES:\n", 52, "=")}\nGold:{FormatNumber(res.gold)}\nFood:{FormatNumber(res.food)}\nWood:{FormatNumber(res.wood)}\nStone:{FormatNumber(res.stone)}\nIron:{FormatNumber(res.iron)}"
    }}}

    <<BR>><<BR>>
    FOR OLDER NEATBOT VERSIONS:
    <<BR>><<BR>>
    {{{
    // =======================================================
    // Troop & Resource Totals For Each City & Entire Account
    // Originally by romulus
    // Requires NeatBot 3010 or later
    // =======================================================

    // set this to 1 if you want individual city troop/res counts displayed too, 0 if not
    showcities = 0
    Line 6: Line 30:
    echo "TOTAL TROOPS: Found " + mycities.length + " castle(s)" echo "ACCOUNT TOTALS: Found " + mycities.length + " castle(s)"
    echo "Please wait. Calculating..."
    Line 8: Line 33:
    res = GetResources("f:0")
    pop = 0
    popmax = 0
    up = 0
    Line 11: Line 40:
    if c c = c.cityManager
    if c tr = c.getAvailableTroop()
    if c echo c.name + " - " + TroopBeanToString(tr, ",")
    if c dummy = tr.addTo(t)
    if c goto mainLoop
    if !c goto end
    c = c.cityManager
    tr = c.getAvailableTroop()
    up = up + c.resource.troopCostFood
    cres = c.resetEstResource()
    popmax = popmax + c.resource.maxPopulation
    pop = pop + c.resource.curPopulation
    if showcities echo "City " + c.name + " - " + TroopBeanToString(tr, ",") + " (Upkeep: " + FormatNumber(c.resource.troopCostFood) + ")\nGold: " + FormatNumber(cres.gold) + " Food: " + FormatNumber(cres.food) + " Wood: " + FormatNumber(cres.wood) + " Stone: " + FormatNumber(cres.stone) + " Iron: " + FormatNumber(cres.iron) + " Population: " + floor(pop) + " of " + floor(popmax)
    dummy = tr.addTo(t)
    dummy = cres.addTo(res)
    goto mainLoop
    Line 17: Line 52:
    echo "TOTAL TROOPS:\n" + TroopBeanToString(t, "\n") label end
    echo "===========================\nTOTAL TROOPS\n===========================\n" + TroopBeanToString(t, "\n") + "\n(Upkeep: " + FormatNumber(up) + ")\n===========================\nTOTAL RESOURCES\n===========================\nGold: " + FormatNumber(res.gold) + "\nFood: " + FormatNumber(res.food) + "\nWood: " + FormatNumber(res.wood) + "\nStone: " + FormatNumber(res.stone) + "\nIron: " + FormatNumber(res.iron) + "\n(Pop: " + FormatNumber(pop) + " of " + FormatNumber(popmax) + ")\n==========================="
    Line 20: Line 56:
    This is the same thing, only just the account totals and not individual cities included too.

    {{{
    // gets total troops in all cities
    mycities = cities.concat()
    echo "TOTAL TROOPS: Found " + mycities.length + " castle(s)"
    t = GetTroops("a:0")

    label mainLoop
    c = mycities.shift()
    if c c = c.cityManager
    if c tr = c.getAvailableTroop()
    if c dummy = tr.addTo(t)
    if c goto mainLoop

    echo "TOTAL TROOPS:\n" + TroopBeanToString(t, "\n")
    }}}
    ----
    ScriptExamples

    This script will echo your troop & resource totals for each city and for your entire account.

    THIS VERSION REQUIRES NEATBOT 3145T OR LATER.
    For older bots, use the script in the second code box below.

    // --------------------------------
    // Troop & Resource Totals
    // --------------------------------
    res = GetResources("f:0")
    troops = GetTroops("a:0")
    upkeep = 0
    cities.forEach(CreateFunction("city,ind,arr","troops.add(city.cityManager.getAvailableTroop())||city.cityManager.estResource.addTo(res)||upkeep+=city.cityManager.resource.troopCostFood"))
    echo "{CenterPad("\nTOTAL TROOPS:\n", 43, "=")}\n{TroopBeanToString(troops,"\n")}\nUpkeep:{FormatNumber(upkeep)}\n\n{CenterPad("\nTOTAL RESOURCES:\n", 52, "=")}\nGold:{FormatNumber(res.gold)}\nFood:{FormatNumber(res.food)}\nWood:{FormatNumber(res.wood)}\nStone:{FormatNumber(res.stone)}\nIron:{FormatNumber(res.iron)}"



    FOR OLDER NEATBOT VERSIONS:

    // =======================================================
    // Troop & Resource Totals For Each City & Entire Account
    // Originally by romulus
    // Requires NeatBot 3010 or later
    // =======================================================
    
    // set this to 1 if you want individual city troop/res counts displayed too, 0 if not
    showcities = 0
    
    mycities = cities.concat()
    echo "ACCOUNT TOTALS: Found " + mycities.length + " castle(s)"
    echo "Please wait. Calculating..."
    t = GetTroops("a:0")
    res = GetResources("f:0")
    pop = 0
    popmax = 0
    up = 0
    
    label mainLoop
    c = mycities.shift()
    if !c goto end
    c = c.cityManager
    tr = c.getAvailableTroop()
    up = up + c.resource.troopCostFood
    cres = c.resetEstResource()
    popmax = popmax + c.resource.maxPopulation
    pop = pop + c.resource.curPopulation
    if showcities echo "City " + c.name + " - " + TroopBeanToString(tr, ",") + " (Upkeep: " + FormatNumber(c.resource.troopCostFood) + ")\nGold: " + FormatNumber(cres.gold) + " Food: " + FormatNumber(cres.food) + " Wood: " + FormatNumber(cres.wood) + " Stone: " + FormatNumber(cres.stone) + " Iron: " + FormatNumber(cres.iron) + " Population: " + floor(pop) + " of " + floor(popmax)
    dummy = tr.addTo(t)
    dummy = cres.addTo(res)
    goto mainLoop
    
    label end
    echo "===========================\nTOTAL TROOPS\n===========================\n" + TroopBeanToString(t, "\n") + "\n(Upkeep: " + FormatNumber(up) + ")\n===========================\nTOTAL RESOURCES\n===========================\nGold: " + FormatNumber(res.gold) + "\nFood: " + FormatNumber(res.food) + "\nWood: " + FormatNumber(res.wood) + "\nStone: " + FormatNumber(res.stone) + "\nIron: " + FormatNumber(res.iron) + "\n(Pop: " + FormatNumber(pop) + " of " + FormatNumber(popmax) + ")\n==========================="


    ScriptExamples

    TroopAndResourceTotals (last edited 2015-04-26 02:36:41 by Inanna)