TribalWars Forum
 
Go Back   TribalWars Forum > Community Section > Scripts & Independent Tools and Links
Scripts & Independent Tools and Links In 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.

Closed Thread
 
Thread Tools Search this Thread
hoodoo
Innogames Product Consultant
 
hoodoo's Avatar
 
Join Date: 2006,May 9th
Old #1   2008,July 16th, 17:50   Top
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.

Scout Report Evaluator
More Information Here
Code:
javascript:var timeDifference=0;var worldSpeed=1;var unitSpeed=1;var farmingUnit='Light Cavalry';var maxToHaul=20000;var%20units%3Dnew%20Array%28%29%3B%0Aunits%5B%27Light%20Cavalry%27%5D%3Dnew%20Array%28600%2C80%2C%27light%27%29%3B%0Aunits%5B%27Axe%27%5D%3Dnew%20Array%281080%2C10%2C%27axe%27%29%3B%0Aunits%5B%27Heavy%20Cavalry%27%5D%3Dnew%20Array%28660%2C50%2C%27heavy%27%29%3B%0Aunits%5B%27Mounted%20Archer%27%5D%3Dnew%20Array%28660%2C50%2C%27marcher%27%29%3B%0Aunits%5B%27Spear%27%5D%3Dnew%20Array%281080%2C25%2C%27spear%27%29%3B%0Aunits%5B%27Paladin%27%5D%3Dnew%20Array%28600%2C100%2C%27knight%27%29%3B%0AunitOfChoice%3Dunits%5BfarmingUnit%5D%3B%0Avar%20warehouseMax%3Dnew%20Array%281000%2C1229%2C1512%2C1859%2C2285%2C2810%2C3454%2C4247%2C5222%2C6420%2C7893%2C9705%2C11932%2C14670%2C18037%2C22177%2C27266%2C33523%2C41217%2C50675%2C62305%2C76604%2C94184%2C115798%2C142373%2C175047%2C215219%2C264611%2C325337%2C400000%29%3B%0Avar%20productionPerHour%3Dnew%20Array%2830%2C35%2C41%2C47%2C55%2C64%2C74%2C86%2C100%2C117%2C136%2C158%2C184%2C214%2C249%2C289%2C337%2C391%2C455%2C530%2C616%2C717%2C833%2C959%2C1127%2C1311%2C1525%2C1774%2C2063%2C2400%29%3B%0Avar%20hidingPlace%3Dnew%20Array%28150%2C200%2C267%2C356%2C474%2C632%2C843%2C1125%2C1500%2C2000%29%3B%0A%0Avar%20months%3Dnew%20Array%28%22January%22%2C%22February%22%2C%22March%22%2C%22April%22%2C%22May%22%2C%22June%22%2C%22July%22%2C%22August%22%2C%22September%22%2C%22October%22%2C%22November%22%2C%22December%22%29%3B%0A%0Afunction%20createCookie%28name%2Cvalue%2Cdays%29%20%7B%0A%09if%20%28days%29%20%7B%0A%09%09var%20date%20%3D%20new%20Date%28%29%3B%0A%09%09date.setTime%28date.getTime%28%29+%28days*24*60*60*1000%29%29%3B%0A%09%09var%20expires%20%3D%20%22%3B%20expires%3D%22+date.toGMTString%28%29%3B%0A%09%7D%0A%09else%20var%20expires%20%3D%20%22%22%3B%0A%09document.cookie%20%3D%20name+%22%3D%22+value+expires+%22%3B%20path%3D/%22%3B%0A%7D%0A%0Afunction%20readCookie%28name%29%20%7B%0A%09var%20nameEQ%20%3D%20name%20+%20%22%3D%22%3B%0A%09var%20ca%20%3D%20document.cookie.split%28%27%3B%27%29%3B%0A%09for%28var%20i%3D0%3Bi%20%3C%20ca.length%3Bi++%29%20%7B%0A%09%09var%20c%20%3D%20ca%5Bi%5D%3B%0A%09%09while%20%28c.charAt%280%29%3D%3D%27%20%27%29%20c%20%3D%20c.substring%281%2Cc.length%29%3B%0A%09%09if%20%28c.indexOf%28nameEQ%29%20%3D%3D%200%29%20return%20c.substring%28nameEQ.length%2Cc.length%29%3B%0A%09%7D%0A%09return%20null%3B%0A%7D%0A%0Afunction%20getCoordinates%28theString%29%0A%7B%0A%09theString%3DtheString.split%28%22%7C%22%29%3B%0A%09var%20x%3DtheString%5BtheString.length-2%5D%3B%0A%09var%20y%3DtheString%5BtheString.length-1%5D%3B%0A%0A%09x%3Dx.split%28%22%28%22%29%3B%0A%09x%3Dx%5Bx.length-1%5D%3B%0A%09y%3Dy.split%28%22%29%22%29%3B%0A%09y%3Dy%5B0%5D%3B%0A%09var%20coordinates%3Dnew%20Array%28x%2Cy%29%3B%0A%09return%20coordinates%3B%0A%7D%0A%0Afunction%20getLevel%28building%29%0A%7B%0A%0A%09var%20tRow%3Ddocument.getElementsByTagName%28%27tr%27%29%3B%0A%09for%28i%3D0%3Bi%3CtRow.length%3Bi++%29%0A%09%7B%0A%09%09var%20thead%3DtRow%5Bi%5D.getElementsByTagName%28%27th%27%29%5B0%5D%3B%0A%09%09if%28thead%29%0A%09%09%7B%0A%09%09%09if%28thead.firstChild.nodeValue%3D%3D%3D%27Buildings%3A%27%29%0A%09%09%09%7B%0A%09%09%09%09%0A%09%09%09%09var%20text%3DtRow%5Bi%5D.getElementsByTagName%28%27td%27%29%5B0%5D%3B%0A%09%09%09%09text%3Dtext.innerHTML%3B%0A%09%09%09%09text%3Dtext.split%28%22%3Cbr%3E%22%29%3B%0A%09%09%09%09for%28j%3D0%3Bj%3Ctext.length%3Bj++%29%0A%09%09%09%09%7B%0A%09%09%09%09%09var%20line%3Dtext%5Bj%5D%3B%0A%09%09%09%09%09%0A%09%09%09%09%09if%28line.search%28building%29%21%3D%20-1%29%0A%09%09%09%09%09%7B%0A%09%09%09%09%09%09%0A%09%09%09%09%09%09var%20level%3Dline.split%28%22%29%22%29%3B%0A%09%09%09%09%09%09%0A%09%09%09%09%09%09level%3Dlevel%5B0%5D.split%28%22%20%22%29%3B%0A%09%09%09%09%09%09level%3Dlevel%5Blevel.length-1%5D%3B%0A%09%09%09%09%09%09return%20level%3B%0A%09%09%09%09%09%09break%3B%0A%09%09%09%09%09%09%0A%09%09%09%09%09%7D%0A%09%09%09%09%09%0A%09%09%09%09%7D%0A%09%09%09%09return%200%3B%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%09%0A%09%09%0A%7D%0A%0Afunction%20checkOverflow%28amount%2Cwarehouse%2C%20hiding%29%0A%7B%0A%09var%20amount%3DparseInt%28amount%29%3B%0A%09%0A%09var%20max%3DwarehouseMax%5Bwarehouse-1%5D-hidingPlace%5Bhiding-1%5D%3B%0A%09%0A%09if%28amount%3Emax%29%0A%09%7B%0A%09%09return%20max%3B%0A%09%7D%0A%09else%0A%09%7B%0A%09%09return%20amount%3B%0A%09%7D%0A%7D%0A%0Afunction%20getDurationInSeconds%28originX%2C%20originY%2C%20targetX%2C%20targetY%2C%20speed%2C%20unitSpeed%2C%20unit%29%0A%7B%0Avar%20x%3DoriginX-targetX%3B%0Avar%20y%3DoriginY-targetY%3B%0Avar%20fields%3DMath.sqrt%28%28x*x%29+%28y*y%29%29%3B%0Avar%20overallSpeed%3Dspeed*unitSpeed%3B%0Avar%20secondsPerField%3Dunit/overallSpeed%3B%0A%0Avar%20duration%3DMath.round%28secondsPerField*fields%29%3B%0Areturn%20duration%3B%0A%7D%0A%0Afunction%20getInnerHTMLString%28tableHeader%29%0A%7B%0A%09var%20tbls%3Ddocument.getElementsByTagName%28%27table%27%29%3B%0A%09for%28var%20i%3D0%3Bi%3Ctbls.length%3Bi++%29%0A%09%7B%0A%09%09var%20thead%3Dtbls%5Bi%5D.getElementsByTagName%28%27th%27%29%5B0%5D%3B%0A%09%09if%28thead%29%0A%09%09%7B%0A%09%09%09if%28thead.firstChild.nodeValue%3D%3D%3DtableHeader%29%0A%09%09%09%7B%0A%09%09%09%09var%20village%3Dtbls%5Bi%5D%3B%0A%09%09%09%09var%20row%3Dvillage.getElementsByTagName%28%27tr%27%29%5B1%5D%3B%0A%09%09%09%09var%20cell%3Drow.getElementsByTagName%28%27td%27%29%5B1%5D%3B%0A%09%09%09%09cell%3Dcell.innerHTML%3B%0A%09%09%09%09return%20cell%3B%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A%0A%0Afunction%20elapsedTime%28dateString%2C%20timeDifference%29%0A%7B%0A%09%0A%09var%20dThen%3DDate.parse%28dateString%29%3B%0A%09var%20dNow%3Dnew%20Date%28%29%3B%0A%09dNow%3DdNow.getTime%28%29%3B%0A%09dNow%3DdNow-%28%28timeDifference*3600%29*1000%29%3B%0A%09%0A%09var%20minutes%3D%28%28dNow-dThen%29/1000%29/60%3B%0A%09var%20elapsedHours%3DMath.floor%28minutes/60%29%3B%0A%09var%20elapsedMinutes%3Dminutes%2560%3B%0A%09%0A%09return%20minutes%3B%0A%09%0A%09%0A%7D%0A%0A%0Afunction%20timeOfReport%28%29%0A%7B%0A%09%0A%09var%20tRow%3Ddocument.getElementsByTagName%28%27tr%27%29%3B%0A%09for%28i%3D0%3Bi%3CtRow.length%3Bi++%29%0A%09%7B%0A%09%09var%20tCell%3DtRow%5Bi%5D.getElementsByTagName%28%27td%27%29%3B%0A%09%09if%28tCell%5B0%5D%29%0A%09%09%7B%0A%09%09%09if%28tCell%5B0%5D.innerHTML%3D%3D%3D%22Sent%22%29%0A%09%09%09%7B%0A%09%09%09%09sentTime%3DtCell%5B1%5D.innerHTML%3B%0A%09%09%09%09return%20sentTime%3B%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%7D%0A%7D%0A%0Afunction%20sameVillage%28%29%0A%7B%0A%09var%20anchors%3Ddocument.getElementsByTagName%28%27a%27%29%3B%0A%09for%28i%3D0%3Bi%3Canchors.length%3Bi++%29%0A%09%7B%0A%09%09if%28anchors%5Bi%5D.firstChild.nodeValue%3D%3D%3D%27Paste%20quantities%20of%20surviving%20troops%20into%20simulator%27%29%0A%09%09%7B%0A%09%09%09var%20theLink%3Danchors%5Bi%5D.getAttribute%28%27href%27%29%3B%0A%09%09%09theLink%3DtheLink.split%28%22%26%22%29%3B%0A%09%09%09return%20theLink%5B0%5D%3B%0A%09%09%7D%0A%09%7D%0A%7D%0A%0Afunction%20originalVillage%28%29%0A%7B%0A%09var%20tbls%3Ddocument.getElementsByTagName%28%27table%27%29%3B%0A%09for%28var%20i%3D0%3Bi%3Ctbls.length%3Bi++%29%0A%09%7B%0A%09%09var%20thead%3Dtbls%5Bi%5D.getElementsByTagName%28%27th%27%29%5B0%5D%3B%0A%09%09if%28thead%29%0A%09%09%7B%0A%09%09%09if%28thead.firstChild.nodeValue%3D%3D%3D%27Attacker%3A%27%29%0A%09%09%09%7B%0A%09%09%09%09var%20defVill%3Dtbls%5Bi%5D%3B%0A%09%09%09%09var%20anchor%3DdefVill.getElementsByTagName%28%27a%27%29%3B%0A%09%09%09%09anchor%3Danchor%5Banchor.length-1%5D%3B%0A%09%09%09%09var%20link%3Danchor.getAttribute%28%27href%27%29%3B%0A%09%09%09%09link%3Dlink.split%28%22%3D%22%29%3B%0A%09%09%09%09link%3Dlink%5Blink.length-1%5D%3B%0A%09%09%09%09return%20%22/game.php%3Fvillage%3D%22+link%3B%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A%0A%0Afunction%20targety%28%29%0A%7B%0A%09var%20tbls%3Ddocument.getElementsByTagName%28%27table%27%29%3B%0A%09for%28var%20i%3D0%3Bi%3Ctbls.length%3Bi++%29%0A%09%7B%0A%09%09var%20thead%3Dtbls%5Bi%5D.getElementsByTagName%28%27th%27%29%5B0%5D%3B%0A%09%09if%28thead%29%0A%09%09%7B%0A%09%09%09if%28thead.firstChild.nodeValue%3D%3D%3D%27Defender%3A%27%29%0A%09%09%09%7B%0A%09%09%09%09var%20defVill%3Dtbls%5Bi%5D%3B%0A%09%09%09%09var%20anchor%3DdefVill.getElementsByTagName%28%27a%27%29%3B%0A%09%09%09%09anchor%3Danchor%5Banchor.length-1%5D%3B%0A%09%09%09%09var%20link%3Danchor.getAttribute%28%27href%27%29%3B%0A%09%09%09%09link%3Dlink.split%28%22%3D%22%29%3B%0A%09%09%09%09link%3Dlink%5Blink.length-1%5D%3B%0A%09%09%09%09return%20link%3B%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%09%0A%0Afunction%20removeHTMLTags%28strInputCode%29%7Breturn%20strInputCode.replace%28/%3C%5C/%3F%5B%5E%3E%5D+%28%3E%7C%24%29/g%2C%22%22%29%3B%7D%0A%0A%0Afunction%20production%28mine%29%0A%7B%0A%09if%28mine%3D%3D%3D0%29%0A%09%7B%0A%09return%205/60%3B%09%0A%09%7D%0A%09else%0A%09%7B%0A%09%09return%20productionPerHour%5Bmine-1%5D/60%3B%0A%09%7D%0A%7D%0A%0Afunction%20scoutReportClick%28%29%0A%7B%0A%09%0A%09var%20target%3DgetCoordinates%28getInnerHTMLString%28%22Defender%3A%22%29%29%3B%0A%09var%20targetX%3Dtarget%5B0%5D%3B%0A%09var%20targetY%3Dtarget%5B1%5D%3B%0A%09%0A%09var%20warehouse%3DgetLevel%28/warehouse/i%29%3B%0A%09var%20hidingPlace%3DgetLevel%28/hiding%20place/i%29%3B%0A%09%0A%09%0A%09var%20timberCamp%3DgetLevel%28/timber%20camp/i%29%3B%0A%09var%20woodPerMin%3D%28production%28timberCamp%29*worldSpeed%29%3B%0A%09var%20clayPit%3DgetLevel%28/clay%20pit/i%29%3B%0A%09var%20clayPerMin%3D%28production%28clayPit%29*worldSpeed%29%3B%0A%09var%20ironMine%3DgetLevel%28/iron%20mine/i%29%3B%0A%09var%20ironPerMin%3D%28production%28ironMine%29*worldSpeed%29%3B%0A%09%0A%09var%20elapsedTimeInMins%3DMath.ceil%28elapsedTime%28timeOfReport%28%29%2C%20timeDifference%29%29%3B%0A%09%0A%09var%20trow%3Ddocument.getElementsByTagName%28%27tr%27%29%3B%0A%09for%28var%20i%3D0%3Bi%3Ctrow.length%3Bi++%29%0A%09%7B%0A%09%09var%20thead%3Dtrow%5Bi%5D.getElementsByTagName%28%27th%27%29%5B0%5D%3B%0A%09%09if%28thead%29%0A%09%09%7B%0A%09%09%09if%28thead.firstChild.nodeValue%3D%3D%3D%27Resources%20scouted%3A%27%29%0A%09%09%09%7B%0A%09%09%09%09var%20tcell%3Dtrow%5Bi%5D.getElementsByTagName%28%27td%27%29%5B0%5D%3B%0A%09%09%09%09var%20finText%3DremoveHTMLTags%28tcell.innerHTML%29%3B%0A%09%09%09%09finText%3DfinText.replace%28/%5C./gi%2C%22%22%29%3B%0A%09%09%09%09finText%3DfinText.split%28%22%20%22%29%3B%0A%09%09%09%09var%20wood%3DparseInt%28finText%5B0%5D%29%3B%0A%09%09%09%09var%20clay%3DparseInt%28finText%5B1%5D%29%3B%0A%09%09%09%09var%20iron%3DparseInt%28finText%5B2%5D%29%3B%0A%09%09%09%09var%20cookieValue%3DelapsedTimeInMins+%22%7C%22+wood+%22%7C%22+clay+%22%7C%22+iron+%22%7C%22+warehouse+%22%7C%22+hidingPlace+%22%7C%22+woodPerMin+%22%7C%22+clayPerMin+%22%7C%22+ironPerMin+%22%7C%22+targetX+%22%7C%22+targetY%3B%0A%09%09%09%09%0A%09%09%09%09%0A%09%09%09%09%0A%09%09%09%09%09createCookie%28%22booreporter%22%2C%20cookieValue%2C%201%29%3B%0A%09%09%09%09%09var%20targ%3Dtargety%28%29%3B%0A%09%09%09%09%09var%20link%3DoriginalVillage%28%29%3B%0A%09%09%09%09%09var%20url%3Dlink+%22%26screen%3Dplace%26mode%3Dcommand%26target%3D%22+targ%3B%0A%09%09%09%09%09window.open%28url%2C%27newwindow%27%2C%20config%3D%27height%3D650%2Cwidth%3D950%2C%20toolbar%3Dno%2C%20menubar%3Dno%2C%20scrollbars%3Dno%2C%20resizable%3Dyes%2Clocation%3Dno%2Cdirectories%3Dno%2C%20status%3Dno%27%29%3B%0A%09%09%09%09%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%09%0A%7D%0A%0Afunction%20getRallyPointCoords%28%29%0A%7B%0A%09var%20titleString%3Ddocument.getElementsByTagName%28%27title%27%29%5B0%5D%3B%0A%09titleString%3DtitleString.innerHTML%3B%0A%09titleString%3DtitleString.split%28%22%29%22%29%3B%0A%09titleString%3DtitleString%5BtitleString.length-2%5D%3B%0A%09titleString%3DtitleString.split%28%22%28%22%29%3B%0A%09titleString%3DtitleString%5BtitleString.length-1%5D%3B%0A%09var%20origin%3DtitleString.split%28%22%7C%22%29%3B%0A%09return%20origin%3B%0A%7D%0A%0Afunction%20checkTarget%28targetX%2C%20targetY%29%0A%7B%0A%09var%20inputs%3Ddocument.getElementsByTagName%28%27input%27%29%3B%0A%09for%28i%3D0%3Bi%3Cinputs.length%3Bi++%29%0A%09%7B%0A%09%09var%20name%3Dinputs%5Bi%5D.getAttribute%28%27name%27%29%3B%0A%09%09if%28name%3D%3D%3D%27x%27%29%0A%09%09%7B%0A%09%09%09var%20x%3Dinputs%5Bi%5D.value%3B%0A%09%09%7D%0A%09%09if%28name%3D%3D%3D%27y%27%29%0A%09%09%7B%0A%09%09%09var%20y%3Dinputs%5Bi%5D.value%3B%0A%09%09%7D%0A%09%7D%0A%09if%28%28parseInt%28targetX%29%3D%3Dx%29%20%26%26%20%28parseInt%28targetY%29%3D%3Dy%29%29%0A%09%7Breturn%201%3B%7D%0A%09else%7Breturn%20-1%3B%7D%0A%7D%0A%0Afunction%20fillUnits%28unit%2Cunitformname%2Camount%2CnumberOfScouts%29%0A%7B%0A%09var%20fields%3Ddocument.getElementsByTagName%28%27input%27%29%3B%0A%09for%28var%20i%3D0%3Bi%3Cfields.length%3Bi++%29%0A%09%7B%0A%09%09var%20thename%3Dfields%5Bi%5D.getAttribute%28%27name%27%29%3B%0A%09%09if%28thename%29%0A%09%09%7B%0A%09%09%09if%28thename%3D%3D%3D%27spy%27%29%0A%09%09%09%7B%0A%09%09%09%09var%20next%20%3D%20fields%5Bi%5D.nextSibling%3B%0A%09%09%09%09next%20%3D%20next.nextSibling%3B%0A%09%09%09%09s%20%3D%20next.firstChild.nodeValue%3B%0A%09%09%09%09s%3Ds.split%28%22%28%22%29%3B%0A%09%09%09%09s%3Ds%5Bs.length-1%5D%3B%0A%09%09%09%09scouts%3Ds.replace%28/%5C%29/g%2C%20%22%22%29%3B%0A%09%09%09%09scouts%3DparseInt%28scouts%29%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09if%28thename%3D%3D%3Dunitformname%29%20%0A%09%09%09%7B%0A%0A%09%09%09%09var%20next%20%3D%20fields%5Bi%5D.nextSibling%3B%0A%09%09%09%09next%20%3D%20next.nextSibling%3B%0A%09%09%09%09s%20%3D%20next.firstChild.nodeValue%3B%0A%09%09%09%09s%3Ds.split%28%22%28%22%29%3B%0A%09%09%09%09s%3Ds%5Bs.length-1%5D%3B%0A%09%09%09%09s%3Ds.replace%28/%5C%29/g%2C%20%22%22%29%3B%0A%09%09%09%09if%28parseInt%28s%29%3Camount%29%0A%09%09%09%09%7B%0A%09%09%09%09%09alert%28%22Not%20enough%20units.%20You%20need%20%22+amount+%22%20%22+unit%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09else%0A%09%09%09%09%7B%0A%0A%09%09%09%09%09document.forms%5B0%5D%5Bunitformname%5D.value%3Damount%3B%0A%09%09%09%09%09if%28scouts%29%0A%09%09%09%09%09%7B%0A%09%09%09%09%09if%28numberOfScouts%3E%3Dscouts%29%0A%09%09%09%09%09%7B%0A%09%09%09%09%09%09%0A%09%09%09%09%09%09alert%28%22Haul%20exceeds%20set%20maximum.%20You%20should%20send%20scouts%20but%20you%20don%27t%20have%20any%20here%21%22%29%3B%0A%09%09%09%09%09%7D%0A%09%09%09%09%09else%0A%09%09%09%09%09%7B%0A%09%09%09%09%09%09document.forms%5B0%5D.spy.value%3DnumberOfScouts%3B%0A%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%0A%09%09%09%09%09%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%09%0A%7D%0A%0Afunction%20rallyPointClick%28%29%0A%7B%0A%09var%20cookieValue%3DreadCookie%28%22booreporter%22%29%3B%0A%09cookieValue%3DcookieValue.split%28%22%7C%22%29%3B%0A%09%0A%09var%20elapsedTimeInMins%3DparseInt%28cookieValue%5B0%5D%29%3B%0A%09var%20wood%3DparseInt%28cookieValue%5B1%5D%29%3B%0A%09var%20clay%3DparseInt%28cookieValue%5B2%5D%29%3B%0A%09var%20iron%3DparseInt%28cookieValue%5B3%5D%29%3B%0A%09var%20warehouse%3DparseInt%28cookieValue%5B4%5D%29%3B%0A%09var%20hidingP%3DparseInt%28cookieValue%5B5%5D%29%3B%0A%09var%20woodPerMin%3DparseFloat%28cookieValue%5B6%5D%29%3B%0A%09var%20clayPerMin%3DparseFloat%28cookieValue%5B7%5D%29%3B%0A%09var%20ironPerMin%3DparseFloat%28cookieValue%5B8%5D%29%3B%0A%09var%20targetX%3DparseInt%28cookieValue%5B9%5D%29%3B%0A%09var%20targetY%3DparseInt%28cookieValue%5B10%5D%29%3B%0A%09%0A%09var%20check%3DcheckTarget%28targetX%2C%20targetY%29%3B%0A%09if%28check%3D%3D-1%29%0A%09%7Balert%28%22Warning%3A%20You%20have%20switched%20target%20since%20last%20using%20this%20script.%20Unable%20to%20compute%20units%20needed.%22%29%3B%7D%0A%09%0A%09var%20origin%3DgetRallyPointCoords%28%29%3B%0A%09var%20originX%3Dorigin%5B0%5D%3B%0A%09var%20originY%3Dorigin%5B1%5D%3B%0A%09%0A%09var%20durationInMinutes%3D%28Math.ceil%28getDurationInSeconds%28originX%2C%20originY%2C%20targetX%2C%20targetY%2C%20worldSpeed%2C%20unitSpeed%2C%20unitOfChoice%5B0%5D%29/60%29%29%3B%0A%09%0A%09var%20totalTimeInMinutes%3DelapsedTimeInMins+parseInt%28durationInMinutes%29%3B%0A%09var%20excessWood%3DparseInt%28Math.floor%28totalTimeInMinutes*woodPerMin%29%29%3B%0A%09var%20excessClay%3DparseInt%28Math.floor%28totalTimeInMinutes*clayPerMin%29%29%3B%0A%09var%20excessIron%3DparseInt%28Math.floor%28totalTimeInMinutes*ironPerMin%29%29%3B%0A%09%0A%09%0A%09wood%3DparseInt%28wood%29+parseInt%28excessWood%29%3B%0A%09wood%3DcheckOverflow%28wood%2C%20warehouse%2C%20hidingP%29%3B%0A%09clay%3Dclay+excessClay%3B%0A%09clay%3DcheckOverflow%28clay%2C%20warehouse%2C%20hidingP%29%3B%0A%09iron%3Diron+excessIron%3B%0A%09iron%3DcheckOverflow%28iron%2C%20warehouse%2C%20hidingP%29%3B%0A%09var%20resources%3Dwood+clay+iron%3B%0A%09if%28resources%3EmaxToHaul%29%0A%09%7B%0A%09%09var%20numberOfUnits%3DMath.ceil%28maxToHaul/unitOfChoice%5B1%5D%29%3B%0A%09%09fillUnits%28farmingUnit%2CunitOfChoice%5B2%5D%2CnumberOfUnits%2C%201%29%3B%0A%09%7D%0A%09else%0A%09%7B%0A%09%09var%20numberOfUnits%3DMath.ceil%28resources/unitOfChoice%5B1%5D%29%3B%0A%09%09fillUnits%28farmingUnit%2CunitOfChoice%5B2%5D%2CnumberOfUnits%2C%200%29%3B%0A%09%7D%0A%7D%0A%0Afunction%20main%28%29%0A%7B%0A%09var%20url%3Ddocument.URL%3B%0A%09if%28url.search%28/screen%3Dreport/%29%21%3D%20-1%29%0A%09%7B%0A%09scoutReportClick%28%29%3B%0A%09%7D%0A%09if%28url.search%28/mode%3Dcommand%26target/%29%21%3D%20-1%29%0A%09%7B%0A%09rallyPointClick%28%29%3B%0A%09%7D%0A%7D%0Amain%28%29%3B


Creating Market Offers
More Information Here

Code:
javascript:var doc=document;if(window.frames.length>0)doc=window.main.document;url=document.URL;var start=url.indexOf("village");var end=url.indexOf('%26',start);var id;if(end>0)id=url.substring(start,end);elseid=url.substring(start);if(url.indexOf('screen=market')==-1||url.indexOf('mode=own_offer')==-1)location.search='?screen=market&mode=own_offer&'+id;else {var wood=new Number(doc.getElementById('wood').innerHTML);var clay=new Number(doc.getElementById('stone').innerHTML);var iron=new Number(doc.getElementById('iron').innerHTML);var forms=doc.getElementsByTagName('form');var table="";for(i=0;i<forms.length&&table=="";i++){if(forms[i].action.indexOf('action=modify_offers')!=-1){table=forms[i].getElementsByTagName('table')[0];}}for(i=1;table!=""&&i<table.rows.length-1;i++){child=table.rows[i].cells[1].childNodes;res=child[0].title;num="";for(j=0;j<child.length;j++){value = child[j].nodeValue;if(value != null)num+=value;}num=num.substring(0,num.length-1);num*=new Number(table.rows[i].cells[2].innerHTML);if(res=='Wood')wood+=num;if(res=='Clay')clay+=num;if(res=='Iron')iron+=num;}doc.getElementById('res_sell_wood').checked=wood>clay&&wood>iron;doc.getElementById('res_sell_stone').checked=clay>wood&&clay>iron;doc.getElementById('res_sell_iron').checked=iron>clay&&iron>wood;doc.getElementById('res_buy_wood').checked=wood<clay&&wood<iron;doc.getElementById('res_buy_stone').checked=clay<wood&&clay<iron;doc.getElementById('res_buy_iron').checked=iron<clay&&iron<wood;wood=Math.round(wood/1000);clay=Math.round(clay/1000);iron=Math.round(iron/1000);offers=Math.max(Math.max(wood,clay),iron)-Math.min(Math.min(wood,clay),iron);offers=Math.round(offers/2);inputs=doc.getElementsByTagName('input');for(i=0;i<inputs.length;i++){if(inputs[i].value=='Create')inputs[i].focus();}doc.getElementsByName('multi')[0].value=offers;doc.getElementsByName('max_time')[0].value=10;doc.getElementsByName('sell')[0].value=1000;doc.getElementsByName('buy')[0].value=1000;}end();

A special case of the above script modified by slowtarget to only offer iron for clay:
Code:
javascript:var d=document;function o(a){b=location.search;c=new RegExp("\\b"+a+"\\b");if(b.match(c)){return 1;}else{location.search=b.replace(/.*?(\bvillage=\d+).*/i,'?$1&'+a);return 0;}}function r(){l=d.getElementsByTagName('table');for(j=0;j<l.length;j++){e=l[j].rows[0].cells[0].innerHTML;if(e.match(/^Merchants/)){return new Number(e.match(/(\d+)/)[1]);}}return 0;}function v(){var p=new Number(d.getElementById('stone').innerHTML);var q=new Number(d.getElementById('iron').innerHTML);var m=d.getElementsByTagName('form');var k="";for(j=0;j<m.length&&k=="";j++){if(m[j].action.indexOf('action=modify_offers')!=-1){k=m[j].getElementsByTagName('table')[0];}}for(j=1;k!=""&&j<k.rows.length-1;j++){n=k.rows[j].cells[1].childNodes;u=n[0].title;f="";for(g=0;g<n.length;g++){h=n[g].nodeValue;if(h!=null)f+=h;}f=f.substring(0,f.length-1);f*=new Number(k.rows[j].cells[2].innerHTML);if(u=='clay')p+=f;if(u=='iron')q+=f;}d.getElementById('res_sell_stone').checked=p>q;d.getElementById('res_sell_iron').checked=q>p;d.getElementById('res_buy_stone').checked=p<q;d.getElementById('res_buy_iron').checked=q<p;p=Math.round(p/1000);q=Math.round(q/1000);t=Math.max(p,q)-Math.min(p,q);t=Math.min(t,r());}function end(){i='';if(o('screen=market&mode=own_offer')){if(r()>0){t=new Number(d.getElementsByName('sell')[0].value);if(t>0){s=d.getElementsByTagName('input');for(j=0;j<s.length;j++){if(s[j].value=='Create'){s[j].click();return;}}}v();if(t==0){i='No deal';}else{d.getElementsByName('multi')[0].value=t;d.getElementsByName('max_time')[0].value=20;d.getElementsByName('sell')[0].value=1000;d.getElementsByName('buy')[0].value=1000;    if(d.getElementById('res_sell_stone').checked){    i='Don\'t sell clay';    }}}else{i='No merchants';}if(i!=''){s=d.links;for(j=0;j<s.length;j++){if(s[j].accessKey=="d"){location.href=s[j].href;return;}}}}}end();
The following script fills in the form on the 'other offers' page based on what you have and what you need.
Additional Information
Code:
javascript:var doc=document;if(window.frames.length>0)doc=window.main.document;url=document.URL;var start=url.indexOf("village");var end=url.indexOf('%26',start);var id;if(end>0)id=url.substring(start,end);elseid=url.substring(start);if(url.indexOf('screen=market')==-1||url.indexOf('mode=other_offer')==-1)location.search='?screen=market&mode=other_offer&'+id;else {var wood=new Number(doc.getElementById('wood').innerHTML);var clay=new Number(doc.getElementById('stone').innerHTML);var iron=new Number(doc.getElementById('iron').innerHTML);max=Math.max(wood,Math.max(clay,iron));min=Math.min(wood,Math.min(clay,iron));sell=doc.getElementsByName('res_sell')[0];buy=doc.getElementsByName('res_buy')[0];if(max==wood)buy.value='wood';if(max==clay)buy.value='stone';if(max==iron)buy.value='iron';if(min==wood)sell.value='wood';if(min==clay)sell.value='stone';if(min==iron)sell.value='iron';}end();


Sending "Fakes" Script
More Information Here

Code:
javascript:coords='623|234 234|658';var%20doc=document;if(window.frames.length>0)doc=window.main.document;url=document.URL;if(url.indexOf('screen=place')==-1)alert('This%20script%20needs%20to%20be%20run%20from%20the%20rally%20point');coords=coords.split("%20");index=Math.round(Math.random()*(coords.length-1));coords=coords[index];coords=coords.split("|");doc.forms[0].x.value=coords[0];doc.forms[0].y.value=coords[1];insertUnit(doc.forms[0].ram,%201);end();


Moving Quickbar Items
More Information Here

Code:
javascript:function%20startJS(){return%20"javascript:var%20doc=document;if(window.frames.length>0)doc=document.main;"}var%20doc=document;if(window.frames.length>0)doc=document.main;url=document.URL;var%20one=url.indexOf("village");var%20two=url.indexOf('%26',one);var%20id;if(two>0)id=url.substring(one,two);elseid=url.substring(one);if(url.indexOf('screen=settings')==-1||url.indexOf('mode=quickbar')==-1)location.search='?screen=settings&mode=quickbar&'+id;else%20{ths=doc.getElementsByTagName('th');var%20table;for(i=0;i<ths.length;i++){if(ths[i].innerHTML=='Link'){table=ths[i].parentNode.parentNode;ths[i].parentNode.appendChild(ths[i].cloneNode(1));ths[i+1].innerHTML='<a%20href=\'%23\'%20id=\%22move\%22>Move</a>';ths[i+2].innerHTML='<label>From:%20</label><input%20type=text%20id=\%22begin\%22%20/><label>%20To:%20</label><input%20type=text%20id=\%22finish\%22%20/>';}}var%20code=table.rows[1].cells[2].getElementsByTagName('a')[0].href;code=code.substring(code.indexOf('&h='));move=table.getElementById('move');move.href=startJS()+'var%20start=doc.getElementById(\%22begin\%22).value;var%20finish=doc.getElementById(\%22finish\%22).value;var%20dir=finish-start;dir>0?dir=\%22down\%22:dir=\%22up\%22;var%20win;function%20moveOne(){win.alert(\%22Plz%20click%20meh%20\%22+Math.abs(finish-start)+\%22%20time(s)!!!\%22);win.close();dir==\%22up\%22?start--:start++;moveTwo()}function%20moveTwo(){if(start!=finish){win=window.open(doc.URL+\%22&id=\%22+start+\%22&action=\%22+dir+code);setTimeout(\%22moveOne()\%22,%201500);}else{location.reload();}}moveTwo();end();';for(i=1;i<table.rows.length;i++){row=table.rows[i];node=row.cells[row.cells.length-1];node.innerHTML="<a%20href=\'"+startJS()+"doc.getElementById(\%22begin\%22).value="+(i-1)+";end();\'>"+"<img%20src=\'http://en24.tribalwars.net/graphic/stat/green.png\'%20/></a>%20%20"+"<a%20href=\'"+startJS()+"doc.getElementById(\%22finish\%22).value="+(i-1)+";end();\'>"+"<img%20src=\'http://en24.tribalwars.net/graphic/stat/red.png\'%20/></a>";}}end();


Mass Village Rename
See this thread for additional information and for other approved variations on the script.

Code:
javascript:var%20text='I%20<3%20Servy';var%20doc=document;if(window.frames.length>0)doc=window.main.document;var%20inputs=doc.getElementsByTagName('input');for(i=0;i<inputs.length;i++){if(inputs[i].id.indexOf('edit_input')!=-1){inputs[i].value=text;inputs[i+1].click();}}end();



This renamer works from the village overview and only renames that village.
Code:
javascript:var old_sep = '|';var pre= '';var suf= 'Dorfname';var sep= '|';var lz= true;var c_length = 3;var coord_order = new Array(1,2);function leadingZero(s, n) {while (s.length < n) {s = "0" + s;}return s;}var coords = document.title.replace(/(.*)\(/,"").replace(/ (.*)/,"").replace(/\)/,"").split(old_sep);var title = pre;var _sep = '';for (var i=0;i<coord_order.length;i++) {if ((coord_order-1 >= 0) && (coord_order-1 < coords.length)) {title += _sep + ((lz) ? leadingZero(coords[coord_order-1], c_length) : coords[coord_order-1]);_sep = sep;}}title += suf;document.forms[0].elements[0].value = title;document.forms[0].submit();


Troop Speed/Renaming Attacks
Code must be edited per world, more world specific details in this thread.

These scripts are NOW both allowed, because they do nothing automatically. The one where the discussion is, you have to click to rename the attack.

Code:
javascript:function%20alertTime(dist)%20{function%20calcTime(Unit,unittime)%20{var%20time=dist*unittime;var%20h=Math.floor(time/60);var%20m=Math.floor((time/60-h)*60);var%20s=Math.floor((time-h*60-m)*60+0.5);return%20(h<10?"%20":(h<100?"%20":""))+String(h)+":"+(m<10?"0":"")+String(m)+":"+(s<10?"0":"")+String(s)+"\t"+Unit+"\n";}var%20Output%20=%20"";Output+=calcTime('Scout',9);Output+=calcTime('LC',10);Output+=calcTime('HC',11);Output+=calcTime('Spear/Axe',18);Output+=calcTime('Sword',22);Output+=calcTime('Ram/Cat',30);Output+=calcTime('Noble',35);alert(Output);}var%20l=document.links.length;var%20j=0;if(document.links[l-2].text=="%C2%BB%20abbrechen"){j--;}var%20End=document.links[l-2+j].text;var%20StartEnd=End.split('(');var%20Start=document.links[l-4+j].text;var%20StartStart=Start.split('(');if(StartStart.length==1){alert('StartVillage%20not%20found');}else%20if(StartEnd.length==1){alert('EndVillage%20not%20found');}else{Start=StartStart[StartStart.length-1].split(')')[0];var%20Startkoords=Start.split('|');var%20sx=Number(Startkoords[0]);var%20sy=Number(Startkoords[1]);End=StartEnd[StartEnd.length-1].split(')')[0];var%20Endkoords=End.split('|');var%20zx=Number(Endkoords[0]);var%20zy=Number(Endkoords[1]);var%20dx=sx-zx;var%20dy


Code:
javascript:var tm;t=document.getElementsByTagName('table');for(var i=0;i<t.length;i++){if(t[i].className=='main'){tm=t[i].getElementsByTagName('tbody')[0];break;}}ts=tm.getElementsByTagName('table');for(var j=0;j<ts.length;j++){if(ts[j].className='vis'){tv=ts[j].getElementsByTagName('tbody')[0];sp=ts[j].getElementsByTagName('span');for(var k=0;k<sp.length;k++){if(sp[k].getElementsByTagName('input').length>0){se=sp[k];}}z=tv.getElementsByTagName('tr');a=z[1].getElementsByTagName('td')[2].getElementsByTagName('a')[0].innerHTML;s=z[2].getElementsByTagName('td')[1].getElementsByTagName('a')[0].firstChild.nodeValue;g=z[4].getElementsByTagName('td')[1].getElementsByTagName('a')[0].firstChild.nodeValue;for(k=z.length-2;k>2;--k){if(z[k].getElementsByTagName('td')[0].firstChild.nodeValue=='Ankomst om:'){Dauer=z[k].getElementsByTagName('td')[1].innerHTML;}else{tv.removeChild(z[k]);}}break;}}h=s.split('(');s=h[h.length-1];h=s.split(')');s=h[0];h=g.split('(');g=h[h.length-1];h=g.split(')');g=h[0];wx=0;wy=0;Typ=s.split(':');if (Typ.length==3){StKo=s.split(':');ZiKo=g.split(':');wx=Math.abs(((StKo[0]% 10)*50+(StKo[1]% 10)*5+StKo[2]%5)-((ZiKo[0]% 10)*50+(ZiKo[1]% 10)*5+ZiKo[2]%5));wy=Math.abs((Math.floor(StKo[0]/10)*50+Math.floor(StKo[1]/10)*5+Math.floor(StKo[2]/5))-(Math.floor(ZiKo[0]/10)*50+Math.floor(ZiKo[1]/10)*5+Math.floor(ZiKo[2]/5)));}else{StKo=s.split('|');ZiKo=g.split('|');wx=Math.abs(StKo[0]-ZiKo[0]);wy=Math.abs(StKo[1]-ZiKo[1]);}w=Math.sqrt(wx*wx+wy*wy);tv.width='470';nr=document.createElement('tr');nh=document.createElement('th');nc=document.createElement('td');nc.colSpan='2';nc.innerHTML='Distance:';nr.appendChild(nc.cloneNode(true));nc.removeAttribute('colSpan');nc.innerHTML=w.toFixed(2)+' Fields';nr.appendChild(nc);nc=nc.cloneNode(false);tv.insertBefore(nr.cloneNode(true),z[z.length-1]);nc.height='10';nc.colSpan='3';nr.innerHTML='';nr.appendChild(nc);tv.appendChild(nr);nr=nr.cloneNode(false);nc=document.createElement('td');nr.appendChild(nc);nr=document.createElement('tr');nh.innerHTML='Unit';nr.appendChild(nh.cloneNode(true));nh.innerHTML='Duration';nr.appendChild(nh.cloneNode(true));nh.innerHTML='Name to';nr.appendChild(nh.cloneNode(true));tv.appendChild(nr);ie=tv.getElementsByTagName('input')[0].cloneNode(true);ib=tv.getElementsByTagName('input')[1].cloneNode(true);e=new Array('Scout','LC','HC','Axe','Sword','Ram','Noble');n=new Array('SCOUT','LC','HC','AXE','SWORD','RAMS','**NOBLE**');l=new Array(6,6.666,7.333,12,14.666,20,23.333);ie.size='36';for(var i=0;i<e.length;i++){t3=new Array();es=Math.round(l[i]*60*w);te='';t3[0]=Math.floor(es/3600);t3[1]=Math.floor(es/60)% 60;t3[2]=es% 60;for(var j=0;j<3;j++){if(t3[j]<10){te+='0';}te+=t3[j]+':';}te=te.slice(0,te.length-1);ie.value=n[i]+' ('+s+') '+a+' F'+w.toFixed(1);nr=document.createElement('tr');nc=document.createElement('td');nc.innerHTML=e[i];nr.appendChild(nc.cloneNode(true));nc.innerHTML=te;nr.appendChild(nc);nc=document.createElement('td');ie.id='editInput'+i;nc.appendChild(ie.cloneNode(true));ii=ib.cloneNode(true);ii.onmousedown=new Function('document.getElementById(\'editInput\').value=document.getElementById(\'editInput'+i+'\').value;');nc.appendChild(ii);nr.appendChild(nc);tv.appendChild(nr);}s();


Additional command renamer:

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.
Code:
javascript:function V(){return 1;}window.onerror=V;function Z(){a=1;b=1;c='{unit} ({coords}) {player} F{distance} {sent}'; p=['Scout','LC','HC','Axe','Sword','Ram','***Noble***'];d=document;function J(e){return/\s\(((\d+)\|(\d+))\)\sK/i.exec(e);}function K(e){f=parseInt(e,10);return(f>9?f:'0'+f);}function L(g,e){return g.getElementsByTagName(e);}function N(g){return g.innerHTML;}function M(g){return N(L(g,'a')[0]);}function O(){return k.insertRow(E++);}function W(f){return B.insertCell(f);}function P(g,e){g.innerHTML=e;return g;}function X(e){C=B.appendChild(d.createElement('th'));return P(C,e);}function Y(f){return K(f/U)+':'+K(f%(U)/T )+':'+K(f%T);}U=3600;T=60;R='table';S='width';s=L(document,R);for(j=0;j<s.length;j++){s[j].removeAttribute(S);if(s[j].className=='main'){s=L(L(s[j],'tbody')[0],R);break;}}D=0;for(j=0;j<s.length;j++){s[j].removeAttribute(S);if(s[j].className='vis'){k=s[j];if(t=k.rows)D=t.length;break;}}for(E=0;E<D;E++){l=t[E];m=(u=l.cells)?u.length:0;if(m){u[m-1].colSpan=5-m;if(N(u[0])=='Arrival:')Q=new Date(N(u[1]).replace(/<.*/i,''));else{if(N(u[0])=='Arrival in:')v=N(u[1]).match(/\d+/ig);}if(E==1)G=M(u[2]);if(E==2)w=J(M(u[1]));if(E==4)x=J(M(u[1]));}}y=v[0]*U+v[1]*T+v[2]*1;n=w[2]-x[2];o=w[3]-x[3];F=Math.sqrt(n*n+o*o);H=F.toFixed(2);E=D-2;s=L(k,'input');i=s[1];h=s[0];h.size=T;B=O();P(W(0),'Distance:').colSpan=2;P(W(1),H+' Fields').colSpan=2;B=O();X('Unit');X('Sent');X('Duration');X('Name to');c=c.replace(/\{coords\}/i,w[1]).replace(/\{distance\}/i,H).replace(/\{player\}/i,G);for(j in p){z=Math.round([9,10,11,18,22,30,35][j]*T*F/a/b);A=z-y;if(A>0){I=Y(z);B=O();P(W(0),p[j]);P(W(1),A<T&&'just now'||A<U&&Math.floor(A/T)+' mins ago'||Y(A)+' ago');P(W(2),I);C=W(3);q=C.appendChild(i.cloneNode(1));r=C.appendChild(h.cloneNode(1));r.id='I'+j;r.value=c.replace(/\{duration\}/i,I).replace(/\{sent\}/i,new Date(Q-z*1000).toLocaleString().replace(/.\d{4}/i,'').replace(/(\w{3})\w*/i,'$1')).replace(/\{unit\}/i,p[j]);q.onmousedown=new Function('h.value=d.getElementById(\'I'+j+'\').value;');}}}Z();


Mass recruitment scripts

#1:

Look before using it at this thread how it works and what you have to do. It´s really important!

Code:
javascript:var co=[0,0,0,0,0,0,0,0,0,0];var ar=0;var dc=document;if(window.frames.length>0)dc=window.main.document;function M(a){var v=a[0];for(var t=1;t<a.length;t++){if(a[t]<v){v=a[t];}}return v;}function D(a,b){var v=[];if(a.length==b.length){for(var t=0;t<a.length;t++){if(b[t]!=0){v[t]=a[t]*1.0/b[t];}else{v[t]=0;}}}return v;}function S(a,c){var y=dc.getElementsByTagName(a);var x=[];var u=0;for(var t=0;t<y.length;t++){if(y[t].className==c){x[u++]=y[t];}}return x;}function T(){var c=S('table','vis');for(var t=0;t<c.length;t++){try{if(c[t].rows[0].cells[0].innerHTML=='Village'){break;}}catch(e){}}return c[t];}function Q(r){var v=[0,0,0,0,0,0,0,0,0,0];for(var u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].childNodes[1].firstChild.title,10);}catch(e){}if(isNaN(v[u-3])){v[u-3]=0;}}return v;}function R(r){var v=[0,0,0,0];var s=r.cells[1].textContent.split("\n");var f=r.cells[2].innerHTML.split('/');v[0]=parseInt(s[1].replace(".",""),10);v[1]=parseInt(s[2].replace(".",""),10);v[2]=parseInt(s[3].replace(".",""),10);v[3]=f[1]-f[0];return v;}function P(r){var v=[0,0,0,0,0,0,0,0,0,0];for(var u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].textContent.split("\n")[2],10);}catch(e){}if(isNaN(v[u-3])){v[u-3]=0;}}return v;}if(dc.URL.match('screen=train')&&dc.URL.match('mode=mass')){var c=T().rows;if(ar==0){var f=['spear','sword','axe','spy','light','heavy','ram','catapult'];var s=[[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]];}else if(ar==1){var f=['spear','sword','axe','archer','spy','light','marcher','heavy','ram','catapult'];var s=[[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 stop();for(r=1;r<c.length;r++){var b=[];var z=[0,0,0,0];var w=R(c[r]);var q=Q(c[r]);var o=P(c[r]);for(var i=0;i<f.length;i++){b[i]=co[i]-(q[i]+o[i]);if(b[i]<0){b[i]=0;}for(var j=0;j<4;j++){z[j]+=s[i][j]*b[i];}};var h=M(D(w,z));if(h>1.0){h=1.0;}for(var i=0;i<f.length;i++){var n=b[i]*h;if(n<0){n=0;}if(n>1){if(c[r].cells[3+i].childNodes[3]){var x=c[r].cells[3+i].childNodes[3];try{x.value=parseInt(n,10);}catch(e){}}}}}stop();}


#2:

Additional Information
Code:
javascript: var configuration = [0, 0, 7400, 0, 2800, 0, 300, 0]; var archers; var massmode = (document.URL.match('mode=mass')); var units; var unitsEN; 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 == unitsEN[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 == 'Dorp') { break; } } catch (e) { } } return candidates[t]; } function getQueue(record) { var value = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; if (massmode) { 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; } } } else { var candidates = getTagsSubset('table', 'vis'); var u = 0; for (var t = 0; t < candidates.length; t++) { try { if (candidates[t].rows[0].cells[0].innerHTML == 'Recruitment') { for (u = 1; u < candidates[t].rows.length; u++) { var data = candidates[t].rows[u].cells[0].innerHTML.split(' '); value[getUnitId(data[1])] += parseInt(data[0], 10); } } } catch (e) { } } } return value; } function getResource(type) { return parseInt(document.getElementById(type).innerHTML, 10); } 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 getFarmSpace() { var candidates = getTagsSubset('table', 'box'); var t; for (t = 0; t < candidates.length; t++) { try { if (candidates[t].rows[0].cells[0].firstChild.firstChild.title == 'Villagers') { break; } } catch (e) { } } var data = candidates[t].rows[0].cells[1].innerHTML.split('/'); return parseInt(data[1], 10) - parseInt(data[0], 10); } function getProduced(record) { var value = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; if (massmode) { 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; } } } else { var candidates = getTagsSubset('table', 'vis'); for (var t = 0; t < candidates.length; t++) { try { if (candidates[t].rows[0].cells[0].innerHTML == 'Unit') { for (var u = 1; u < candidates[t].rows.length - 1; u++) { var data = candidates[t].rows[u].cells[6].innerHTML.split('/'); value[getUnitId(candidates[t].rows[u].cells[0].firstChild.childNodes[2].nodeValue.substr(1))] = parseInt(data[1], 10); } } } catch (e) { } } } 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].focus(); } if (configuration.length == 10 || configuration.length == 8) { archers = (configuration.length == 10); if (document.URL.match('screen=train')) { var total_costs = [0, 0, 0, 0]; var i, factor, number; var queue = []; var produced = []; var resources = []; if (archers) { units = ['spear', 'sword', 'axe', 'archer', 'spy', 'light', 'marcher', 'heavy', 'ram', 'catapult']; unitsEN = ['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']; unitsEN = ['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] ]; } if (massmode) { var records = getTable().rows; for (r = 1; r < records.length; r++) { var subconf = []; total_costs = [0, 0, 0, 0]; resources = getResources(records[r]); queue = getQueue(records[r]); 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]; } } factor = arrayMin(linearDivideArray(resources, total_costs)); if (factor > 1.0) { factor = 1.0; } for (i = 0; i < units.length; i++) { number = subconf[i] * factor; if (number < 0) { 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) { } } } } } else { queue = getQueue(); produced = getProduced(); resources = [getResource('wood'), getResource('stone'), getResource('iron'), getFarmSpace()]; for (i = 0; i < units.length; i++) { configuration[i] -= queue[i] + produced[i]; if (configuration[i] < 0) { configuration[i] = 0; } for (var j = 0; j < 4; j++) { total_costs[j] += costs[i][j] * configuration[i]; } } factor = arrayMin(linearDivideArray(resources, total_costs)); if (factor > 1.0) { factor = 1.0; } for (i = 0; i < units.length; i++) { number = configuration[i] * factor; if (number < 0) { number = 0; } if (document.getElementById(units[i])) { document.getElementById(units[i]).defaultValue = parseInt(number, 10); } } } submitForm(); } else { alert('WROOOOOONG!!!!\nNoob, this only works in the recruiting and mass recruiting screen.'); } } else { alert('The configuration for the troopnumbers is setup faulty.'); }

#3:
Additional Information

Code:
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.

Code:
javascript:function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};doc = getGameDoc();function main(doc) {if(doc.reservated) return;h2s = doc.getElementsByTagName('h2');for(var i=0; i<h2s.length; i++) {if(h2s[i].firstChild.nodeValue.match('^(Village)')) {table = h2s[i].parentNode.getElementsByTagName('table')[0];trs = table.getElementsByTagName('tr');v_coord = trs[1].getElementsByTagName('td')[1].firstChild.nodeValue;if(trs[2].getElementsByTagName('td')[1].getElementsByTagName('span').length > 0) {v_points = trs[2].getElementsByTagName('td')[1].firstChild.nodeValue + trs[2].getElementsByTagName('td')[1].firstChild.nextSibling.nextSibling.nodeValue;} else {v_points = trs[2].getElementsByTagName('td')[1].firstChild.nodeValue;}if(trs[3].getElementsByTagName('td')[1].firstChild.hasChildNodes()) {v_player = trs[3].getElementsByTagName('td')[1].firstChild.firstChild.nodeValue;} else {v_player = '';}if(trs[4].getElementsByTagName('td')[1].firstChild.hasChildNodes()) {v_ally = trs[4].getElementsByTagName('td')[1].firstChild.firstChild.nodeValue;} else {v_ally = '';}bb_code = "Village: [village]"+v_coord+"[/village]\nPoints: "+v_points+"\nPlayer: "+(v_player.length>0 ? "[player]"+v_player+"[/player]" : "")+"\nTribe: "+v_ally;new_row = doc.createElement('tr');new_cell = doc.createElement('td');new_cell.setAttribute('colspan', 2);new_h2 = doc.createElement('h2');new_h2.appendChild(doc.createTextNode('Claim'));new_cell.appendChild(new_h2);new_textarea = doc.createElement('textarea');new_textarea.setAttribute('rows', 5);new_textarea.setAttribute('cols', 35);new_textarea.appendChild(doc.createTextNode(bb_code));new_cell.appendChild(new_textarea);new_a = doc.createElement('a');new_a.setAttribute('href', 'http://forum.die-staemme.de/showthread.php?t=60755');new_a.setAttribute('target', '_blank');new_a.appendChild(doc.createTextNode('> zum Thread'));new_cell.appendChild(new_a);new_row.appendChild(new_cell);table.getElementsByTagName('tbody')[0].appendChild(new_row);doc.reservated = true;break;}}}if(!doc.URL.match('screen=info_village')) {alert('You need to be on the page of the village !');} else {main(doc);}

Last edited by servy : 2009,August 4th at 00:19.
hoodoo is offline  
EEchen
 
EEchen's Avatar
 
Join Date: 2008,July 5th
Location: Germany
Old #2   2008,July 21st, 15:19   Top
Some of these scripts use the german names of the troops. I´m working on it. But it will take a few days
EEchen is offline  
servy
Administrator
 
servy's Avatar
 
Join Date: 2007,March 7th
Old #3   2008,September 30th, 22:54   Top
Troop Counters
Use any of these scripts to gather information about total troop counts from your overviews.

Standard worlds (Quickbar - Opens Pop-Up) by "Poncho (german server)"

To use this you have to be at the Combinied Overview and then klick the button there will be a Pop-Up which shows you your troups at home.

Code:
javascript:javascript:var b=new Array(0,0,0,0,0,0,0,0);var c=0;var d=document.getElementsByTagName('table');for(var a=0;a<d.length;a++){if(d[a].className=='main'){var e=d[a].getElementsByTagName('table');for(var i=0;i<e.length;i++){if(e[i].className='vis'){var f=e[i].getElementsByTagName('tr');for(var j=0;j<f.length;j++){if(f[j].className=='nowrap row_a'||f[j].className=='nowrap row_b'){var g=f[j].getElementsByTagName('td');for(var k=7;k<=14;k++){b[k-7]+=parseInt(g[k].firstChild.nodeValue);}c++;}}}}}}alert("Unit - Troop - Average\n---------------------------------\nSpeerfighters: "+b[0]+" ("+Math.round(b[0]/c)+")\nSwordfighters: "+b[1]+" ("+Math.round(b[1]/c)+")\nAxemen: "+b[2]+" ("+Math.round(b[2]/c)+")\nScouts: "+b[3]+" ("+Math.round(b[3]/c)+")\nLight Cavalry: "+b[4]+" ("+Math.round(b[4]/c)+")\nHeavy Cavalry: "+b[5]+" ("+Math.round(b[5]/c)+")\nRams: "+b[6]+" ("+Math.round(b[6]/c)+")\nKatapults: "+b[7]+" ("+Math.round(b[7]/c)+")");

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)

Code:
javascript:function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};doc = getGameDoc();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'));units_count = units.length;troops = new Array(units_count);for(var i=0; i<units_count; i++)troops[i]=0;village_count = 0;var troops_datas = doc.getElementsByTagName('td');for(var j=0; j<troops_datas.length; j++) {if(troops_datas[j].firstChild.nodeValue == 'eigene' || troops_datas[j].firstChild.nodeValue == 'auswärts') {village_count += 1;td = troops_datas[j];next = td.nextSibling;for(var k=0; k<units_count; k++) {do {next = next.nextSibling;} while (next.nodeType != 1)troops[k] += parseInt(next.firstChild.nodeValue);}}}village_count = village_count / 2;if(village_count > 0) {var output = '';for(var i=0; i<units_count; i++){output += units[i][1] + ': ' + troops[i] + " (" + Math.round(troops[i]/village_count) + ")\n"}alert("Einheit - Truppen - Durchschnitt\n" +"---------------------------------\n" +output);} else {alert('Fehler! Dörfer/Truppen nicht gefunden!');}


"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)

Code:
javascript:function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};doc = getGameDoc();units = Array(Array(0,'Speerträger'),Array(1,'Schwertkämpfer'),Array(2,'Axtkämpfer'),Array(3,'Späher'),Array(4,'Leichte Kav.'),Array(5,'Schwere Kav.'),Array(6,'Rammböcke'),Array(7,'Katapulte'));units_count = units.length;troops = new Array(units_count);for(var i=0; i<units_count; i++)troops[i]=0;village_count = 0;var troops_datas = doc.getElementsByTagName('td');for(var j=0; j<troops_datas.length; j++) {if(troops_datas[j].firstChild.nodeValue == 'eigene' || troops_datas[j].firstChild.nodeValue == 'auswärts') {village_count += 1;td = troops_datas[j];next = td.nextSibling;for(var k=0; k<units_count; k++) {do {next = next.nextSibling;} while (next.nodeType != 1)troops[k] += parseInt(next.firstChild.nodeValue);}}}village_count = village_count / 2;if(village_count > 0) {var output = '';for(var i=0; i<units_count; i++){output += units[i][1] + ': ' + troops[i] + " (" + Math.round(troops[i]/village_count) + ")\n"}alert("Einheit - Truppen - Durchschnitt\n" +"---------------------------------\n" +output);} else {alert('Fehler! Dörfer/Truppen nicht gefunden!');}
servy is offline  
servy
Administrator
 
servy's Avatar
 
Join Date: 2007,March 7th
Old #4   2008,September 30th, 23:00   Top
Put troops in the Rally Point
by "identify (german server)"

All Troops (Old worlds)
Code:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('spear','sword','axe','spy','light','heavy','ram','catapult','snob');doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, ""));}}}
Only Offensive Troops (Standard worlds)
Code:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('axe','light','ram','catapult');doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, ""));}}}

Only Defensive Troops (Standard worlds)

Code:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('spear','sword','heavy');doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, ""));}}}


Paladin worlds

Only Defensive Troops
Code:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('spear','archer','sword','knight','heavy');doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, ""));}}}

Only Offensive Troops
Code:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('axe','light','ram','marcher','catapult');doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, ""));}}}

All Troops
Code:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('spear','sword','axe','archer','spy','light','heavy','marcher','ram','catapult','knight','snob');doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, ""));}}}


Last edited by servy : 2008,September 30th at 23:15.
servy is offline  
servy
Administrator
 
servy's Avatar
 
Join Date: 2007,March 7th
Old #5   2008,October 21st, 23:48   Top
Storing less than the Maximum number of packets:

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');}

Sending resources to a random village:
Additional Information

Code:
javascript:function l(){var j=document;var k=document.forms[0];function m(){a=k.getElementsByTagName('input');for(p=0;p<a.length;p++){if(a[p].value.indexOf('OK')!=-1)a[p].click();}}function x(z,A){C=gid('Status');B=gid('StatusImg');if($chk(C)){C.nodeValue=z;}else{D=gid('menu_row2').parentNode.parentNode.parentNode.parentNode.parentNode.insertRow(0);D.align="right";E=D.insertCell(0);E.colSpan=2;F=document.createElement('table');F.className='box';D2=F.insertRow(0);E0=D2.insertCell(0);E1=D2.insertCell(1);E.appendChild(F);J=document.createElement('span');K=document.createTextNode(z);K.id='Status';J.appendChild(K);E0.appendChild(J);B=document.createElement('img');B.id='StatusImg';E1.appendChild(B);}B.src='/graphic/dots/'+A+'.png';}function n(r){return parseInt(r,10);}var s=j.location.search;if(!s.match(/\bscreen=market\b/i)||!s.match(/\bmode=send\b/i)){if(s.match(/\btry=confirm_send\b/i)){x('On Confirm Screen... clicking OK','red');m();}else{var b=s.match(/\bvillage=\d+/i);var c=s.match(/\bt=\d+/i);var s2='?screen=market&mode=send'+($chk(b)?'&'+b[0]:'')+($chk(c)?'&'+c[0]:'');x('On the wrong screen :'+s+':<br>\ngoing to '+s2,'red');j.location.search=s2;}return;}if(n(k.wood.value)>0){x('Values filled in... clicking OK','red');m();return;}var arrRatio=[3,4,1];var intMinMerchants=10;var intSum=0;arrRatio.forEach(function(r,p,arrParam){intSum+=r;});var e =[n(j.getElementById('wood').innerHTML),n(j.getElementById('stone').innerHTML),n(j.getElementById('iron').innerHTML)];var arrFactors=e.map(function(r,p,arrParam){return arrRatio[p]>0?(r)/arrRatio[p]:999999;});var numFactor=Math.min.apply(Math,arrFactors);var arrSendResources=arrRatio.map(function(r,p,arrParam){return Math.floor(numFactor*r);});var numSum=0;arrSendResources.forEach(function(r,p,arrParam){numSum+=r;});var u='insufficient resources:'+e;var blSend=(intMinMerchants*1000)<=numSum;if(blSend){var intMaxMerchants=0;var f=j.getElementsByTagName('table');for(p=0;p<f.length;p++){v=f[p].rows[0].cells[0].innerHTML;if(v.indexOf('Merchants:')==0){intMaxMerchants=n(v.match(/\d+/i)[0]);break;}}u='too few Merchants : '+intMaxMerchants+' < '+intMinMerchants;blSend=(intMaxMerchants>=intMinMerchants);}if (!blSend){x(u,'red');var g=j.links;for(p=0;p<g.length;p++){if(g[p].accessKey=="d"){location.href=g[p].href;return;}}}var o=Math.min(intMaxMerchants,Math.floor(numSum/1000));arrLastResources=arrRatio.map(function(r,p,arrParam){return Math.floor(1000*o*r/intSum);});w='659|595 669|605 668|604 668|608 641|597 669|607 665|599 656|595 668|619 670|606 668|607 663|596 665|597 640|597 653|593 674|616 645|594 660|594 637|599 673|614';var h=w.match(/\d+\|\d+/g);var i=h[$random(0,h.length-1)].match(/\d+/g);insertNumber(k.wood,arrLastResources[0]);insertNumber(k.stone,arrLastResources[1]);insertNumber(k.iron,arrLastResources[2]);insertNumber(k.x,i[0]);insertNumber(k.y,i[1]);x('Filled in some values ... click the link again...','green');}l();

Making a twstats map:

From a player/tribe/village profile:
Additional Information
Code:
javascript:var%20doc=document;if(window.frames.length>0)doc=window.main.document;url=doc.URL;link='http://twstats.com/'+getWorld(url)+'/index.php?page=map&'+getCoords();link+='&zoom=250&grid=1';link+='&player_1_id=0&player_1_colour=FFFF00';color='00FF00';function%20getID(url){var%20start=url.indexOf("id=")+3;var%20end=url.indexOf('%26',start);var%20id;if(end>0)id=url.substring(start,end);else{id=url.substring(start);}return%20id;}function%20getWorld(url){start=url.indexOf("en");return%20url.substring(start,url.indexOf('.',start));}function%20getCoords(){str=doc.title;mid=str.lastIndexOf('|');x=str.substring(str.lastIndexOf('(')+1,mid);y=str.substring(mid+1,str.lastIndexOf(')'));return%20'centrex='+x+'&centrey='+y;}if(url.indexOf('screen=info_player')!=-1){link+='&player_0_id='+getID(url)+'&player_0_colour='+color;}else%20if(url.indexOf('screen=info_ally')!=-1){link+='&tribe_0_id='+getID(url)+'&tribe_0_colour='+color;}else%20if(url.indexOf('screen=info_village')!=-1){link+='&village_0_id='+getID(url)+'&village_0_colour='+color;}else%20{link="";alert('This%20script%20needs%20to%20be%20called%20from%20a%20player%20or%20tribe%20profile.');}if(link!="")window.open(link);end();
From any of the rankings pages:
Additional Information
Code:
javascript:var%20doc=document;if(window.frames.length>0)doc=window.main.document;url=doc.URL;link='http://twstats.com/'+getWorld(url)+'/index.php?page=map&centrex=500&centrey=500';link+='&zoom=100&grid=1&nocache=1&fill=000000';function%20getID(url){var%20start=url.indexOf("id=")+3;var%20end=url.indexOf('%26',start);var%20id;if(end>0)id=url.substring(start,end);else{id=url.substring(start);}return%20id;}function%20getWorld(url){start=url.indexOf("en");return%20url.substring(start,url.indexOf('.',start));}if(url.indexOf('screen=ranking')==-1){alert('This%20script%20needs%20to%20be%20called%20from%20one%20of%20the%20rankings%20pages');}else{table="";ths=doc.getElementsByTagName('th');for(i=0;i<ths.length&&table=="";i++){if(ths[i].innerHTML=='Rank'){table=ths[i].parentNode.parentNode;}}type='';if(url.indexOf('mode=player')!=-1||url.indexOf('mode=con_player')!=-1||url.indexOf('mode=kill_player')!=-1)type='player';else%20if(url.indexOf('mode=ally')!=-1||url.indexOf('mode=con_ally')!=-1||url.indexOf('mode=kill_ally')!=-1)type='tribe';rows=table.rows;for(i=1;i<11;i++){tLink=rows[i].cells[1].childNodes[0].href;link+='&'+type+'_'+(i-1)+'_id='+getID(tLink);}link+='&'+type+'_0_colour=00FF00';link+='&'+type+'_1_colour=00FFFF';link+='&'+type+'_2_colour=FFFFFF';link+='&'+type+'_3_colour=FFFF00';link+='&'+type+'_4_colour=FF8040';link+='&'+type+'_5_colour=FF0080';link+='&'+type+'_6_colour=C0C0C0';link+='&'+type+'_7_colour=FF0000';link+='&'+type+'_8_colour=808080';link+='&'+type+'_9_colour=FF00FF';window.open(link);}end();
From a tribe's member page:
Additional Information
Code:
javascript:var%20doc=document;if(window.frames.length>0)doc=window.main.document;var%20url=doc.URL;var%20link='http://twstats.com/'+getWorld(url)+'/index.php?page=map&centrex=500&centrey=500';link+='&zoom=100&grid=1&nocache=1&fill=000000';function%20getID(aUrl){var%20start=aUrl.indexOf("id=")+3;var%20end=aUrl.indexOf('%26',start);var%20id;if(end>0)id=aUrl.substring(start,end);else{id=aUrl.substring(start);}return%20id;}function%20getWorld(){start=url.indexOf("en");return%20url.substring(start,url.indexOf('.',start));}if(url.indexOf('screen=info_member')==-1){alert('This%20script%20needs%20to%20be%20called%20from%20a%20tribe\'s%20members%20page');}else{table="";ths=doc.getElementsByTagName('th');for(i=0;i<ths.length&&table=="";i++){if(ths[i].innerHTML=='Rank'){table=ths[i].parentNode.parentNode;}}rows=table.rows;for(i=1;i<Math.min(11,rows.length);i++){tLink=rows[i].cells[0].getElementsByTagName('a')[0].href;link+='&player_'+(i-1)+'_id='+getID(tLink);}link+='&player_0_colour=00FF00';link+='&player_1_colour=00FFFF';link+='&player_2_colour=FFFFFF';link+='&player_3_colour=FFFF00';link+='&player_4_colour=FF8040';link+='&player_5_colour=FF0080';link+='&player_6_colour=C0C0C0';link+='&player_7_colour=FF0000';link+='&player_8_colour=808080';link+='&player_9_colour=FF00FF';window.open(link);}end();

Sorting the Incomings Page
Additional Information
Code:
javascript:var doc=document;if(window.frames.length>0)doc=window.main.document;var headID=doc.getElementsByTagName("head")[0];var newScript=doc.createElement('script');newScript.type='text/javascript';newScript.src='http://scripts.twstats.com/servy-incomingSort.js';headID.appendChild(newScript);function end(){}end();

Last edited by Lizy : 2008,November 28th at 16:03.
servy is offline  
servy
Administrator
 
servy's Avatar
 
Join Date: 2007,March 7th
Old #6   2008,December 2nd, 04:33   Top

Rename All incoming attacks

Renames all attacks on the screen to one pre-set name.
Code:
javascript:var%20text='???';var%20doc=document;if(window.frames.length>0)doc=window.main.document;var%20inputs=doc.getElementsByTagName('input');for(i=0;i<inputs.length;i++){if(inputs[i].id.indexOf('editInput')!=-1){if(inputs[i].value.substring(0,6)=='Attack'){inputs[i].value=text;inputs[i+1].click();}}}end();


Renames all un-changed attacks to the current server date/time.
Code:
javascript:function labelAttacks() {var arrInputs=document.getElementsByTagName('input');var regAttack=new RegExp("Attack");var strDate=gid('serverDate').childNodes[0].nodeValue;var strTime=gid('serverTime').childNodes[0].nodeValue;alert(arrInputs.length);for(i=0;i<arrInputs.length;i++){if(arrInputs[i].id.indexOf('editInput')!=-1&&arrInputs[i].value.match(regAttack)){arrInputs[i].value='Unknown ['+strDate+' '+strTime+']';arrInputs[i+1].click();}}}labelAttacks();


Tribalwarsmap distance calculator

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.

Code:
javascript:%20var%20url='http://www.tribalwarsmap.com/traveltimes2';%20if%20(location.hostname.split('.')[1]=='tribalwars')%20{url+='?world=';var%20world%20=%20location.hostname.split('.')[0];%20if%20(world=='classic')%20{url+='c1';}%20else%20{url+=world.substring(2);};%20var%20query='';%20if%20(window.main)%20{query%20=%20window.main.location.search.substring(1).split('&');}%20else%20{query%20=%20window.location.search.substring(1).split('&');};%20var%20village=false;%20var%20dest=false;%20for(i=0;i<query.length;i++)%20{query[i]=query[i].split('=');%20if%20(query[i][0]=='village')%20{url+='&start='+query[i][1];}%20else%20if%20(query[i][0]=='screen'&&query[i][1]=='info_village')%20{village=true;}%20else%20if%20(query[i][0]=='id')%20{dest='&destination='+query[i][1];}};%20if%20(village&&dest)%20{url+=dest;}}void%20window.open(url);


Send report to external Converter

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).
Code:
javascript:/*Converter*/if(typeof%20convert=='function'){convert('en')}else{s=document.createElement('script');s.src='http://plemiona.one.pl/js/link.js';document.getElementsByTagName('head')[0].appendChild(s);var%20limit=0;function%20init(){if(typeof%20convert=='function')convert('en');else%20if(limit<80)setTimeout(init,100);else%20alert('No%20connection%20with%20converter%20page.%20Try%20again%20later.');limit++}init()}


Sort Overviews

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.
Code:
javascript:function c(){var a=document;if(window.frames.length>0)a=window.main.document;var b=a.createElement('script');b.type='text/javascript';b.src='http://legion.problemsolver.co.uk/SlowTarget/sort.js';a.getElementsByTagName('head')[0].appendChild(b);}c();


Last edited by servy : 2008,December 10th at 19:35.
servy is offline  
servy
Administrator
 
servy's Avatar
 
Join Date: 2007,March 7th
Old #7   2009,February 17th, 19:23   Top

Calculate OD

Additional Information
Code:
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);




Map: Groups visible

Additional Information

Code:
javascript:var doc=(window.frames.length>0)?window.main.document:document;var player="Fluffy88";var display=['Attack','Defence','K56','Full','Noble Train','Rebuilding'];var color=['#0033CC','#00FF00','#FFCC00','#CC0000','#0033CC','#00FF00'];function getElementByClass(a,b){var c=doc.getElementsByTagName(a);for(var x=0;x<c.length;x++){if(c[x].className==b){return c[x]}}return-1}function setStatusTitle(a,b){var c=doc.getElementsByTagName("h2");if(c[0].innerHTML.length>12){c[0].innerHTML=c[0].innerHTML.replace(c[0].innerHTML.substring(12)," ("+a+"/"+b+")")}else{c[0].innerHTML+=" ("+a+"/"+b+")"}}if(doc.URL.match(/screen=map/)){el=getElementByClass("table","map");var teller=1;maxaantal=(el.rows.length*el.rows[1].cells.length);for(var x=0;x<el.rows.length;x++){for(var y=0;y<el.rows[x].cells.length;y++){setStatusTitle(teller++,maxaantal);for(var z=0;z<display.length;z++){if(el.rows[x].cells[y].innerHTML.match(display[z],"i")&&el.rows[x].cells[y].innerHTML.match(player,"i")){el.rows[x].cells[y].innerHTML+="<div style = \"position: absolute; background-color:"+color[z]+"; filter:alpha(opacity=80); opacity:.8; -moz-opacity:.8; width:53px; height:12px; margin-top:-13px; display:block; color:black;\">"+display[z]+"</div>"}}}}}else{alert("This option can only be used in the map!")};void 0;


Last edited by Lizy : 2009,June 24th at 04:34.
servy is offline  
servy
Administrator
 
servy's Avatar
 
Join Date: 2007,March 7th
Old #8   2009,October 25th, 01:59   Top
Balance Resources

Additional Information
Code:
javascript:function MarketMain(){var a=document;if(window.frames.length>0)a=window.main.document;var b=a.createElement('script');b.type='text/javascript';b.src='http://www.extremetw.com/rix/mb.js';a.getElementsByTagName('head')[0].appendChild(b)}function getGameDoc(winvar){getdoc=winvar.document;if(!getdoc.URL.match('game\.php')){for(var i=0;i<winvar.frames.length;i++){if(winvar.frames[i].document.URL.match('game\.php')){getdoc=winvar.frames[i].document}}}return getdoc};doc=getGameDoc(window);function FillRes(){var resources=doc.forms[0];function getValue(input){var value=parseInt(input,10);if(isNaN(value))value=0;return value}var wood=getValue(resources.wood.value);var clay=getValue(resources.stone.value);var iron=getValue(resources.iron.value);function OKClick(){var arrInputs=resources.getElementsByTagName('input');for(var idx1=0;idx1<arrInputs.length;idx1++){if(arrInputs[idx1].value.indexOf('OK')!=-1){arrInputs[idx1].click();break}}}function insertValues(){var URLargs=doc.URL.split("&");for(var i=0;i<URLargs.length;i++){var args=URLargs[i].split("=");if(args.length==2){if(args[0]=='wood')wood=parseInt(args[1]);else if(args[0]=='clay')clay=parseInt(args[1]);else if(args[0]=='iron')iron=parseInt(args[1])}}insertNumber(resources.wood,wood);insertNumber(resources.stone,clay);insertNumber(resources.iron,iron)}if(wood+clay+iron>0){OKClick()}else{insertValues()}}if(doc.URL.match(/clay=/)||doc.URL.match(/confirm_send/)){FillRes()}else{MarketMain()}

servy is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 03:04.
Powered by vBulletin Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. Copyright ©2003 - 2009, InnoGames GmbH