Skip to content

Army and Defense Collection Script

Server Tribal Wars Forum Allowed Code
tribalwars.net https://forum.tribalwars.net/index.php?threads/collect-troops-script.292893/ YES Code on GitHub (v2.1)
plemiona.pl https://forum.plemiona.pl/index.php?threads/zbi%C3%B3rka-wojska-i-obrony.128630/ YES Code on GitHub (v2)

Warning

Using on other language versions of the game where the script is not allowed by the support may result in account suspension. Use at your own risk.

Army and Defense Collection Script
javascript: var COLLECT_TROOPS_DATA_V2 = {
    cache: true,
    cacheTime: 5,
    removedPlayers: "",
    allowedPlayers: "",
    firstLineTroops: "",
    showFirstLineTroops: false,
    showNicknamesTroops: false,
    firstLineDeff: "",
    showFirstLineDeff: false,
    showNicknamesDeff: false,
    language: "en",
};
$.getScript("https://rafsaf.github.io/scripts_tribal_wars/collect_troops_v2.1.js");
void 0;
Army and Defense Collection Script
javascript: var COLLECT_TROOPS_DATA_V2 = {
    cache: true,
    cacheTime: 5,
    removedPlayers: "",
    allowedPlayers: "",
    firstLineTroops: "",
    showFirstLineTroops: false,
    showNicknamesTroops: false,
    firstLineDeff: "",
    showFirstLineDeff: false,
    showNicknamesDeff: false,
    language: "en",
};
$.getScript("https://media.innogamescdn.com/com_DS_PL/skrypty/Zbiorka_wojska_i_obrony.js");
void 0;

Installation

It proceeds identically as with all scripts for the bar; you need to paste the content into a newly created script for the bar in the game.

Usage Instructions

  1. Create a script for the bar, click it
  2. Wait for the result
  3. Go to the selected schedule
  4. Paste the data and confirm

Example output of the script

Description

After clicking, a "counter" with progress appears in the middle of the screen, then the result in a window. It works in both the Army and Defense tabs. The default settings for copying have cache set to true and cacheTime to 5 minutes. During this time, the script outputs the result saved in the browser instead of flying around all members and collecting data anew. In case of doubt whether we are dealing with a new or old result, the collection date appears at the bottom.

The data generated by running the script should be pasted into the schedule on the site.

Options:

Configuration takes place by using object COLLECT_TROOPS_DATA_V2. Note every parameter IS OPTIONAL, if both variables are undefined or are defined, but there are no keys there, sensible defaults will be used.

  • cache: (default: true) is responsible for storing the result in the browser so as not to accidentally click a few times in a row and load the game servers, setting cache: false causes not to store the result (eg, when we intend to collect data from two tribes jumping immediately to the other). Note if the tribe has huge amount of villages, it may take way too much storage in localStorage (~max 5MB), beacuse of that limit is 1MB, if output is > 1MB, save to localStorage will be skipped.

  • cacheTime: (default: 5) is the time of storing the result in the browser, in minutes.

  • removedPlayers: (default: "") here we enter the nicknames of players from whom we do not want to collect troops info, separating with semicolons as in the messages in game, e.g. "Rafsaf;kmic;someoneelse"

  • allowedPlayers: (default: "") here we enter the nicknames of players from whom ONLY! (if it's empty, all players in the tribe will be used) we want to collect troops info, separating with semicolons as in the messages in game, e.g. "Rafsaf;kmic;someoneelse"

  • language: (default: "pl") this should be "en" or "pl", if anything different is used, script will use english

  • showNicknamesTroops: (default: false) when set to true cause that at each line appears at its beginning additionally the nickname of the player, applies only in Troops tab, similar to showNicknamesDeff

  • showFirstLineTroops: (default: false) when set to true cause that at result additional line at the top will be added, that is specified by firstLineDeff variable, applies only in Troops tab, similar to showFirstLineDeff

  • firstLineTroops: (default: "") line that will be showed at the result top when showFirstLineTroops is true, applies only in Troops tab, similar to showNicknamesDeff

  • showNicknamesDeff: (default: false) when set to true cause that at each line appears at its beginning additionally the nickname of the player, applies only in Defence tab, similar to showNicknamesTroops

  • showFirstLineDeff: (default: false) when set to true cause that at result additional line at the top will be added, that is specified by firstLineDeff variable, applies only in Defence tab, similar to showFirstLineTroops

  • firstLineDeff: (default: "") line that will be showed at the result top when showFirstLineTroops is true, applies only in Defence tab, similar to firstLineTroops