Okay, I have several versions of the mass village renamer out there, and I'm adding more, so I'm just going to move them all into one thread for convenience.

1) Renames all villages to the same text which is editable right at the start of 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();

 

2) Same as #1 but numbers the villages.

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');var%20index=1;for(i=0;i<inputs.length;i++){if(inputs[i].id.indexOf('edit_input')!=-1){inputs[i].value="";if(index<100)inputs[i].value+="0";if(index<10)inputs[i].value+="0";inputs[i].value+=index%20+%20"%20";inputs[i].value+=text;inputs[i+1].click();index++;}}end();

 

3) Renames each village to a random coordinate. There are two variables at the start to set the first digit of the X and Y coordinates so that the random coordinate is in a specific K. To have it completely random change randCoords(XK,YK) to randCoords() near the end of the script.

Code:
javascript:var%20XK=6;var%20YK=5;function%20randCoords(){return%20Math.round(Math.random()*999)+'|'+Math.round(Math.random()*999);}function%20randCoords(x,y){return%20x+""+rand99()+'|'+y+""+rand99();}function%20rand99(){num=Math.round(Math.random()*99);if(num<10)num='0'+num;return%20num;}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=randCoords(XK,YK);inputs[i+1].click();}}end();

Note that all 3 of the above scripts can be run on the Combined, Production, Troops, Buildings, Research, or Groups overviews. The 4th script must be run on the combined overview.

4) Renames the village to be the amount of farm space remaining in that village.

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();

 

5) This script renames each village to be the distance from a set village. The first time this script is run it adds a text field to the first row of the table. You then enter the coordinates you wish to measure from. When you run the script again it will rename all of the villages.
This script can be run from the combined, production, or troops overviews.

Code:
javascript:var%20doc=document;if(window.frames.length>0)doc=window.main.document;var%20X=-1;var%20Y=-1;ths=doc.getElementsByTagName('th');for(i=0;i<ths.length;i++){index=ths[i].innerHTML.indexOf('Village');if(index==0)ths[i].innerHTML='Target%20Village:%20<input%20type=text%20id=\%22coords\%22%20value=\%22500|500\%22%20/>';else%20if(index>0){coords=ths[i].getElementById('coords').value;X=coords.split('|')[0];Y=coords.split('|')[1];finish();}}function%20sq(x){return%20Math.pow(x,2);}function%20distance(x,y){str=Math.round(Math.sqrt(sq(X-x)+sq(Y-y)));if(str<10)str='000'+str;else%20if(str<100)str='00'+str;else%20if(str<1000)str='0'+str;return%20str}function%20finish(){var%20inputs=doc.getElementsByTagName('input');for(i=0;i<inputs.length;i++){id=inputs[i].id;index=id.indexOf('edit_input');if(index!=-1){id=id.substring(index+11);str=doc.getElementById('label_text_'+id).innerHTML;mid=str.lastIndexOf('|');x=str.substring(str.lastIndexOf('(')+1,mid);y=str.substring(mid+1,str.lastIndexOf(')'));inputs[i].value=distance(x,y);inputs[i+1].click();}}}end();
0
View All

Comments

You must first activate your account before posting.
You must be signed in to post on this wall.