Example for group / train templates:
It is not the most easy one, but should make you understand all the different settings/possibilities.
We will use the default group templates:
PHP Code:
<groups>
<group id="off"
priority="0">
<by-unit>axe,light,marcher,ram,catapult</by-unit>
</group>
<group id="def-inf"
priority="1">
<by-unit>spear,sword,archer</by-unit>
</group>
<group id="def-horse"
priority="0">
<by-unit>spear,heavy</by-unit>
</group>
</groups>
off: offensive villages.
def-inf: defensive infantry villages.
def-horse: defensive heavy cavalry villages.
We are using "by-unit" selectors to determine which villages belong to which group.
For each village, this selector will check how many of the village's total units are of the specified unit type(s). If this percantage is above 85%, the village will be considered to be part of the defined group.
Notice how "def-horse" has a lower priority than "def-inf" because there are villages that will possibly match both groups. In this case, the group with the LOWER priority will be used.
Let's say we have 4 villages with the following units:
Village 1 "foo":
5.000 axe
Village 2 "bar":
1000 spear
100 heavy cavalry
Village 3 "nsa":
5000 spy
Village 4 "tolerance":
500 spear
500 sword
100 axe
Village 1 will match the "off" group, because 100% of the village's units are axe. Any of the unit types will be counted.
The other villages will not match that group because they have not enough % of the required units.
Village 2 will match "def-inf" and "def-horse" because it has so many spears. The priority will be used later.
The "nsa" village does not match any group (besides the "default" group which is predefined and includes every village).
Village 4 will match "def-inf". It has some axe as well, but is inside the "by-unit tolerance" (85% of all units must match).
We can now define train templates to let the bot recruit new units.
For training, it makes sense to set troops to recruit based on the groups we defined above.
PHP Code:
<templates>
<train group="off">
<units>
<axe>6500</axe>
<light>3100</light>
<ram>320</ram>
</units>
<buffer>
<wood>13370</wood>
<stone>13370</stone>
<iron>4200</iron>
</buffer>
</train>
<train group="def-inf">
<units>
<spear>10000</spear>
<sword>10000</sword>
</units>
<buffer>
<pop>400</pop>
</buffer>
</train>
<train group="def-horse">
<units>
<spear>8000</spear>
<heavy>2000</heavy>
</units>
</train>
</templates>
Things to note here: Every train template needs a group (id) attribute. If you only have one village, you can use group="default".
For each train template, you enter units to train inside the "units" tag. DSX will recruit units until these values are reached, but will never "delete/crash" units.
So just like with build templates, you are entering final/max numbers. DSX will then choose which units to recruit (usually those with the largest missing %).
In the buffer section, you can make the bot leave a certain amout of resources. For example, in the "off" template, DSX will always leave at least (13370|13370|4200) in your storage.
Btw: pop = population / farm space.
As you see in the last train template, buffer settings are completely optional.
Now what happens when DSX tries to recruit units?
It will loop through all your villages and try to find a fitting template for each by group.
Assuming we still have the 4 villages as shown above:
The bot will use the "off" template for village 1, and the "def-inf" template for village 4, good

NSA is still not matching any other group than "default". Because we have not defined a train template for this group, the bot will skip that village when training.
Village 2 will match the group "def-inf" and "def-horse". Taking a look at our train templates, we can see that there is a template for both groups. How will the bot decide which template to use for this village?
Remember the priority we set in group definitions earlier? Because "def-horse" has a lower priority than "def-inf", DSX will use the "def-horse" template for village 2, recruiting the correct units.
That's it for this example. As always, just respond to this topic if you have any questions
-------------------------------------------------------------------------
Der Error kommt von der Stämme API und sollte den Bot eig nicht abstürzen lassen... einfach nach ein Paar Minuten nochmal versuchen
There is a detailed error description. You have a format error inside the xml file. The exception text will tell you the exact line number where the problem is, even in your own language.
Check your screens or read the example above
