DeletedUser
Guest
Jel ima neko prilagodjene skripte da ih postavi negdi na forumu da ih mozemo copy-paste u brzi izbornik
I've now had several people to ask me to translate it so that it works in their language.
To cater for all, I'm going to show you how to translate it, as it would simply take too long to translate it for everyone that might want it.
This means that those of you wanting to bring this script to your tribalwars will need to do the following:
There are a few lines you must search for...
1. Find this...
Code:if (candidates[t].rows[0].cells[0].innerHTML=='Village'){
Replace the word "village" with the word the game uses for village (for example, "dorf" in Deutsch).
2. Find this...
Code:if (archers){ units=['spear','sword','axe','archer','spy','light','marcher','heavy','ram','catapult']; unitsNET=['Spear Fighter','Swordsman','Axeman','Archer','Scout','Light Cavalry','Mounted Archer', 'Heavy Cavalry','Ram','Catapult']; costs=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6], [300,200,200,5],[320,400,100,8]]; } else{ units=['spear','sword','axe','spy','light','heavy','ram','catapult']; unitsNET=['Spear Fighter','Swordsman','Axeman','Scout','Light Cavalry','Heavy Cavalry','Ram','Catapult']; costs=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]]; }
The unitsNET are the ones that need to be translated.
They must be translated to the name the game uses for them.
For example, on the Brazilian tribalwars, you would have the following...
Code:if (archers){ units=['spear','sword','axe','archer','spy','light','marcher','heavy','ram','catapult']; unitsNET=['Lanceiro','Espadachim','Bárbaro','Archer','Explorador','Cavalaria leve','Arqueiro a cavalo', 'Cavalaria Pesada','Ar�*ete','Catapulta']; costs=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6], [300,200,200,5],[320,400,100,8]]; } else{ units=['spear','sword','axe','spy','light','heavy','ram','catapult']; unitsNET=['Lanceiro','Espadachim','Bárbaro','Explorador','Cavalaria leve','Cavalaria Pesada','Ar�*ete','Catapulta']; costs=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]]; }
(translations according to SoMbRa)
That's it... that's all you need to change.
And, you can change any of the mass recruitment scripts on this page in the same exact way!
Notes:
You will need to put them back into the one line version.
If you have trouble translating, post here the translations for each unit name and the translation of the word village (as used by the game), and then either myself or one of the others that frequent this forum will help you put together the script. - make sure you tell us which version of the script you want translated (just a link to the post it's in will suffice).
javascript:var%20configuration=[3900,0,0,3900,100,0,0,2000,0,25];var%20archers=true;var%20units;var%20unitsNET;var%20costs;function%20arrayMin(array){var%20value=array[0];for%20(var%20t=1;t<array.length;t++){if%20(array[t]<value){value=array[t];}}return%20value;}function%20linearDivideArray(array1,%20array2){var%20value=[];if%20(array1.length==array2.length){for%20(var%20t=0;t<array1.length;t++){if%20(array2[t]!=0){value[t]=array1[t]*1.0/array2[t];}else{value[t]=0;}}}return%20value;}function%20linearAddArray(array1,array2){var%20value=[];if%20(array1.length==array2.length){for%20(var%20t=0;t<array1.length;t++){value[t]=array1[t]+array2[t];}}%20return%20value;}function%20getUnitId(unit){for%20(var%20t=0;t<units.length;t++){if%20(unit%20==%20unitsNET[t]){return%20t;}}return%20-1;}function%20getTagsSubset(tagname,classname){var%20subset_t=document.getElementsByTagName(tagname);var%20subset_c=[];var%20u=0;for%20(var%20t=0;t<subset_t.length;t++){if%20(subset_t[t].className==classname){subset_c[u++]=subset_t[t];}}return%20subset_c;}function%20getTable(){var%20candidates=getTagsSubset('table',%20'vis');%20var%20t;%20for%20(t=0;t<candidates.length;t++){try%20{if%20(candidates[t].rows[0].cells[0].innerHTML=='Selo'){break;}}catch%20(e){}}return%20candidates[t];}function%20getQueue(record){var%20value=[0,0,0,0,0,0,0,0,0,0];for%20(var%20u=3;u<record.cells.length;u++){try{value[u%20-%203]=parseInt(record.cells.childNodes[1].childNodes[1].firstChild.title,10);}catch%20(e){}if%20(isNaN(value[u%20-%203])){value[u%20-%203]=0;}}return%20value;}function%20getResources(record){var%20value=[0,0,0,0];var%20res=record.cells[1].textContent.split("\n");var%20farm=record.cells[2].innerHTML.split('/');value[0]=parseInt(res[1].replace(".",""),10);value[1]=parseInt(res[2].replace(".",""),10);value[2]=parseInt(res[3].replace(".",""),10);value[3]=farm[1]-farm[0];return%20value;}function%20getProduced(record){var%20value=[0,0,0,0,0,0,0,0,0,0];for%20(var%20u=3;u<record.cells.length;u++){try{value[u%20-%203]=parseInt(record.cells.childNodes[1].textContent.split("\n")[2],10);}catch%20(e){}if%20(isNaN(value[u%20-%203])){value[u%20-%203]=0;}}return%20value;}function%20submitForm(){var%20candidates=document.getElementsByTagName("input");var%20t;for%20(t=0;t<candidates.length;t++){if%20(candidates[t].type=="submit"){break;}}candidates[t].click();}if%20(document.URL.match('screen=train')&&document.URL.match('mode=mass')){var%20records=getTable().rows;if%20(archers){units=['spear','sword','axe','archer','spy','light','marcher','heavy','ram','catapult'];unitsNET=['Kopljanik','Mačevalac','Sjekiraš','Strijelac','Izviđač','Laka Konjica','Brzi Strijelac','Teška Konjica','Ovan','Katapult'];costs=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6],%20[300,200,200,5],[320,400,100,8]];}else{units=['spear','sword','axe','spy','light','heavy','ram','catapult'];unitsNET=['Kopljanik','Mačevalac','Sjekiraš','Izviđač','Laka Konjica','Teška Konjica','Ovan','Katapult'];%20costs=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]];}for%20(r=1;r<records.length;r++){var%20subconf=[];var%20total_costs=[0,0,0,0];var%20i;var%20resources=getResources(records[r]);var%20queue=getQueue(records[r]);var%20produced=getProduced(records[r]);for%20(i=0;i<units.length;i++){subconf=configuration-(queue+produced);if%20(subconf<0){subconf=0;}for%20(var%20j=0;j<4;j++){total_costs[j]+=costs[j]*subconf;}};var%20factor=arrayMin(linearDivideArray(resources,total_costs));if%20(factor>1.0){factor=1.0;}for%20(i=0;i<units.length;i++){var%20number=subconf*factor;if%20(number<0){number=0;}if%20(records[r].cells[3%20+%20i].childNodes[3]){var%20ibox=records[r].cells[3%20+%20i].childNodes[3];try{ibox.defaultValue=parseInt(number,10);}catch%20(e){}}}}stop();}else{alert('Script%20only%20works%20on%20the%20mass%20recruitment%20page');}
1. ...if (candidates[t].rows[0].cells[0].innerHTML=='Village')...
2. units=['spear','sword','axe','archer','spy','light','marcher','heavy','ram','catapult'];
unitsNET=['Spear Fighter','Swordsman','Axeman','Archer','Scout','Light Cavalry','Mounted Archer', 'Heavy Cavalry','Ram','Catapult'];
{units = ['spear', 'sword', 'axe', 'spy', 'light', 'heavy', 'ram', 'catapult'];unitsNET = ['Spear Fighter', 'Swordsman', 'Axeman', 'Scout', 'Light Cavalry', 'Heavy Cavalry', 'Ram', 'Catapult'];
<th width="120">Selo </th>
javascript: var configuration = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];var archers = true;var units;var unitsNET;var costs;function arrayMin(array) {var value = array[0];for (var t = 1; t < array.length; t++) {if (array[t] < value) {value = array[t];}}return value;}function linearDivideArray(array1, array2) {var value = [];if (array1.length == array2.length) {for (var t = 0; t < array1.length; t++) {if (array2[t] != 0) {value[t] = array1[t] * 1.0 / array2[t];} else {value[t] = 0;}}}return value;}function linearAddArray(array1, array2) {var value = [];if (array1.length == array2.length) {for (var t = 0; t < array1.length; t++) {value[t] = array1[t] + array2[t];}}return value;}function getUnitId(unit) {for (var t = 0; t < units.length; t++) {if (unit == unitsNET[t]) {return t;}}return -1;}function getTagsSubset(tagname, classname) {var subset_t = document.getElementsByTagName(tagname);var subset_c = [];var u = 0;for (var t = 0; t < subset_t.length; t++) {if (subset_t[t].className == classname) {subset_c[u++] = subset_t[t];}}return subset_c;}function getTable() {var candidates = getTagsSubset('table', 'vis');var t;for (t = 0; t < candidates.length; t++) {try {if (candidates[t].rows[0].cells[0].innerHTML == 'Selo ') {break;}} catch(e) {}}return candidates[t];}function getQueue(record) {var value = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];for (var u = 3; u < record.cells.length; u++) {try {value[u - 3] = parseInt(record.cells[u].childNodes[1].childNodes[1].firstChild.title, 10);} catch(e) {}if (isNaN(value[u - 3])) {value[u - 3] = 0;}}return value;}function getResources(record) {var value = [0, 0, 0, 0];var res = record.cells[1].textContent.split("\n");var farm = record.cells[2].innerHTML.split('/');value[0] = parseInt(res[1].replace(".", ""), 10);value[1] = parseInt(res[2].replace(".", ""), 10);value[2] = parseInt(res[3].replace(".", ""), 10);value[3] = farm[1] - farm[0];return value;}function getProduced(record) {var value = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];for (var u = 3; u < record.cells.length; u++) {try {value[u - 3] = parseInt(record.cells[u].childNodes[1].textContent.split("\n")[2], 10);} catch(e) {}if (isNaN(value[u - 3])) {value[u - 3] = 0;}}return value;}function submitForm() {var candidates = document.getElementsByTagName("input");var t;for (t = 0; t < candidates.length; t++) {if (candidates[t].type == "submit") {break;}}candidates[t].click();}if (document.URL.match('screen=train') && document.URL.match('mode=mass')) {var records = getTable().rows;if (archers) {units = ['spear', 'sword', 'axe', 'archer', 'spy', 'light', 'marcher', 'heavy', 'ram', 'catapult'];unitsNET = ['Spear Fighter', 'Swordsman', 'Axeman', 'Archer', 'Scout', 'Light Cavalry', 'Mounted Archer', 'Heavy Cavalry', 'Ram', 'Catapult'];costs = [[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[100, 30, 60, 1],[50, 50, 20, 2],[125, 100, 250, 4],[250, 100, 150, 5],[200, 150, 600, 6],[300, 200, 200, 5],[320, 400, 100, 8]];} else {units = ['spear', 'sword', 'axe', 'spy', 'light', 'heavy', 'ram', 'catapult'];unitsNET = ['Spear Fighter', 'Swordsman', 'Axeman', 'Scout', 'Light Cavalry', 'Heavy Cavalry', 'Ram', 'Catapult'];costs = [[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[50, 50, 20, 2],[125, 100, 250, 4],[200, 150, 600, 6],[300, 200, 200, 5],[320, 400, 100, 8]];}for (r = 1; r < records.length; r++) {var subconf = [];var total_costs = [0, 0, 0, 0];var i;var resources = getResources(records[r]);var queue = getQueue(records[r]);var produced = getProduced(records[r]);for (i = 0; i < units.length; i++) {subconf[i] = configuration[i] - (queue[i] + produced[i]);if (subconf[i] < 0) {subconf[i] = 0;}for (var j = 0; j < 4; j++) {total_costs[j] += costs[i][j] * subconf[i];}};var factor = arrayMin(linearDivideArray(resources, total_costs));if (factor > 1.0) {factor = 1.0;}for (i = 0; i < units.length; i++) {var number = subconf[i] * factor;if (number < 0) {number = 0;}if (number != 0) {if (records[r].cells[3 + i].childNodes[3]) {var ibox = records[r].cells[3 + i].childNodes[3];try {ibox.defaultValue = parseInt(number, 10);} catch(e) {}}}}}stop();} else {alert('Script only works on the mass recruitment page');}
E svaka ti dala care. Radi.