RedAlert

Senior In-Game Staff
Tribal Wars Team
Senior
Team
Script Moderator
Reaction score
623
Author
RedAlert
Contributors
N/A
Quickbar Entry
javascript:$.getScript('https://twscripts.dev/scripts/massSnipe.js');
Public?
Public
1673704045351.png

This script can be run on every screen.

The script has capabilities to auto-add new incomings to be sniped by clicking on an incoming while you are on the incomings screen, or by clicking on an incoming attack or outgoing command if you are on the info village screen.

Whenever the "Calculate Times" button is clicked all the user input (selected units and incomings to be sniped) are saved so next time the script is run the script will be pre-populated, making it easier to snipe.

Also, the script has some nice features like:

1673650386314.png

So, it shows on page title, the nearest snipe to be sent and when only 10 seconds remain from the nearest snipe, the script will make a chat sound to remind the player that there is a command to be sent.

However, the chat sound and well game sounds in general sometimes are not reliable, so you should be very cautious to not miss sending snipes.

You can also export the output to BB code to save that on Notepad.

One of the important features of the script is the Mass Import feature. You can copy paste the whole text FROM A FORUM THREAD and the script will parse the text, extract villages under attack with nobles and find the destination village and landing times and automatically import them on the script.

This feature is smart enough that will filter out old trains that have already landed and will only import on the script trains that haven't landed yet.

Sigil amount is not entered 1.2 when the travel speed modifier is 20%, it's entered 20, just 20. If the travel speed modifier is 16%, then enter 16 and so on.
The Min. Amount field is to be used if you want to filter out for example, 10 spears. If you want to send only big amounts of def, example 2000 spears, then set the Min. Amount to 2000. This value, same as Sigil, is set on village level, so you can have different values for different villages :)

This is the format the support request on forum needs to have for it to be parsed correctly by the script:

1674173920304.png

Wall level, loyalty, troop amounts, are not required to be there, no matter if they are or not, the script will still successfully parse the text. When it comes to the incs themselves, you might have antis between the nobles, the script will parse only noble landing times. If you have multiple trains landing on same village on different times it will add them twice on the script.

This script will only work on .net and .us markets.

Here is how the script looks like in practice:



For any bugs, suggestions or if you need help with the script, let me know by replying on the thread.
 
Last edited:
Upvote 3

Escudo de Espinho

New Member
Reaction score
2
Hi RedAlert.

Great work.

I tried to use it on BR116 (I know it is not on that market), but it didn't work. Not sure if it is a bug or if Chrome will not be supported.

Reproduction steps: (Run on any screen)

Running on debug mode, the error occurs when it tries to set the oversized item into the localStorage:


localStorage.setItem(`${entity}`, JSON.stringify(data)); Error: Uncaught DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of 'village' exceeded the quota. at eval (eval at fetchDataAndSave (https://twscripts.dev/scripts/twSDK.js?_=1674318353290:1239:6), <anonymous>:1:14) at fetchDataAndSave (https://twscripts.dev/scripts/twSDK.js?_=1674318353290:1239:6) at async Object.worldDataAPI (https://twscripts.dev/scripts/twSDK.js?_=1674318353290:1261:25) at async fetchWorldConfigData (https://twscripts.dev/scripts/massSnipe.js?_=1674318353293:1164:30) at async Object.success (https://twscripts.dev/scripts/massSnipe.js?_=1674318353293:102:41)

Screen Shot 2023-01-21 at 11.51.45 AM.png

Please, let me know if you need more information.

Thank you!

PS: I can only use it after clearing all local storage, but I can't accommodate other scripts.
PS2: Is it not available on BR due to server costs?
PS3: It works on Opera
PS4: I bought a coffee for you :D
 

RedAlert

Senior In-Game Staff
Tribal Wars Team
Senior
Team
Script Moderator
Reaction score
623
Hello @Escudo de Espinho ,

The error that shows up unfortunately is not server side related. It is instead browser based :(

What happens is that all these game date like villages, allies, players, etc are saved on local browser memory, called localStorage.

Now localStorage has a limit. Here you can see the localStorage limit of your browser:


1674335496290.png

This means that the browser can save up to 5 megabytes of content on a localStorage key.

So what happens here is that you can't actually save data for nearly 60k villages on localStorage.

I will see if I can improve this in the future, probably by splitting the big array of villages into smaller chunks and saving the chunks instead of saving the whole thing or ... I might try with compression techniques such a gzip-ing before saving.

The other thing is that currently the script can only be used on the US and NET market because it requires translations to be able to work on different markets (otherwise parts of the script like auto import will not work) and also I noticed a big spike in usage on the host recently so trying to keep that under control for the moment.

Thank you for the donation :)
 

tullkuken

New Member
Reaction score
0
i struggle to understand the format, i either get parse error or no trains discovered. Why not make it accept the regular request help format or the format from your tag tool?
 

RedAlert

Senior In-Game Staff
Tribal Wars Team
Senior
Team
Script Moderator
Reaction score
623
i struggle to understand the format, i either get parse error or no trains discovered. Why not make it accept the regular request help format or the format from your tag tool?
Could you elaborate a bit more? It shows that when you try to mass import or what?

What do you consider as regular request help format?

Pls share a screenshot of the forum thread containing the text you select and want to import and it does not work, or share as bbcode (if it shows personal info feel free to reach out via Discord).
 

tullkuken

New Member
Reaction score
0
Could you elaborate a bit more? It shows that when you try to mass import or what?

What do you consider as regular request help format?

Pls share a screenshot of the forum thread containing the text you select and want to import and it does not work, or share as bbcode (if it shows personal info feel free to reach out via Discord).
Sorry it seems like its working perfectly, it was user error on my part. It worked fine when I tag and tested on my own village. I did try to change a forum post to be accepted by the script.

I couldn't make the script accept it, I just wonder what makes the script read it properly?
attack.png
example 02 (475|541) K54 --> Arrival time: Mar 09, 2023 04:51:10:149 example
attack.png
example 02 (475|541) K54 --> Arrival time: Mar 09, 2023 04:51:10:249 example
attack.png
example 02 (475|541) K54 --> Arrival time: Mar 09, 2023 04:51:10:349 example
attack.png
example 02 (475|541) K54 --> Arrival time: Mar 09, 2023 04:51:10:449 example
attack.png
noble example 02 (475|541) K54 --> Arrival time: Mar 09, 2023 04:51:10:149 example
attack.png
noble example 02 (475|541) K54 --> Arrival time: Mar 09, 2023 04:51:10:249 example
attack.png
noble example 02 (475|541) K54 --> Arrival time: Mar 09, 2023 04:51:10:349 example
attack.png
noble example 02 (475|541) K54 --> Arrival time: Mar 09, 2023 04:51:10:449 example
attack.png
snob.png
noble 02 example 02 (475|541) K54 --> Arrival time: Mar 10, 2023 04:51:10:149 example
attack.png
snob.png
noble 02 example 02 (475|541) K54 --> Arrival time: Mar 10, 2023 04:51:10:249 example
attack.png
snob.png
noble 02 example 02 (475|541) K54 --> Arrival time: Mar 10, 2023 04:51:10:349 example
attack.png
snob.png
noble 02 example 02 (475|541) K54 --> Arrival time: Mar 10, 2023 04:51:10:449 example
 

RedAlert

Senior In-Game Staff
Tribal Wars Team
Senior
Team
Script Moderator
Reaction score
623
In order for the script to parse all the needed info correctly the format needs to be like this:

1678377358723.png

So here is also shown the village under attack, which is important since otherwise the script does not know where the attacks are landing. In this format the script can parse the village under attack and the landing time also.

On the examples you shared, none of them has the village under attack part shown, so the script wouldn't be able to parse any info at all from that text.
 

RedAlert

Senior In-Game Staff
Tribal Wars Team
Senior
Team
Script Moderator
Reaction score
623
any chance of adding this to .PT server? very good script :)
@Escudo de Espinho ,

The script can now be used on all servers, of course you should check first with the support team of the server if the script can be actually used there or not but I removed the server block on my side.

Hope you like the script and feel free to suggest improvements.
 

wellcome

Member
Reaction score
0
hello, I'm having trouble importing snips in bulk, is it something in the format of the forum? in my own villages I can do it, but those on the forum, from allies, I have to do it manually. Here's the format I'm trying to import:
Aldeia: W. 49 (367|319) K33
Nível da muralha: 0
Lealdade: 100

Defensor: 0 0 0 0 0 0 0 0 0 0 0 0 0

attack_large.png
snob.png
Nobre SNIPADO W. 24 (370|316) K33 --> Horário de chegada: ago. 17, 2023 17:16:16:795 Jr710
attack_medium.png
snob.png
Nobre SNIPADO W. 24 (370|316) K33 --> Horário de chegada: ago. 17, 2023 17:16:16:995 Jr710
attack_medium.png
snob.png
Nobre SNIPADO W. 24 (370|316) K33 --> Horário de chegada: ago. 17, 2023 17:16:17:195 Jr710
attack_medium.png
snob.png
Nobre SNIPADO W. 24 (370|316) K33 --> Horário de chegada: ago. 17, 2023 17:16:17:395 Jr710

Aldeia: Z. 26 (368|318) K33
Nível da muralha: 20
Lealdade: 100

Defensor: 0 6 0 1 490 0 0 0 0 0 0 0 0

attack_large.png
Aríete DESVIAR W. 12 (373|308) K33 --> Horário de chegada: ago. 17, 2023 17:19:13:417 Jr710
attack_large.png
snob.png
nobre snpado W. 23 (373|316) K33 --> Horário de chegada: ago. 17, 2023 17:53:37:542 Jr710
attack_medium.png
snob.png
nobre snpado W. 23 (373|316) K33 --> Horário de chegada: ago. 17, 2023 17:53:37:742 Jr710
attack_medium.png
snob.png
nobre snpado W. 23 (373|316) K33 --> Horário de chegada: ago. 17, 2023 17:53:37:942 Jr710
attack_medium.png
snob.png
nobre snpado W. 23 (373|316) K33 --> Horário de chegada: ago. 17, 2023 17:53:38:142 Jr710


Ps:

I know that the script doesn't take snips that the nobles have already hit, I took this one as an example only, but I tested it today, in the same pattern, and it says that no trains were found
 

RedAlert

Senior In-Game Staff
Tribal Wars Team
Senior
Team
Script Moderator
Reaction score
623
hello, I'm having trouble importing snips in bulk, is it something in the format of the forum? in my own villages I can do it, but those on the forum, from allies, I have to do it manually. Here's the format I'm trying to import:
Aldeia: W. 49 (367|319) K33
Nível da muralha: 0
Lealdade: 100

Defensor: 0 0 0 0 0 0 0 0 0 0 0 0 0

attack_large.png
snob.png
Nobre SNIPADO W. 24 (370|316) K33 --> Horário de chegada: ago. 17, 2023 17:16:16:795 Jr710
attack_medium.png
snob.png
Nobre SNIPADO W. 24 (370|316) K33 --> Horário de chegada: ago. 17, 2023 17:16:16:995 Jr710
attack_medium.png
snob.png
Nobre SNIPADO W. 24 (370|316) K33 --> Horário de chegada: ago. 17, 2023 17:16:17:195 Jr710
attack_medium.png
snob.png
Nobre SNIPADO W. 24 (370|316) K33 --> Horário de chegada: ago. 17, 2023 17:16:17:395 Jr710

Aldeia: Z. 26 (368|318) K33
Nível da muralha: 20
Lealdade: 100

Defensor: 0 6 0 1 490 0 0 0 0 0 0 0 0

attack_large.png
Aríete DESVIAR W. 12 (373|308) K33 --> Horário de chegada: ago. 17, 2023 17:19:13:417 Jr710
attack_large.png
snob.png
nobre snpado W. 23 (373|316) K33 --> Horário de chegada: ago. 17, 2023 17:53:37:542 Jr710
attack_medium.png
snob.png
nobre snpado W. 23 (373|316) K33 --> Horário de chegada: ago. 17, 2023 17:53:37:742 Jr710
attack_medium.png
snob.png
nobre snpado W. 23 (373|316) K33 --> Horário de chegada: ago. 17, 2023 17:53:37:942 Jr710
attack_medium.png
snob.png
nobre snpado W. 23 (373|316) K33 --> Horário de chegada: ago. 17, 2023 17:53:38:142 Jr710


Ps:

I know that the script doesn't take snips that the nobles have already hit, I took this one as an example only, but I tested it today, in the same pattern, and it says that no trains were found
Seems to me like you are using the script on the PT or BR server. The script checks for 2 strings, "Noble" and "Village:". So from what I see in this example Noble has been substituted with Nobre and Village: with Aldeia: ... which makes the mass snipe parser not parse correctly information from the forum.

The script needs to be properly translated into PT/BR language in order to fully support the mass snipe parsing capability.
 

wellcome

Member
Reaction score
0
I understood. What do you need to add this translation? I can translate and you implement it, what do you think?
 

natanprog

Member
Reaction score
11
JavaScript:
pt_BR: {
            'Mass Snipe': 'Snip em massa',
            Help: 'Ajuda',
            'There was an error!': 'Ocorreu um erro!',
            'There was an error while fetching the data!':
                'Ocorreu um erro ao buscar os dados!',
            'Redirecting...': 'Redirecionando...',
            'There was an error fetching villages by group!':
                'Ocorreu um erro ao buscar aldeias no grupo!',
            'An error occured while fetching troop counts!':
                'Ocorreu um erro ao buscar a quantidade de tropas!',
            Village: 'Aldeia',
            'Landing Time': 'Hora de chegada',
            Sigil: 'Afli\u00e7\u00e3o',
            'Min. Amount': 'Quantidade m\u00edn.',
            Action: 'A\u00e7\u00e3o',
            'Add new Snipe': 'Add novo snip',
            'Calculate Times': 'Calcular tempos',
            From: 'Origem',
            To: 'Destino',
            Unit: 'Unidade',
            Distance: 'Dist\u00e2ncia',
            'Launch Time': 'Hora de sa\u00edda',
            'Send in': 'Enviar em',
            Send: 'Enviar',
            'No possible snipe options found!':
                'Nenhuma op\u00e7\u00e3o poss\u00edvel de snip encontrada!',
            'combinations found': 'combina\u00e7\u00f5es encontradas',
            'Export as BB Code': 'Exportar como C\u00f3digo BB',
            'Nothing to export!': 'Nada para exportar!',
            'Copied on clipboard!': 'Copiado na \u00e1rea de transfer\u00eancia!',
            Command: 'Comando',
            Status: 'Status',
            'Reset Script': 'Redefinir script',
            'Script configuration has been reset!':
                'A configura\u00e7\u00e3o do script foi redefinida!',
            'Already exists!': 'J\u00e1 existe!',
            'Mass Import': 'Import. em massa',
            'Paste text here from a forum thread':
                'Cole aqui o texto de um t\u00f3pico do f\u00f3rum',
            'There has been an error while parsing the text!':
                'Ocorreu um erro ao analisar o texto!',
            'No trains could be found!': 'Nenhum noble train foi encontrado!',
            'This field can not be empty!': 'Este campo n\u00e3o pode ficar vazio!',
            // string identifiers which need to be translated for text parser to identify them on other languages
            Noble: 'Nobre',
            'Village:': 'Aldeia:',
        },
Let me know if you need anything else so that the text parser works correctly in the BR market.
 
Last edited:

RedAlert

Senior In-Game Staff
Tribal Wars Team
Senior
Team
Script Moderator
Reaction score
623
JavaScript:
pt_BR: {
            'Mass Snipe': 'Snip em massa',
            Help: 'Ajuda',
            'There was an error!': 'Ocorreu um erro!',
            'There was an error while fetching the data!':
                'Ocorreu um erro ao buscar os dados!',
            'Redirecting...': 'Redirecionando...',
            'There was an error fetching villages by group!':
                'Ocorreu um erro ao buscar aldeias no grupo!',
            'An error occured while fetching troop counts!':
                'Ocorreu um erro ao buscar a quantidade de tropas!',
            Village: 'Aldeia',
            'Landing Time': 'Hora de chegada',
            Sigil: 'Afli\u00e7\u00e3o',
            'Min. Amount': 'Quantidade m\u00edn.',
            Action: 'A\u00e7\u00e3o',
            'Add new Snipe': 'Add novo snip',
            'Calculate Times': 'Calcular tempos',
            From: 'Origem',
            To: 'Destino',
            Unit: 'Unidade',
            Distance: 'Dist\u00e2ncia',
            'Launch Time': 'Hora de sa\u00edda',
            'Send in': 'Enviar em',
            Send: 'Enviar',
            'No possible snipe options found!':
                'Nenhuma op\u00e7\u00e3o poss\u00edvel de snip encontrada!',
            'combinations found': 'combina\u00e7\u00f5es encontradas',
            'Export as BB Code': 'Exportar como C\u00f3digo BB',
            'Nothing to export!': 'Nada para exportar!',
            'Copied on clipboard!': 'Copiado na \u00e1rea de transfer\u00eancia!',
            Command: 'Comando',
            Status: 'Status',
            'Reset Script': 'Redefinir script',
            'Script configuration has been reset!':
                'A configura\u00e7\u00e3o do script foi redefinida!',
            'Already exists!': 'J\u00e1 existe!',
            'Mass Import': 'Import. em massa',
            'Paste text here from a forum thread':
                'Cole aqui o texto de um t\u00f3pico do f\u00f3rum',
            'There has been an error while parsing the text!':
                'Ocorreu um erro ao analisar o texto!',
            'No trains could be found!': 'Nenhum noble train foi encontrado!',
            'This field can not be empty!': 'Este campo n\u00e3o pode ficar vazio!',
            // string identifiers which need to be translated for text parser to identify them on other languages
            Noble: 'Nobre',
            'Village:': 'Aldeia:',
        },
Let me know if you need anything else so that the text parser works correctly in the BR market.
Translation has been added. Thank you!
 

wellcome

Member
Reaction score
0
I tried to use the version now with the translation, when importing the commands from the forum it says that an error occurred when parsing the text

1692849200007.png

IMPORTED TEXT:

Aldeia: RED-010 (324|451) K43
Nível da muralha: 20


Nobre CHICO (326|488) K43 --> Horário de chegada: ago. 24, 2023 09:30:53:060 Aleixo65
Nobre CHICO (326|488) K43 --> Horário de chegada: ago. 24, 2023 09:30:53:260 Aleixo65
Nobre CHICO (326|488) K43 --> Horário de chegada: ago. 24, 2023 09:30:53:460 Aleixo65
Nobre CHICO (326|488) K43 --> Horário de chegada: ago. 24, 2023 09:30:53:660 Aleixo65
 

RedAlert

Senior In-Game Staff
Tribal Wars Team
Senior
Team
Script Moderator
Reaction score
623
I tried to use the version now with the translation, when importing the commands from the forum it says that an error occurred when parsing the text

View attachment 12360

IMPORTED TEXT:

Aldeia: RED-010 (324|451) K43
Nível da muralha: 20


Nobre CHICO (326|488) K43 --> Horário de chegada: ago. 24, 2023 09:30:53:060 Aleixo65
Nobre CHICO (326|488) K43 --> Horário de chegada: ago. 24, 2023 09:30:53:260 Aleixo65
Nobre CHICO (326|488) K43 --> Horário de chegada: ago. 24, 2023 09:30:53:460 Aleixo65
Nobre CHICO (326|488) K43 --> Horário de chegada: ago. 24, 2023 09:30:53:660 Aleixo65
You will need to provide some more info like a screenshot of the browser console so I can see where the error is happening. Please reach out to me via Discord. It's better if you share private info via Discord DMs so you don't compromise your game.
 

jaro

Active Member
Reaction score
6
Its not working for me also..
Trains not found when importing text

im on the spanish server, and we use noble as noble trains.. so idk



es_ES: {
'Mass Snipe': 'Snip en masa',
Help: 'Ayuda',
'There was an error!': 'Ocurrió un error!',
'There was an error while fetching the data!':
'Se produjo un error al obtener los datos!',
'Redirecting...': 'Redireccionando...',
'There was an error fetching villages by group!':
'Se produjo un error al buscar pueblos por grupo.!',
'An error occured while fetching troop counts!':
'Se produjo un error al obtener el recuento de tropas.!',
Village: 'Pueblo',
'Landing Time': 'Hora de llegada',
Sigil: 'Sigil',
'Min. Amount': 'Cantidad mínima',
Action: 'Acción',
'Add new Snipe': 'Añadir nuevo snip',
'Calculate Times': 'Calcular tiempos',
From: 'Origen',
To: 'Destino',
Unit: 'Unidad',
Distance: 'Distancia',
'Launch Time': 'Hora de salida',
'Send in': 'Mandar',
Send: 'Enviar',
'No possible snipe options found!':
'No hay snips posibles!',
'combinations found': 'Combinaciones encontradas',
'Export as BB Code': 'Exportar como Código BB',
'Nothing to export!': 'Nada para exportar!',
'Copied on clipboard!': 'Copiado portapapeles!',
Command: 'Orden',
Status: 'Status',
'Reset Script': 'Resetear script',
'Script configuration has been reset!':
'La configuracion se ha reseteado!',
'Already exists!': 'Ya existe!',
'Mass Import': 'Importar en masa',
'Paste text here from a forum thread':
'Coloque aquí el texto del foro',
'There has been an error while parsing the text!':
'Ocurrió un error la analizar el texto!',
'No trains could be found!': 'Ningún tren encontrado!',
'This field can not be empty!': 'Este campo no puede estar vacio!',
// string identifiers which need to be translated for text parser to identify them on other languages
Noble: 'Noble',
'Village:': 'Pueblo:',
},
 
Last edited:
Top