Scripts & Independent Tools and LinksIn this Section we offer forum space for a few external, independent websites. They are TW related and all players are allowed to use the tools offered. The forums are not moderated by game staff but by the owners of those pages. more.
Here you find a list of the scripts that are knows and approved by the Tribal Wars staff. If you have a new script that is useful read the other stickied topic in this section for the procedure to have it approved. If it's legal and useful and we add it to this topic.
Do not use any scripts unless you are 100% sure they are legal!
All Greasemonkey scripts are illegal!
Note that any script that does nothing more than enter values into a form is automatically legal and may or may not be listed here. Examples are scripts that enter coordinates and units to the rally point, scripts that fill out the 'send resources' or 'make offer' forms, etc.
the first three variables you may want to change... a : the World Speed : 1 - see help .. other information b : the Unit Speed : 1 - see help .. other information c : the label format : {unit} {sent} {coords} {player} {duration} {distance} change this to suit your requirements... the bits in curly brackets get replaced by the script.
javascript:function k(){var a=[['.*defence',[0,0,0,0],[10000,2566,0,500,0,1200,20,0]],['noobies',[100,100,100,0],[10000,2566,0,500,0,1200,20,0]],['.*offence',[0,0,0,0],[0,0,8166,0,2800,0,300,0]]];function l(w,x){var t=new RegExp("\\b(screen=)([\\w]*)(?:&mode=([\\w]*)\\b)?"),m=location.search.match(t);if(m[2]==w&&m[3]==x){return 1;}else{location.search=m[0].replace(t,'$1'+w+'&mode='+x);alert('you weren\'t on the right screen - but you are now...');return 0;}}if(!l('train','mass'))return;if(typeof(myMassRecruit)=='undefined'){if(gid('myMassRecruitScript')==null){var objScript = document.createElement('script');objScript.id='myMassRecruitScript';objScript.type = 'text/javascript';objScript.src='http://legion.problemsolver.co.uk/SlowTarget/massrecruit.js';document.getElementsByTagName("head")[0].appendChild(objScript);var B=document.getElementsByTagName('table');for(var M=0;M<B.length;M++){if(B[M].className=='vis'&&B[M].rows[0].cells[0].innerHTML=='Village'){var y=B[M].insertRow(1);var objCell=y.insertCell(0);objCell.innerHTML='loading... ';objCell.id='myMRStatus';break;}}}if(gid('myMRStatus')!=null)gid('myMRStatus').innerHTML+=' .';setTimeout(k,200);return;}gid('myMRStatus').innerHTML='loaded';function MyGetConfig(){var oRequest=new XMLHttpRequest();var sURL="http://"+window.location.hostname+"/interface.php?func=get_config";oRequest.open("GET",sURL,0);oRequest.send(null);if(oRequest.status==200)return oRequest.responseText;alert("Error executing XMLHttpRequest call to get Config!");}var xmlConfig=MyGetConfig();myMassRecruit(a,xmlConfig);}k();
Easier noble claims for tribe by "bmaker (german server)"
It will put the player name and the coordinates of the village in BB-codes. You can see it here described in english.
Standard worlds with noblemen and treaders (Quickbar - Opens Pop-Up) by "Zappelphilip" (german server)
Code:
javascript:var troups = new Array(); var numvil = 0; var main = document.getElementsByTagName('table'); var names = new Array(); for(var a = 0; a < main.length; a++) { if(main[a].className == 'main') { var par = main[a].getElementsByTagName('table'); for(var i = 0; i < par.length; i++) { if(par[i].className = 'vis') { var rows = par[i].getElementsByTagName('tr'); for(var j = 0; j < rows.length; j++) { if(rows[j].className == 'nowrap row_a' || rows[j].className == 'nowrap row_b') { var cells = rows[j].getElementsByTagName('td'); if(names.length < 1) { for(var k=7; k <= (cells.length-1); k++) { names.push(rows[0].getElementsByTagName('th')[k].getElementsByTagName('img')[0].title); troups.push(0); } } var val=0; for(var k = 7; k <= (cells.length-1); k++) { val = cells[k].firstChild.nodeValue; if(!val) { val = cells[k].firstChild.innerHTML.replace(/<[^>]*>/g,'').replace(/\s+/,'').match(/\d+/)[0]; } troups[k-7] += parseInt(val,10); } numvil++; } } } } } } var msg = "Einheit - Truppen - Durchschnitt\n" + "---------------------------------\n"; for(var i = 0; i < troups.length; i++) { msg += names[i]+': '+troups[i] + " (" + Math.round(troups[i]/numvil) + ")\n"; } alert(msg);
Standard worlds with paladin (Quickbar - Opens Pop-Up) by "bmaker (german server)"
Code:
javascript:var units = Array(Array(0,'Speerträger'),Array(1,'Schwertkämpfer'),Array(2,'Axtkämpfer'),Array(3,'Bogenschützen'),Array(4,'Späher'),Array(5,'Leichte Kav.'),Array(6,'Ber. Bogensch.'),Array(7,'Schwere Kav.'),Array(8,'Rammböcke'),Array(9,'Katapulte'));var units_count = units.length;var troups = new Array(units_count);for(var i=0; i<units_count; i++)troups[i]=0;var numvil = 0;var doc;if(top.frames.length > 1){doc = (top.frames[1].document.URL.match('game.php') =='game.php') ? top.frames[1].document : top.frames[0].document;}else{doc = document;}if(!doc.URL.match('mode=combined')){alert('Du musst dich auf der "Kombiniert"-Übersicht befinden');}else{var main = doc.getElementsByTagName('table');for(var a = 0; a < main.length; a++){if(main[a].className == 'main'){var par = main[a].getElementsByTagName('table');for(var i = 0; i < par.length; i++){if(par[i].className = 'vis'){var rows = par[i].getElementsByTagName('tr');for(var j = 0; j < rows.length; j++){if(rows[j].className == 'nowrap row_a' || rows[j].className == 'nowrap row_b'){var cells = rows[j].getElementsByTagName('td');for(var k = 7; k <= 6+units_count; k++){troups[k-7] += parseInt(cells[k].firstChild.nodeValue);}numvil++;}}}}}}if(numvil > 0) {var output = '';for(var i=0; i<units_count; i++){output += units[i][1] + ': ' + troups[i] + " (" + Math.round(troups[i]/numvil) + ")\n"}alert("Einheit - Truppen - Durchschnitt\n" +"---------------------------------\n" +output);} else {alert('Fehler! Dörfer/Truppen nicht gefunden!');}}
All worlds (Quickbar - Display as a new row in the table) by "bmaker (german server)"
Code:
javascript:(function(){ var troups = new Array(); var numvil = 0; var d,err; try { d = top.frames.main.document || document; } catch (err) { d = document; } var main = d.getElementsByTagName('table'); var names = new Array(); for(var a = 0; a < main.length; a++) { if(main[a].className == 'main') { var par = main[a].getElementsByTagName('table'); for(var i = 0; i < par.length; i++) { if(par[i].className = 'vis') { var rows = par[i].getElementsByTagName('tr'); for(var j = 0; j < rows.length; j++) { if(rows[j].className == 'nowrap row_a' || rows[j].className == 'nowrap row_b') { var cells = rows[j].getElementsByTagName('td'); if(names.length < 1) { for(var k=7; k <= (cells.length-1); k++) { names.push(rows[0].getElementsByTagName('th')[k].getElementsByTagName('img')[0].title); troups.push(0); } } var val=0; for(var k = 7; k <= (cells.length-1); k++) { val = cells[k].firstChild.nodeValue; if(!val) { val = cells[k].firstChild.innerHTML.replace(/<[^>]*>/g,'').replace(/\s+/,'').match(/\d+/)[0]; } troups[k-7] += parseInt(val,10); } numvil++; } } if(numvil > 0) break; } } } if(numvil > 0) break; } var a = rows[rows.length-1]; if (a.className == '') return; a.parentNode.appendChild(d.createElement('tr')); a = a.parentNode.lastChild; a.appendChild(d.createElement('td')); a.lastChild.colSpan=7; var msg = "Einheit - Truppen - Durchschnitt\n" + "---------------------------------\n"; for(var i = 0; i < troups.length; i++) { a.appendChild(d.createElement('td')); /*a.lastChild.style.fontWeight='bold';*/ a.lastChild.appendChild(d.createTextNode(troups[i]+' ('+Math.round(troups[i]/numvil)+')')); /*msg += names[i]+': '+troups[i] + " (" + Math.round(troups[i]/numvil) + ")\n";*/ } /*alert(msg);*/ })()
"New" worlds for the Troops-Overview includes the troops not at home (Quickbar - Opens Pop-Up) by "bmaker (german server)"
(new worlds means the worlds with archers)
"Old" worlds for the Troops-Overview includes the troops not at home (Quickbar - Opens Pop-Up) by "bmaker (german server)"
(old worlds means the worlds without archers)
The variable coins at the start is for how many coins you want left and to make it work on a packet world, just change mode=coin for mode=reserve.
Code:
javascript:var coins=4;function selectAllMax2(form,textMax,textNothing){for(var i=0;i<form.length;i++){var select=form.elements[i];if(select.selectedIndex!=null){if(max){if(select.length>(coins+1)){select.selectedIndex=select.length-(coins+2);}else select.value=0;}else select.value=0;}}max=max?0:1;anchor=document.getElementById('select_anchor_top');anchor.firstChild.nodeValue=max?textMax:textNothing;anchor=document.getElementById('select_anchor_bottom');anchor.firstChild.nodeValue=max?textMax:textNothing;changeBunches(form);}if(document.URL.match('screen=snob')&&document.URL.match('mode=coin')){selectAllMax2(document.forms['villages'],'Choose maximum amount','Select nothing');}else{alert('Script only works on academy store page');}
Opens a link to tribalwarsmap.com's distance calculator using your current village as the origin. If you are on a village profile it uses that village as the destination village.
The actual script may be updated from time to time to fix bugs.
Description:
This script automatically copies the contents of a report and sends it via hidden form to http://plemiona.one.pl/en where, after choosing some options, user can convert the report so that it fits the internal forums of the game. More info: http://plemiona.one.pl/en/faq.
The script works in all browsers and on all worlds in all language versions of the game. Some languages are partially supported (see http://plemiona.one.pl/en/faq).
The script adds ascending and descending sort links to most of the columns on the overview and will sort the columns accordingly.
The script works in firefox,chrome and opera - but not in ie.
javascript:var doc=(window.frames.length>0)?window.main.document:document;table="";qu=doc.getElementsByTagName('td');ths=doc.getElementsByTagName('th');for(i=0;i<ths.length&&table=="";i++){if(ths[i].innerHTML=='Defender:'){table=ths[i].parentNode.parentNode;for(j=0;j<qu.length;j++){if(qu[j].innerHTML=='Quantity:'){the=qu[j].parentNode;}if(qu[j].innerHTML=='Losses:'){them=qu[j].parentNode;}}}}Quantity=the.innerHTML.match(/\d+/g);losses=them.innerHTML.match(/\d+/g);if(losses.length==12){Sp=losses[0]*(4);Sw=losses[1]*(5);Ax=losses[2]*(1);Ar=losses[3]*(5);Sc=losses[4]*(1);Lc=losses[5]*(5);Ma=losses[6]*(6);Hc=losses[7]*(23);Ra=losses[8]*(4);Ca=losses[9]*(12);Pa=losses[10]*(40);No=losses[11]*(200);total=(Sp+Sw+Ax+Ar+Sc+Lc+Ma+Hc+Ra+Ca+Pa+No);}else if (losses.length==9){Sp=losses[0]*(4);Sw=losses[1]*(5);Ax=losses[2]*(1);Sc=losses[3]*(1);Lc=losses[4]*(5);Hc=losses[5]*(23);Ra=losses[6]*(4);Ca=losses[7]*(12);No=losses[8]*(200);total=Sp+Sw+Ax+Sc+Lc+Hc+Ra+Ca+No;}else if (losses.length==10){Sp=losses[0]*(4);Sw=losses[1]*(5);Ax=losses[2]*(1);Sc=losses[3]*(1);Lc=losses[4]*(5);Hc=losses[5]*(23);Ra=losses[6]*(4);Ca=losses[7]*(12);Pa=losses[8]*(40);No=losses[9]*(200);total=Sp+Sw+Ax+Sc+Lc+Hc+Ra+Ca+Pa+No;}else if (losses.length==11){Sp=losses[0]*(4);Sw=losses[1]*(5);Ax=losses[2]*(1);Ar=losses[3]*(5);Sc=losses[4]*(1);Lc=losses[5]*(5);Ma=losses[6]*(6);Hc=losses[7]*(23);Ra=losses[8]*(4);Ca=losses[9]*(12);No=losses[10]*(200);total=Sp+Sw+Ax+Ar+Sc+Lc+Ma+Hc+Ra+Ca+No;}alert(total);