DeletedUser
Guest
Etter masse svette og sene kvelder så klarte jeg endelig å få fikset masse rekrutterings scriptet. Scriptet skal nå fungere i alle verdener uavhengig av nettlesere eller hastighet på Internett og computer. For at dere skal kunne bruke dette scriptet så må dere nå legge inn et helt splitter nytt script.
Her er selve scriptet:
[SPOIL]
[/SPOIL]
Om man spiller på verden 16 eller andre fremtidige verdener uten bueskyttere så må man endre dette:[SPOIL]
til dette
[/SPOIL]
Troppeantallet føres inn her:[SPOIL]
[/SPOIL]
Håper dette hjelper dere.
Takk til Kristure
Her er selve scriptet:
[SPOIL]
Kode:
javascript:[COLOR="Red"]var archers=true;[/COLOR][COLOR="Blue"]var configuration=[0,0,6000,0,3000,0,400,0,0,0];[/COLOR]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 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;}if(document.URL.match('screen=train')&&document.URL.match('mode=mass')){var records=document.getElementById('mass_train_table').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]&&records[r].cells[3+i].childNodes[3].disabled==false){var ibox=records[r].cells[3+i].childNodes[3];try{ibox.value=parseInt(number,10);}catch(e){alert(e);}}}}}stop();}else{alert('Script only works on the mass recruitment page');}
Om man spiller på verden 16 eller andre fremtidige verdener uten bueskyttere så må man endre dette:[SPOIL]
Kode:
[COLOR="Red"]var archers=true;[/COLOR]
Kode:
[COLOR="Red"]var archers=false;[/COLOR]
Troppeantallet føres inn her:[SPOIL]
Kode:
[COLOR="Blue"]var configuration=[0,0,6000,0,3000,0,400,0,0,0];[/COLOR]
Kode:
[COLOR="Blue"]var configuration=[SPYD,SVERD,ØKS,BUE,SPEIDERE,LK,RB,HC,RAM,KAT];[/COLOR]
Håper dette hjelper dere.
Takk til Kristure
Sist redigert av en moderator: