Script Rules

Status
Not open for further replies.

DeletedUser

Guest
Script Rules

Only approved scripts may be used.

The exception is if it merely fills in forms (for example: filling in troop numbers) or displays the results of some calculations. Simple scripts like this are allowed, as long as they do nothing else.

Scripts that automatically run, such as Userscripts, are not permitted.

Failure to follow these rules may result in severe penalties.

How to Get a Script Approved

Create a new thread in the Script Submission forum. Include the actual code (or a link to it), a full description of everything the script does, and detailed instructions on how to use it. If this is a private script (for your use only, or your tribe) and you do not wish it to be publicly posted, please indicate that this is so. A moderator will review your submission and send a private message to the forum account used to submit the script, either approving or rejecting it.

Guidelines for Script Developers
Scripts may not submit battle commands such as attacking or supporting.
Scripts may not watch for incoming attacks.
Scripts may not emulate premium features.
 
Last edited by a moderator:

DeletedUser

Guest
scripts

all scripts in this list have been approved.

Approved Scripts

» all scripts from the tribalwars.net approved script list
________________

» all scripts from the tribalwars.co.uk approved script list
________________

Battle Report Enhancer
Code:
javascript:$.getScript('http://bit.ly/twcheese_BRE');void 0;
________________

Command Renamer
Code:
javascript:function%20e(){var%20n="rename&delete",s="http://damouse.wartool.net/collectables/rename_delete_main.js";var%20a=window.frames.length>0?window.main:window;function%20c(m){a.document.body.appendChild(a.document.createTextNode(m));a.document.body.appendChild(a.document.createElement("br"))}if(a.document.getElementById(n)==null){c("Creating%20script%20entry%20in%20doc%20head...");var%20A=a.document.createElement("script");A.id=n;A.type="text/javascript";A.src=s;a.document.getElementsByTagName("head")[0].appendChild(A);setTimeout(e,500);return}if(typeof%20a.document.getElementById(n)=="undefined"||typeof%20a.appendIcons=='undefined'){c("Loading%20script...");setTimeout(e,200);return%200}c("Loaded");if(a.document.URL.match(/screen=report/)){eval("a.appendIcons('fake')")}else{eval("a.overView()")}}e();
Author: Dalesmckay
Summary: Renames outbound attacks to certain criteria.
________________

Defence Finder
Code:
javascript:var  speed={spy:8,light:8.89,marcher:8.89,knight:8.89,heavy:9.78,spear:16,axe:16,bow:16,archer:16,sword:19.56,ram:26.67,catapult:26.67,snob:31.11};function  srtfnc(a,b){if(Number(a[0])<Number(b[0]))return  -1;if(Number(b[0])<Number(a[0]))return 1;return 0;}function  zeroPad(number,length){var  n=number.toString();while(n.length<length){n="0"+n;}return n;}var  doc=(window.frames.length>0)?window.main.document:document;var  destby=String(doc.title.match(/\d+\|\d+/))||'500|500';destby=prompt("Choose  Destination",destby);destby=destby.split("|");var  maxdelay;while(true){maxdelay=prompt("Select a maximum duration (eg,  3:48:50), leave blank for no maximum  limit","");maxdelay=(maxdelay?maxdelay.split(":"):[]);while(maxdelay.length<3){maxdelay.splice(0,0,0);}if(maxdelay.length==3){break;}}maxdelay=maxdelay.map(function(x){return  parseInt(x,10);});var  maxdelaytime=(maxdelay[0]*60*60)+(maxdelay[1]*60)+maxdelay[2];var  diffx;var diffy;function fnGetMode(){var scrape;var  mode=(scrape=window.location.href.match(/&mode\=(\w+)/i))?scrape[1]:null;if(!mode){var  win=(window.frames.length>0)?window.main:window;var  srcHTML=win.$("td[class=selected]").html();if(srcHTML){mode=(scrape=srcHTML.match(/;mode\=(\w+)/i))?scrape[1]:null;}}return   mode;}if(doc.URL.match(/screen\=overview_villages/i)&&(fnGetMode()=='combined')){var   t=doc.getElementById('combined_table');if(t.rows[0].cells[0].innerHTML=='Village'){rs=[];for(j=1;j<t.rows.length;j++){by=t.rows[j].cells[0].innerHTML.match(/\((\d+\|\d+)\)\s*K\d+/i);by=by[1].split("|");diffx=destby[0]-by[0];diffy=destby[1]-by[1];dist=Math.sqrt(diffx*diffx+diffy*diffy);for(c=0;c<t.rows[j].cells.length;c++){if(t.rows[0].cells[c].innerHTML.match(/graphic\/unit\/unit_(\w+).png/)){unit=t.rows[0].cells[c].innerHTML.match(/graphic\/unit\/unit_(\w+).png/)[1];time=dist*speed[unit]*60;h=zeroPad(Math.floor(time/3600),2);mm=zeroPad(Math.floor(time/60)%2560,2);s=zeroPad(Math.round(time%2560),2);res=h+':'+mm+':'+s;if(t.rows[j].cells[c].className=='hidden'){t.rows[j].cells[c].innerHTML=res;}else   if(maxdelaytime==0){t.rows[j].cells[c].innerHTML="<B>"+t.rows[j].cells[c].innerHTML+"</B><BR>"+res;}else  if(time<maxdelaytime){t.rows[j].cells[c].innerHTML="<FONT  COLOR=\"#00FF00\"><B>"+t.rows[j].cells[c].innerHTML+"</B><BR>"+res+"</FONT>";}else{t.rows[j].cells[c].innerHTML="<FONT   COLOR=\"#FF0000\"><B>"+t.rows[j].cells[c].innerHTML+"</B><BR>"+res+"</FONT>";}}}rs.push([dist,t.rows[j].innerHTML]);}rs=rs.sort(srtfnc);while(t.rows.length>1){t.deleteRow(1);}t.rows[0].insertCell(1).innerHTML="<B>Distance</B>";for(j=0;j<rs.length;j++){rr=t.insertRow(j+1);rr.innerHTML=rs[j][1];rr.insertCell(1).innerHTML=Number(Math.round(rs[j][0]*100)/100);}for(j=1;j<t.rows.length;j++){t.rows[j].className=((j%252==1)?'nowrap  row_a':'nowrap row_b');}}}void(0);
Author: Dalesmckay
Summary:A multipurpose snipe tool - use the script on the combined overview page. Sorts the villages according to the time to reach a village.
Input the coordinates of the village under consideration. Input the timing. Sorts useful villages in green and not useful villages to red.
defensefinder.png
________________

Fake Generator
Code:
javascript:function c(){var a=(window.frames.length>0)?window.main.document:document;var b=a.createElement('script');b.type='text/javascript';b.src='http://www.crosstrigger.com/tw/fake_maker.js?'+Math.round(Math.random()*1000000);a.getElementsByTagName('head')[0].appendChild(b);}c();
Author: dalesmckay
Summary: The Fake Generator pulls co-ordinates from a players page and sets them up into "area of village" and "all villages"
________________

Farm Assistant Filter

Code:
javascript:/*author: patricier, name: FA-filter, version:1.0.0*/function filter(){var sort = "asc"; if(!document.URL.match(/screen=am_farm&order=distance&dir=/)){ location.href='{game}&screen=am_farm&order=distance&dir=asc';}var div = document.getElementById('am_widget_Farm');var td = div.getElementsByTagName('td');td[0].innerHTML += '<br>Villages you attack are being filtered';for (var i = 1; i< td.length; i++){if (td[i].innerHTML.indexOf('<img src="http://cdn2.tribalwars.net/graphic/command/attack.png?1') != -1){td[i].parentNode.style.display = 'none';}}}filter();
Options:
sort = 'asc'; this may be changed to 'desc' to sort by distance, in descending order
Code:
javascript:/*author: patricier, name: FA-filter, version:1.0.0 (twcheese.mod.01)*/$.getScript('https://dl.dropbox.com/u/1621643/tw/scripts/tribalwars.us/FA_filter.js');void 0;
________________

Freeze Timers
Code:
 javascript:if(timers.length>0){tmptimers=timers;timers=[];}else{timers=tmptimers;}void(0);
Author: Morthy
Summary: Stops and starts the countdown of commands and incomings.
________________

Incoming Tagger Generator
Code:
 javascript:var%20format="{unit}%20{sent}%20{coords}%20{player}%20{duration}%20{distance}%20{return}%20{attack_id}";var%20titleArr=["Scout","LC","HC","Axe","Sword","Ram","***Noble***"];var%20showMS=false;var%20n='fnGenerateTaggerScript';var%20s='http://crosstrigger.com/tw/generate_tagger.js';var%20a=(window.frames.length>0)?window.main:window;var%20z=0;function%20c(m){a.document.body.appendChild(a.document.createTextNode(m));a.document.body.appendChild(a.document.createElement('br'));}function%20e(){if(!a.document.getElementById(n)){c("Embedding%20Script...");var%20A=a.document.createElement('script');A.id=n;A.type='text/javascript';A.src=s+'?'+Math.round(Math.random()*1000000);a.document.getElementsByTagName("head")[0].appendChild(A);setTimeout(e,1000);return%20false;}if(typeof(a.fnGenerateTaggerScript)=="undefined"){c("Finalizing%20Script...");setTimeout(e,1000);return%20false;}try{c("Executing%20Script"+(z>0?"%20(retry%20"+z+")":"")+"...");a.fnGenerateTaggerScript(format,titleArr,showMS);}catch(errorObj){z++;if(z<3){setTimeout(e,1000);}else{c("Script%20Failed");}return%20false;}return%20true;}e();void(0);
Author: Dalesmckay
Summary: Creates a customisable incoming attack renaming script. Downloads world data so world and unit speed is correct creating a script for each world. The tagger produced it legal.
attacktaggergenerator.png
________________

Mass Recruiter
Code:
javascript:var%20n=prompt("1.insert  your name   2.insert your name   3.insert your name   4.insert your  name   5.insert your name   6.insert your name   ",  "0");n=parseInt(n);if(n==1){var%20units=[0,200,0,0,15,0,0,2191,0,100];}  else%20if(n==2){var%20units=[0,0,0,0,15,30,0,0,0,0];}  else%20if(n==3){var%20units=[0,0,0,0,15,0,0,0,0,40];}  else%20if(n==4){var%20units=[0,400,0,0,15,0,0,2191,0,100];}  else%20if(n==5){var%20units=[0,0,0,0,15,0,0,0,0,0];}  else%20if(n==6){var%20units=[0,8,0,7,0,0,0,0,0,100];}  else{var%20units=[0,0,0,0,0,0,0,0];}var farm=200;var  res=[0,0,0];if(game_data.mode!='mass')$(location).attr('href',game_data.link_base_pure+'train&mode=mass');function   D(a,b){v=[];if(a.length==b.length){for(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  Q(r){v=[0,0,0,0,0,0,0,0,0,0];for(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){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)-res[0];v[1]=parseInt(s[2].replace(".",""),10)-res[1];v[2]=parseInt(s[3].replace(".",""),10)-res[2];v[3]=f[1]-f[0]-farm;return  v}function  P(r){v=[0,0,0,0,0,0,0,0,0,0];for(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}c=$("table.vis");c=c[2].rows;if($("#mass_train_table  [src*=unit_archer]").length==0){f=["spear","sword","axe","spy","light","heavy","ram","catapult"];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{f=["spear","sword","axe","archer","spy","light","marcher","heavy","ram","catapult"];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]]}for(r=1;r<c.length;r++){b=[];z=[0,0,0,0];for(i=0;i<f.length;i++){b[i]=units[i]-(Q(c[r])[i]+P(c[r])[i]);if(b[i]<0){b[i]=0}for(j=0;j<4;j++){z[j]+=s[i][j]*b[i]}};a=D(R(c[r]),z),h=a[0];for(t=1;t<a.length;t++){if(a[t]<h){h=a[t]}}if(h>1.0){h=1.0}for(i=0;i<f.length;i++){n=b[i]*h;if(n<0){n=0}if(n>1){if(c[r].cells[3+i].childNodes[3]){x=c[r].cells[3+i].childNodes[3];x.value=parseInt(n,10)}}}}end()
Summary: A script run from the mass recruitment overview in a group – inputs troops into boxes.
Where it says "Insert Your Name" put the name of your group you wish to run these from 1-6. (More groups can be added quite easily, if you have any trouble send a PM HERE)
________________

OD Calculator
Code:
javascript: var  win=window.frames.length?window.main:window; var doc=win.document; var  J=win.$; var oda=0; var odd=0; var od=0; function fetch(x){  x=J("table:has(th:contains('"+x+"')):last table  td:contains('Losses:')").parent().html();  return(x==null)?[]:x.match(/\d+/g); } var al=fetch('Attacker:');  al=al.slice(1); var dl=fetch('Defender:'); dl=dl.slice(1); switch  (al.length) { case 9: oda = dl[0] * 4 + dl[1] * 5 + dl[2] * 1 + dl[3] * 1  + dl[4] * 5 + dl[5] * 23 + dl[6] * 4 + dl[7] * 200; odd = al[0] * 1 +  al[1] * 2 + al[2] * 4 + al[3] * 2 + al[4] * 13 + al[5] * 15 + al[6] * 8 +  al[7] * 200; break; case 10: oda = dl[0] * 4 + dl[1] * 5 + dl[2] * 1 +  dl[3] * 1 + dl[4] * 5 + dl[5] * 23 + dl[6] * 4 + dl[7] * 12 + dl[8] *  200; odd = al[0] * 1 + al[1] * 2 + al[2] * 4 + al[3] * 2 + al[4] * 13 +  al[5] * 15 + al[6] * 8 + al[7] * 10 + al[8] * 200; break; case 11: oda =  dl[0] * 4 + dl[1] * 5 + dl[2] * 1 + dl[3] * 5 + dl[4] * 1 + dl[5] * 5 +  dl[6] * 6 + dl[7] * 23 + dl[8] * 4 + dl[9] * 12 + dl[10] * 200; odd =  al[0] * 1 + al[1] * 2 + al[2] * 4 + al[3] * 2 + al[4] * 2 + al[5] * 13 +  al[6] * 12 + al[7] * 15 + al[8] * 8 + al[9] * 10 + al[10] * 200; break;  case 12: oda = dl[0] * 4 + dl[1] * 5 + dl[2] * 1 + dl[3] * 5 + dl[4] * 1  + dl[5] * 5 + dl[6] * 6 + dl[7] * 23 + dl[8] * 4 + dl[9] * 12 + dl[10] *  40 + dl[11] * 200; odd = al[0] * 1 + al[1] * 2 + al[2] * 4 + al[3] * 2 +  al[4] * 2 + al[5] * 13 + al[6] * 12 + al[7] * 15 + al[8] * 8 + al[9] *  10 + al[10] * 20 + al[11] * 200; break; } od = oda + odd;alert("Total OD  gained from battle: " + od + "\n\nODA: " + oda + "\n\nODD: " +  odd);void(0);
Summary: Gives you total ODA and ODD from a report of your choice
________________

Operation Planner
Code:
Javascript: $.getScript("http://dl.dropbox.com/u/24469843/Tribalwars/Scripts/op_gen.js"); void(0);
Author: Stotty2009
Summary:Script that creates an operation for a player. Run from their profile it will create an operation.
operationgen.png
________________

Proximity Script
Code:
javascript:var central=prompt("Coords  Plox!","");var win=window.frames.length>0?window.main:window;var  J=win.$;var doc=window.document;var  table=J("table[id$=_table]").filter(":not(#group_table)").get(0);var  rows=[];var q;var p;var  rowHeight=table.rows[1].cells[0].rowSpan;function get_distance(a,b){var  a=a.split("|");var b=b.split("|");var c=b[0]-a[0];var d=b[1]-a[1];return   Math.sqrt(c*c+d*d)}for(q=1;q<table.tBodies[0].rows.length;q+=rowHeight){var  row=table.tBodies[0].rows[q];var  coords=J.trim(J(row.cells[0]).text()).match(/\((\d+\|\d+)\)  +K\d+$/)[1];var  rowGroup=[];for(p=0;p<rowHeight;++p){rowGroup[p]=table.tBodies[0].rows[q+p]}rows[(q-1)/rowHeight]=[coords,rowGroup]}rows=rows.sort(function(a,b){return   get_distance(a[0],central)-get_distance(b[0],central)});for(q=0;q<rows.length;++q){for(p=0;p<rowHeight;++p){table.tBodi  es[0].appendChild(rows[q][1][p])}}void 0;
Summary:This script is run from the overview tab and will resort your villages in order from closest to farthest from a given set of coordinates. From the overview tab, click the script from your quickbar and it will pop up a box asking to input the coordinates. It must be input with the | between the numbers (i.e. 500|500).
________________

ResourceBalancer
Code:
javascript:function%20MarketMain(){var%20a=document;if(window.frames.length>0)a=window.main.document;var%20b=a.createElement('script');b.type='text/javascript';b.src='http://www.extremetw.com/rix/mb.js';a.getElementsByTagName('head')[0].appendChild(b)}function%20getGameDoc(winvar){getdoc=winvar.document;if(!getdoc.URL.match('game\.php')){for(var%20i=0;i<winvar.frames.length;i++){if(winvar.frames[i].document.URL.match('game\.php')){getdoc=winvar.frames[i].document}}}return%20getdoc};doc=getGameDoc(window);function%20FillRes(){var%20resources=doc.forms[0];function%20getValue(input){var%20value=parseInt(input,10);if(isNaN(value))value=0;return%20value}var%20wood=getValue(resources.wood.value);var%20clay=getValue(resources.stone.value);var%20iron=getValue(resources.iron.value);function%20OKClick(){var%20arrInputs=resources.getElementsByTagName('input');for(var%20idx1=0;idx1<arrInputs.length;idx1++){if(arrInputs[idx1].value.indexOf('OK')!=-1){arrInputs[idx1].click();break}}}function%20insertValues(){var%20URLargs=doc.URL.split("&");for(var%20i=0;i<URLargs.length;i++){var%20args=URLargs[i].split("=");if(args.length==2){if(args[0]=='wood')wood=parseInt(args[1]);else%20if(args[0]=='clay')clay=parseInt(args[1]);else%20if(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()}
Author: ronpaul2008 and *Rix*
Summary: Tool that balances resources as best as is possible given resource levels and market levels. Creates a pop up, opening tabs.
resourcesbalancer.png
________________

Snipe
Code:
 javascript:function%20c(){try{var%20a=(window.frames.length>0)?window.main.document:document;var%20n='snipe_script';var%20u='http://www.crosstrigger.com/tw/snipe.js?'+Math.round(Math.random()*1000000);if(!a.URL.match(/screen\=overview_villages\&mode\=combined/i)){window.location.search='screen=overview_villages&mode=combined'+'&'+String(a.URL.match(/[\&\?]t\=\d+/i)).replace(/[\?\&]/,'');return%20false;}if(a.getElementById(n)){return%20false;}var%20b=a.createElement('script');b.id=n;b.type='text/javascript';b.src=u;a.getElementsByTagName('head')[0].appendChild(b);}catch(o){alert('Error:%20'%20+%20String(o.message||o));}}c();void(0);
Author: Dalesmckay
Summary: Creates a notebook output for when to snipe an incoming attack and where from. However, milliseconds have to be added onto the times. Valuable for sniping any noble train.
snipez.png
________________

Sort Incoming Attacks
Code:
javascript:function%20c(){var%20a=(window.frames.length>0)?window.main.document:document;var%20b=a.createElement('script');b.type='text/javascript';b.src='http://www.crosstrigger.com/tw/sort.js?'+Math.round(Math.random()*1000000);a.getElementsByTagName('head')[0].appendChild(b);}c();
Summary: If you are offline when you receive incomings this script finds attack ID’s and allows you to rank them allowing you to work out when the attack was sent.
t6cscj.jpg
________________

Tribal Wars Map - Travel Times
Code:
javascript:%20var%20url='http://www.tribalwarsmap.com/us/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);
Summary: A shortcut script to TribalWars map external tool – inputs data for you and is quick and easy. Gives travel times very quickly and easily.
twmap.png
________________

Troop Evaluator Script
Code:
javascript:function c(){var b=document.createElement

('script');b.type='text/javascript';b.src='http://www.crosstrigger.com/tw/v7/troop_counter.js?'

+Math.round(Math.random()*1000000);document.getElementsByTagName('head')[0].appendChild(b);}c

();
Summary: Counts all troops in all your villages from the "Troop Overview" screen. (Premium required)
Author: dalesmckay
________________

Village Grouper
Code:
 javascript:function%20c(){var%20a=document;if(window.frames.length>0)a=window.main%20.document;var%20b=a.createElement('script');b.type='text/javascript';b.src='http://www.the-hangout.co.cc/Tribalwars/js/grouper.js';a.getElementsByTagName('head')[0].appendChild(b);}c();
Author:The-Hangout
Summary: Groups villages based on several factors. Checks and uncheck villages based on certain parameters.
k9vo5s.jpg
________________

Village Rename – Same
Code:
javascript:var%20text='RatedRR%20>%20All';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();
Author: RatedRR
Summary: Renames all villages from the overviews page to the same.
________________

Village Rename – Location within a Continent
Code:
 javascript:var%20doc=(window.frames.length>0)?window.main.document:document;var%20eleCoords=$('#base_coords')[0];if(eleCoords){rename(eleCoords.value.match(/(\d+)\|(\d+)/));}else{$('#combined_table%20th:contains("Village")').html('Target%20Village:%20<input%20type=text%20id="base_coords"%20value="50|50"/>');}function%20zeroPad(number,length){var%20n=number.toString();while(n.length<length){n="0"+n;}return%20n;}function%20SQ(x){return%20Math.pow(x,%202);}function%20V(z){return%20(z%25100);}function%20D(s,d){return%20Math.round(Math.sqrt(SQ(V(d[1])-V(s[1]))+SQ(V(d[2])-V(s[2]))));}function%20K(x,y){return%20(Math.floor(y/100)*10)+Math.floor(x/100);}function%20rename(base){var%20coord;base[1]=parseInt(base[1],10);base[2]=parseInt(base[2],10);$('#combined_table%20span[id*=label_text_],#combined_table%20input').each(function(index,element){if(element.id.match(/label_text_/i)){coord=element.innerHTML.match(/(\d+)\|(\d+)/);}else%20if(element.id.match(/edit_input_/i)){var%20xx=parseInt(coord[1],10);var%20yy=parseInt(coord[2],10);var%20ns=(V(yy)<50)?'N':'S';var%20ew=(V(xx)<50)?'W':'E';var%20nm='K'+zeroPad(K(xx,yy),2)+'%20'+ns+ew+'%20'+zeroPad(D(coord,base),3);element.value=nm;}else%20if(element.type=="button"){element.click();}});}void(0);
Author: seekingtruth
Summary: Village reamer based on the following:
KYX: occupied K of the village.
(Compass point): K is broken up into 4 directions based on the compass: NE, NW, SW, SE.
(Fields from the CENTER of the K): the fields from the exact centre of the K that the village resides in.
________________

Village Rename – Farm Space
Code:
 javascript:var%20doc=document;if(window.frames.length>0)doc=window.main.document;if(doc.URL.indexOf('mode=combined')!=-1){var%20inputs=doc.getElementsByTagName('input');for(i=0;i<inputs.length;i++){if(inputs[i].id.indexOf('edit_input')!=-1){row=inputs[i].parentNode.parentNode.parentNode;cell=row.cells[6].childNodes[0].innerHTML;cell=cell.substring(0,cell.indexOf('%20'));if(cell<10)cell='0000'+cell;else%20if(cell<100)cell='000'+cell;else%20if(cell<1000)cell='00'+cell;else%20if(cell<10000)cell='0'+cell;inputs[i].value=cell;inputs[i+1].click();}}}else{alert('You%20need%20to%20be%20on%20either%20the%20combined%20overview%20to%20run%20this%20script');}end();
Summary: Renames villages from overviews to the amount of farm space remaining in them. Not recommended for times of war for obvious reasons.
________________

Village Rename – custom
Code:
javascript:/*@contributor Lekensteyn <lekensteyn@gmail.com> @version 0.4.20101108*/void(function(){var l=(frames.main||self).document,h=prompt("Rename villages\n\n*Fill in {#k} for continent.\n*Fill in {#x} for x-coordinate\n*fill in {#y} for y-coordinate\n*Fill in {#xxx} for x-coordinate (1 will be 001)\n*Fill in {#yyy} for y-coordinate (1 will be 001)\n*Fill in {#c} for co\xf6rdinates\n*Fill in {#old} for old village name\n*Fill in {#nr} for village numbering. Next you will be asked how many numbers should be displayed(4 will result in 0001, 0002, etc)\n*Fill in {#cd} for xx.xx.xx notation.", ""),g=l.getElementsByTagName("input"),n=g.length,e=1;if(h)if(h.length<3)alert("Use at least 3 characters");else{var o=/((\d{1,3})\|(\d{1,3}))\) .(\d{1,2})$/,f=0,c,b,k,a,m=/{#nr}/.test(h),p=/{#cd}/.test(h),j=function(i){return i>9?i>99?i:"0"+i:"00"+i};if(m){var d=prompt("How many digits should be used? (an input of \"4\" will result in 0001, 0002, etc)\n\nNot filling this in will result in no leading zeros (1,2,3,4,5,6,7,etc)\nIf the number of the village exceeds the amount of specified digits, it will use the entire number (ie 4 digits, village #12345 will be 12345, not 2345)", "");if(d)d=d.match(/\d+/);if((d=d?d*1:0)&&(e=prompt("Begin numbering at:",e)))e=e.match(/\d+/);e=e?e*1:0;var q=-1*d,r=Array(d).join("0")}for(;f<n;f++){b=g[f].id.split("edit_input_");if(b.length>1){a=l.getElementById("label_text_"+b[1]).innerHTML.match(o);b=h.replace(/{#c}/g,a[1]).replace(/{#x}/g,a[2]).replace(/{#y}/g,a[3]).replace(/{#k}/g,a[4]).replace(/{#kk}/g,("0"+a[4]).substr(-2)).replace(/{#xxx}/g,j(a[2])).replace(/{#yyy}/g,j(a[3]));k=g[f].value;if(m){c=""+e++;if(d>c.length)c=(r+c).substr(q); b=b.replace(/{#nr}/g,c)}if(p){c=j(a[2]).split("");a=j(a[3]).split("");b=b.replace(/{#cd}/g,a[0]+c[0]+"."+a[1]+c[1]+"."+a[2]+c[2])}if(k!=""&&k!=b){g[f].value=b.replace(/{#old}/g,g[f].value);g[f+1].click()}}}}})()
» more information
renamer.png
________________
 
Last edited by a moderator:

DeletedUser

Guest
A new village renamer has been approved.

Village Rename – custom
Code:
javascript:/*@contributor Lekensteyn <lekensteyn@gmail.com> @version 0.4.20101108*/void(function(){var l=(frames.main||self).document,h=prompt("Rename villages\n\n*Fill in {#k} for continent.\n*Fill in {#x} for x-coordinate\n*fill in {#y} for y-coordinate\n*Fill in {#xxx} for x-coordinate (1 will be 001)\n*Fill in {#yyy} for y-coordinate (1 will be 001)\n*Fill in {#c} for co\xf6rdinates\n*Fill in {#old} for old village name\n*Fill in {#nr} for village numbering. Next you will be asked how many numbers should be displayed(4 will result in 0001, 0002, etc)\n*Fill in {#cd} for xx.xx.xx notation.", ""),g=l.getElementsByTagName("input"),n=g.length,e=1;if(h)if(h.length<3)alert("Use at least 3 characters");else{var o=/((\d{1,3})\|(\d{1,3}))\) .(\d{1,2})$/,f=0,c,b,k,a,m=/{#nr}/.test(h),p=/{#cd}/.test(h),j=function(i){return i>9?i>99?i:"0"+i:"00"+i};if(m){var d=prompt("How many digits should be used? (an input of \"4\" will result in 0001, 0002, etc)\n\nNot filling this in will result in no leading zeros (1,2,3,4,5,6,7,etc)\nIf the number of the village exceeds the amount of specified digits, it will use the entire number (ie 4 digits, village #12345 will be 12345, not 2345)", "");if(d)d=d.match(/\d+/);if((d=d?d*1:0)&&(e=prompt("Begin numbering at:",e)))e=e.match(/\d+/);e=e?e*1:0;var q=-1*d,r=Array(d).join("0")}for(;f<n;f++){b=g[f].id.split("edit_input_");if(b.length>1){a=l.getElementById("label_text_"+b[1]).innerHTML.match(o);b=h.replace(/{#c}/g,a[1]).replace(/{#x}/g,a[2]).replace(/{#y}/g,a[3]).replace(/{#k}/g,a[4]).replace(/{#kk}/g,("0"+a[4]).substr(-2)).replace(/{#xxx}/g,j(a[2])).replace(/{#yyy}/g,j(a[3]));k=g[f].value;if(m){c=""+e++;if(d>c.length)c=(r+c).substr(q); b=b.replace(/{#nr}/g,c)}if(p){c=j(a[2]).split("");a=j(a[3]).split("");b=b.replace(/{#cd}/g,a[0]+c[0]+"."+a[1]+c[1]+"."+a[2]+c[2])}if(k!=""&&k!=b){g[f].value=b.replace(/{#old}/g,g[f].value);g[f+1].click()}}}}})()
» more information
renamer.png
 
Last edited by a moderator:

DeletedUser

Guest
Script approved:

Farm Assistant Filter

Code:
javascript:/*author: patricier, name: FA-filter, version:1.0.0*/function filter(){var sort = "asc"; if(!document.URL.match(/screen=am_farm&order=distance&dir=/)){ location.href='{game}&screen=am_farm&order=distance&dir=asc';}var div = document.getElementById('am_widget_Farm');var td = div.getElementsByTagName('td');td[0].innerHTML += '<br>Villages you attack are being filtered';for (var i = 1; i< td.length; i++){if (td[i].innerHTML.indexOf('<img src="http://cdn2.tribalwars.net/graphic/command/attack.png?1') != -1){td[i].parentNode.style.display = 'none';}}}filter();
Options:
sort = 'asc'; this may be changed to 'desc' to sort by distance, in descending order
 
Status
Not open for further replies.
Top