Mass Village Renamer

File Not Found

Contributing Poster
/me stabs Pudog in the face for being like the thousandth person to ask for that exact script.

Yes...

Let me go and quote one of the hundred or so other posts where the fix is.

If given the original in the first place...


[spoil]
Code:
javascript: var round_precision = 1;
var doc = document;
if (window.frames.length > 0) doc = window.main.document;
var X = - 1;
var Y = - 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 Village: <input type=text id="coords" value="500|500" /><input type=button id="rename_button" onclick="javascript: finish();" value="Commence Rename"/>';
    else if (index > 0)
       {coords = doc.getElementById('coords').value;
        X = coords.split( '|')[0];
        Y = coords.split( '|')[1];
        }
   }

function sq(x)
   {return Math.pow(x, 2);
   }

function distance(x, y)
   {str = Math.round(Math.sqrt(sq(X - x) + sq(Y - y)) * (round_precision * 10)) / (round_precision * 10);
    if (str < 10) str = '000' + str;
    else if (str < 100) str = '00' + str;
    else if (str < 1000) str = '0' + str;
    return str;
   }

function finish()
   {var inputs = 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].value;
            inputs[i + 1].click();
           }
       }
   }
void(0);
[/spoil]

As for the remove script, I've included it below, however, no modification was required, and as such, none was made.

[spoil]
Code:
javascript: var doc = (window.frames.length > 0) ? window.main.document: document;
var inputs = doc.getElementsByTagName('input');
for (i = 0;i < inputs.length;i++)
   {if (inputs[i].id.indexOf('edit_input') != - 1)
       {name = inputs[i].value;
        inputs[i].value = name.slice(name.indexOf(" "), name.length);
        inputs[i + 1].click();
       }
   }
[/spoil]





Have you tried asking on the .ro servers for help?

They would basically just be language alterations for data matching in the script.
 
Last edited:

Pudog

Guest
/me slaps myself on the face for being so dumb and lazy :icon_redface:

kk Thanks so much!!! :)
 

NatashaI

Guest
Can anyone please help me combine these 2 scripts? the first one renames villages to XY:XY:XY and the second adds a text in front (and back) of the preexisting name. I want a script that will name the village XY:XY:XY SOMETHING. Thanks!
[spoil]
Code:
javascript:function%20convert_coords(x,y){con=Math.floor(y/100)+''+Math.floor(x/100);sec=(Math.floor(y/10)%2510)+''+(Math.floor(x/10)%2510);sub=(y%2510)+''+(x%2510);return%20'['+con+':'+sec+':'+sub+']';}var%20doc=document;if(window.frames.length>0)doc=window.main.document;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=convert_coords(x,y);inputs[i+1].click();}}end();

Code:
javascript:var text='text in front';var text2='text behind';var doc=document;if(window.frames.length>0)doc=window.main.document;var inputs=doc.getElementsByTagName('input');for(i=0;i<inputs.length;i++){if(inputs[i].id.indexOf('edit_input')!=-1){inputs[i].value=text+inputs[i].value+text2;inputs[i+1].click();}}
[/spoil]
 

File Not Found

Contributing Poster
Can anyone please help me combine these 2 scripts? the first one renames villages to XY:XY:XY and the second adds a text in front (and back) of the preexisting name. I want a script that will name the village XY:XY:XY SOMETHING. Thanks!
[spoil]
Code:
javascript:function%20convert_coords(x,y){con=Math.floor(y/100)+''+Math.floor(x/100);sec=(Math.floor(y/10)%2510)+''+(Math.floor(x/10)%2510);sub=(y%2510)+''+(x%2510);return%20'['+con+':'+sec+':'+sub+']';}var%20doc=document;if(window.frames.length>0)doc=window.main.document;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=convert_coords(x,y);inputs[i+1].click();}}end();
Code:
javascript:var text='text in front';var text2='text behind';var doc=document;if(window.frames.length>0)doc=window.main.document;var inputs=doc.getElementsByTagName('input');for(i=0;i<inputs.length;i++){if(inputs[i].id.indexOf('edit_input')!=-1){inputs[i].value=text+inputs[i].value+text2;inputs[i+1].click();}}
[/spoil]

As requested.

[spoil]
Code:
javascript: 
before_text = 'Once upon a time.. ';
after_text = ' lived hapilly ever after.';
function convert_coords(x, y)
   {con = Math.floor(y / 100) + '' + Math.floor(x / 100);
    sec = (Math.floor(y / 10) % 2510) + '' + (Math.floor(x / 10) % 2510);
    sub = (y % 2510) + '' + (x % 2510);
    return'[' + con +':' + sec +':' + sub +']';
   }
var doc = document;
if (window.frames.length > 0) doc = window.main.document;
var inputs = 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 = before_text + convert_coords(x, y) + after_text;
        inputs[i + 1].click();
       }
   }
end();
[/spoil]
 

NatashaI

Guest
I tried that script, and it's not working. It renames the village to HELLO[68:6780:673800]BYE, the coords of that village are 800|673. From what I can tell it's adding the continent to the sector, then the continent and sector to the subcontinent.
 

dalesmckay

Still Going Strong
Try this:
[SPOIL]
Code:
javascript:function fnExecuteScript(){var mask="HELLO[{continent}:{sector}:{field}]BYE";var padding=4;var randomRange={'min':0,'max':1000};function zeroPad(number,length){var n=number.toString();while(n.length<length){n="0"+n;}return n;}function Point(x,y){return {'x':x,'y':y};}function Rect(top,left,bottom,right){return {'top':top,'left':left,'bottom':bottom,'right':right};}function pointInRect(point,rect){return(point.x>=rect.left&&point.x<=rect.right&&point.y>=rect.top&&point.y<=rect.bottom);}function fnExtractDetails(x,y){var location={'continent':(Math.floor(y/100)*10)+Math.floor(x/100),'direction':'','sector':((Math.floor(y/10)%2510)*10)+(Math.floor(x/10)%2510),'field':((y%2510)*10)+(x%2510)};var position=Point(Math.floor(x/10)%2510,Math.floor(y/10)%2510);var continent_map={'NW':Rect(0,0,4,4),'NE':Rect(5,0,9,4),'SW':Rect(0,5,4,9),'SE':Rect(5,5,9,9)};for(var direction in continent_map){if(continent_map.hasOwnProperty(direction)){if(pointInRect(position,continent_map[direction])){location.direction=direction;break;}}}return location;}var eleDoc=(window.frames.length>0)?window.main.document:document;var inputs=eleDoc.getElementsByTagName('input');var ii,id,index,str,mid,x,y,details,newName;var count=1;for(ii=0;ii<inputs.length;ii++){id=inputs[ii].id;index=id.indexOf('edit_input');if(index>=0){id=id.substring(index+11);str=$('#label_text_'+id).html();mid=str.lastIndexOf('|');x=str.substring(str.lastIndexOf('(')+1,mid);y=str.substring(mid+1,str.lastIndexOf(')'));details=fnExtractDetails(x,y);newName=mask.replace(/\{continent\}/i,details.continent).replace(/\{direction\}/i,details.direction).replace(/\{sector\}/i,details.sector).replace(/\{field\}/i,details.field).replace(/\{index\}/i,zeroPad(count++,padding)).replace(/\{x\}/i,x).replace(/\{y\}/i,y);while(newName.match(/\{random\}/i)){newName=newName.replace(/\{random\}/i,Math.floor(Math.random()*(randomRange.max-randomRange.min))+randomRange.min);}inputs[ii].value=newName;inputs[ii+1].click();}}void(0);}fnExecuteScript();
[/SPOIL]

Then you can replace the highlighted text with whatever you like in the script.

var mask="HELLO[{continent}:{sector}:{field}]BYE";
 

File Not Found

Contributing Poster
Just one.

Read through any of numerous threads whereupon a working copy of the script has been provided. eg. the first/second post on this page.
 

File Not Found

Contributing Poster
I tried that script, and it's not working. It renames the village to HELLO[68:6780:673800]BYE, the coords of that village are 800|673. From what I can tell it's adding the continent to the sector, then the continent and sector to the subcontinent.

Odd, given I didn't alter the code that determines the name previously.

The code I added simply adds something to the front, and something else to the back. It should have had no affect on the content of the middle of the name.
 

NatashaI

Guest
Odd, given I didn't alter the code that determines the name previously.

The code I added simply adds something to the front, and something else to the back. It should have had no affect on the content of the middle of the name.
Yeah, I thought it was weird too. I compared it to the other script and it had the same code, and that one was working...
 

dipank

Still Going Strong
Just one.

Read through any of numerous threads whereupon a working copy of the script has been provided. eg. the first/second post on this page.
Lol thanks, that is what I meant, the script mentioned in the first post about renaming on distance isnt working for firefox/chrome
 

DelToroBravo

Guest
/me stabs Pudog in the face for being like the thousandth person to ask for that exact script.

Yes...

Let me go and quote one of the hundred or so other posts where the fix is.
does not work for me properly. if i take 500|500 as an example and run a test, it makes the distance right. but if i take i.e.

510|251

it renames my village like this

0209.2 [116] Village (510|291) K25
 

naomin

Still Going Strong
does not work for me properly. if i take 500|500 as an example and run a test, it makes the distance right. but if i take i.e.

510|251

it renames my village like this

0209.2 [116] Village (510|291) K25

Renames them al jumbly numbers that mean nothing for me too. ggggggrrrrrrrrrrr. Kind of need it right now. One on first page doesn't work, one on this page doesn't work. Then, what to do??
 

sean5500

Guest
Bit of an odd suggestion but I want my villages named like this for example. co-ords of vllage is 273|338 the name would be 32:37:83. It makes it a lot easier to find the villages in their clusters.

-sean
 

dalesmckay

Still Going Strong
Bit of an odd suggestion but I want my villages named like this for example. co-ords of vllage is 273|338 the name would be 32:37:83. It makes it a lot easier to find the villages in their clusters.

-sean
You can use my Generic Village Renamer to do it.
It just needs to be tweaked like this:
[SPOIL]
Code:
javascript:var mask="{continent}:{sector}:{field}";var padding=4;var randomRange={'min':0,'max':1000};function fnExecuteScript(){function zeroPad(number,length){var n=number.toString();while(n.length<length){n="0"+n;}return n;}function Point(x,y){return {'x':x,'y':y};}function Rect(top,left,bottom,right){return {'top':top,'left':left,'bottom':bottom,'right':right};}function pointInRect(point,rect){return(point.x>=rect.left&&point.x<=rect.right&&point.y>=rect.top&&point.y<=rect.bottom);}function fnExtractDetails(x,y){var location={'continent':(Math.floor(y/100)*10)+Math.floor(x/100),'direction':'','sector':((Math.floor(y/10)%2510)*10)+(Math.floor(x/10)%2510),'field':((y%2510)*10)+(x%2510)};var position=Point(Math.floor(x/10)%2510,Math.floor(y/10)%2510);var continent_map={'NW':Rect(0,0,2,2),'N':Rect(0,3,2,6),'NE':Rect(0,7,2,9),'W':Rect(3,0,6,2),'C':Rect(3,3,6,6),'E':Rect(3,7,6,9),'SW':Rect(7,0,9,2),'S':Rect(7,3,9,6),'SE':Rect(7,7,9,9)};for(var direction in continent_map){if(continent_map.hasOwnProperty(direction)){if(pointInRect(position,continent_map[direction])){location.direction=direction;break;}}}return location;}var eleDoc=(window.frames.length>0)?window.main.document:document;var inputs=eleDoc.getElementsByTagName('input');var ii,id,index,str,mid,x,y,details,newName;var count=1;for(ii=0;ii<inputs.length;ii++){id=inputs[ii].id;index=id.indexOf('edit_input');if(index>=0){id=id.substring(index+11);str=$('#label_text_'+id).html();mid=str.lastIndexOf('|');x=str.substring(str.lastIndexOf('(')+1,mid);y=str.substring(mid+1,str.lastIndexOf(')'));details=fnExtractDetails(x,y);newName=mask.replace(/\{continent\}/i,zeroPad(details.continent,2)).replace(/\{direction\}/i,details.direction).replace(/\{sector\}/i,zeroPad(details.sector,2)).replace(/\{field\}/i,zeroPad(details.field,2)).replace(/\{index\}/i,zeroPad(count++,padding)).replace(/\{x\}/i,zeroPad(x,3)).replace(/\{y\}/i,zeroPad(y,3));while(newName.match(/\{random\}/i)){newName=newName.replace(/\{random\}/i,Math.floor(Math.random()*(randomRange.max-randomRange.min))+randomRange.min);}inputs[ii].value=newName;inputs[ii+1].click();}}void(0);}fnExecuteScript();
[/SPOIL]
 

7feathers

blocked
Ok i am using the following script posted at the top of this page as the latest proximity mass renamer..


javascript: var round_precision = 1;
var doc = document;
if (window.frames.length > 0) doc = window.main.document;
var X = - 1;
var Y = - 1;
ths = doc.getElementsByTagName('th');
for (i = 0;i < ths.length;i++)
{index = ths.innerHTML.indexOf('Village');
if (index == 0) ths.innerHTML = 'Target Village: <input type=text id="coords" value="500|500" /><input type=button id="rename_button" onclick="javascript: finish();" value="Commence Rename"/>';
else if (index > 0)
{coords = doc.getElementById('coords').value;
X = coords.split( '|')[0];
Y = coords.split( '|')[1];
}
}

function sq(x)
{return Math.pow(x, 2);
}

function distance(x, y)
{str = Math.round(Math.sqrt(sq(X - x) + sq(Y - y)) * (round_precision * 10)) / (round_precision * 10);
if (str < 10) str = '000' + str;
else if (str < 100) str = '00' + str;
else if (str < 1000) str = '0' + str;
return str;
}

function finish()
{var inputs = doc.getElementsByTagName('input');
for (i = 0;i < inputs.length;i++)
{id = inputs.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.value = distance(x, y) + " " + inputs.value;
inputs[i + 1].click();
}
}
}
void(0);


However no Matter what coords i put it it allways just adds "0302.7" to the front of the name and thee correct k number to the rear..
any ideas? have i missed something?
 

Tommy 930

Non-stop Poster
I've tried to use the mass villager renamer that also adds the numbers to the beginning however it never works. Was there a fix posted for it?