Request Coordinate grabber

DeletedUser102431

Guest
Looking for the coordinate grabber that opens a side window and you just press on the villages for it to add it´s coordinates to the list.

Would be very helpful if anyone could post that script if they got it.
 

pokemonEX.co.UK

Still Going Strong
Reaction score
51
Code:
javascript: var win = (window.frames.length > 0) ? window.main : window; var coords = []; var outputID = 'villageList'; var encodeID = 'cbBBEncode'; var isEncoded = true; function fnRefresh() { win.$('#' + outputID).text(coords.map(function (e) { return isEncoded ? '[coord]' + e + '[\/coord]' : e; }).join(isEncoded ? '\n' : ' ')); } win.$(win.document).ready(function () { if (win.$('#' + outputID).length <= 0) { if (win.game_data.screen == 'map') { var srcHTML = '<div id="coord_picker">' + '<span style="color:blue;text-decoration:underline;"></span><br/><br/>' + '<input type="checkbox" id="cbBBEncode" onClick="isEncoded=this.checked;fnRefresh();"' + (isEncoded ? 'checked' : '') + '/>BB-Codes<br/>' + '<textarea id="' + outputID + '" cols="40" rows="10" value="" onFocus="this.select();"/>' + '</div>'; ele = win.$('body').append(win.$(srcHTML)); win.TWMap.map.handler.onClick = function (x, y, e) { var village = TWMap.villages[x * 1000 + y]; if (village) { var coord = x+"|"+y; var ii = coords.indexOf(coord); if (ii >= 0) { coords.splice(ii, 1); } else { coords.push(coord); } } fnRefresh(); return false } } else { alert("This script must be run on the map. \ NIt now redirect ..."); self.location = win.game_data.link_base_pure.replace(/screen\=\w*/i, "screen=map"); } } }); void(0);
 

pokemonEX.co.UK

Still Going Strong
Reaction score
51
it works for me

Code:
javascript: var win = (window.frames.length > 0) ? window.main : window; var coords = []; var outputID = 'villageList'; var encodeID = 'cbBBEncode'; var isEncoded = true; function fnRefresh() { win.$('#' + outputID).text(coords.map(function (e) { return isEncoded ? '[coord]' + e + '[\/coord]' : e; }).join(isEncoded ? '\n' : ' ')); } win.$(win.document).ready(function () { if (win.$('#' + outputID).length <= 0) { if (win.game_data.screen == 'map') { var srcHTML = '<div id="coord_picker">' + '<span style="color:blue;text-decoration:underline;"></span><br/><br/>' + '<input type="checkbox" id="cbBBEncode" onClick="isEncoded=this.checked;fnRefresh();"' + (isEncoded ? 'checked' : '') + '/>BB-Codes<br/>' + '<textarea id="' + outputID + '" cols="40" rows="10" value="" onFocus="this.select();"/>' + '</div>'; ele = win.$('body').append(win.$(srcHTML)); win.TWMap.map.handler.onClick = function (x, y, e) { var village = TWMap.villages[x * 1000 + y]; if (village) { var coord = x+"|"+y; var ii = coords.indexOf(coord); if (ii >= 0) { coords.splice(ii, 1); } else { coords.push(coord); } } fnRefresh(); return false } } else { alert("This script must be run on the map. \ NIt now redirect ..."); self.location = win.game_data.link_base_pure.replace(/screen\=\w*/i, "screen=map"); } } }); void(0);
 

DeletedUser58259

Guest
I like this a bit more
(was dalesmckay or gramps I believe, approved a very long time ago in case a mod is curious)

[spoil]
Code:
/*javascript:
var format = "{image} {NL} {index} {coord} {player} {points} {tag} {tribename} {kk} {x} {y} {tribepoints} {playerpoints} {playerid} {villageid} {tribeid}";
$.getScript("https://ben.wtb.cc//maps.js"); 
void(0);
*/


if (format === undefined) { var format = "K{kk} [coord]{coord}[/coord] {points}{NL\}"; }
var win = (window.frames.length > 0) ? window.main : window;
var index = 0;
var outputID = 'villageList';
$(document).ready(function () {
    if ($('#' + outputID).length <= 0) {
        if (game_data.screen == 'map') {
            var srcHTML = '<div id="coord_picker">' + '<span style="color:blue;text-decoration:underline;">dalesmckay\'s co-ordinate picker v7.1:</span><br/><br/><textarea id="' + outputID + '" cols="40" rows="10" value="" onFocus="this.select();"/>' + '</div>';
            ele = win.$('body').append(win.$(srcHTML));
            win.TWMap.map._handleClick = function (e) {
                index++;
                var pos = this.coordByEvent(e);
                var x = pos[0];
                var y = pos[1];
                var coord = pos.join("|");
                coordidx = x * 1000 + y,
                village = TWMap.villages[coordidx];
                var ownername, ownerpoints, tribetag, tribename, tribepoints, ownerally;
                if (village.owner == 0) {
                    ownername = "";
                    ownerpoints = 0;
                }
                else {
                    owner = TWMap.players[village.owner];


                    if (TWMap.allies[TWMap.players[village.owner]] > 0) {
                        tribetag = TWMap.allies[TWMap.players[village.owner].ally].tag;
                        tribename = TWMap.allies[TWMap.players[village.owner].ally].name;
                        tribepoints = TWMap.allies[TWMap.players[village.owner].ally].points;
                        ownerally = owner.ally;
                        tribe = TWMap.allies[TWMap.players[village.owner].ally];
                    }
                    else {
                        tribe = "";
                        tribetag = "";
                        tribename = "";
                        tribepoints = "";
                        ownerally = 0;
                    }
                }
                var image = "";
                if (village.bonus) {
                    image = village.bonus[1];
                }


                var data = format.replace("{coord\}", coord)
                .replace("{player\}", ownername)
                .replace("{playerpoints\}", ownerpoints)
                .replace("{playerid\}", village.owner)
                .replace("{villageid\}", village.id)
                .replace("{points\}", village.points.replace(".", ""))
                .replace("{tag\}", tribetag)
                .replace("{tribename\}", tribename)
                .replace("{tribepoints\}", tribepoints)
                .replace("{tribeid\}", ownerally)
                .replace("{x\}", x)
                .replace("{y\}", y)
                .replace("{kk\}", TWMap.con.continentByXY(x, y))
                .replace("{image\}", 'http://' + document.URL.split('/')[2] + '/graphic/' + image)
                .replace("{index\}", index)
                .replace("{NL\}", "\n");
                
                document.getElementById(outputID).innerHTML += data;
                /* $('#' + outputID).value += data + "\n";*/
                return false;
            };
        } else {
            alert("Run this script from the Map.\nRedirecting now...");
            self.location = win.game_data.link_base_pure.replace(/screen\=\w*/i, "screen=map");
        }
    }
});
void (0);

[/spoil]
 
Last edited by a moderator:

DeletedUser98932

Guest
Can anyone help me with this script? It's selects coords of barbarian villages on the map and really helps me a lot with farming, but sadly I doesn't work anymore. Does anyone know how to fix this? Pretty please? :)

Code:
javascript: var author = "Stotty2009 but most of the code is from: dalesmckay@gmail.com"; var minVer = "7.2"; var win = (window.frames.length > 0) ? window.main : window; var ver = win.game_data.version.match(/[\d|\.]+/g); function getMode() { mode = prompt("b for barb villages, p for player villages, or t for tribe villages", "p"); mode = mode.toLowerCase(); checkMode() } function checkMode() { if (mode == 'p') { playername = prompt("which player pl0x?", "Stotty2009") + ' ' } else if (mode == 't') { tribename = prompt("which tribe pl0x?", "Crazy Muthas") } else if (mode == 'b') { } else { getMode() } } getMode(); function trim(str) { return str.replace(/^\s+|\s+$/g, "") } if (!ver || (parseFloat(ver[1]) < minVer)) { alert("This script requires v" + minVer + " or higher.\nYou are running: v" + ver[1]) } else { if (win.game_data.screen == "map") { var coords = []; var col, row, coord, village, player, points; for (row = 0; row < TWMap.size[1]; row++) { for (col = 0; col < TWMap.size[0]; col++) { coord = TWMap.map.coordByPixel(TWMap.map.pos[0] + (TWMap.tileSize[0] * col), TWMap.map.pos[1] + (TWMap.tileSize[1] * row)); if (coord) { village = TWMap.villages[coord.join("")]; if (village) { player = null; if (parseInt(village.owner || "0", 10)) { player = TWMap.players[village.owner]; var ally = TWMap.allies[player.ally] } if (player) { if (mode == "p") { if (trim(player.name) == trim(playername)) { coords.push(coord.join("|")) } } else if (mode == "t") { if (ally) { if (trim(ally.name) == trim(tribename)) { coords.push(coord.join("|")) } } } } else { if (mode == "b") { coords.push(coord.join("|")) } } } } } } document.write(coords.join(" ")) } else { alert("Run this script from the Map.\nRedirecting now..."); self.location = win.game_data.link_base_pure.replace(/screen\=/i, "screen=map") } } void (o);
 

DeletedUser

Guest
I have tried that script on the dutch server ( with the browsers opera 12 and chrome ) and there it works, so I think it should work, however I have slightly changed the code (which was not necessary for me):
PHP:
javascript: var author = "Stotty2009 but most of the code is from: dalesmckay@gmail.com Edited by .Arrogant";var mode, playername, tribename;function getMode() {mode = prompt("b for barb villages, p for player villages, or t for tribe villages", "p");mode = mode.toLowerCase();checkMode()}function checkMode() {if (mode == 'p') {playername = prompt("which player pl0x?", "Stotty2009") + ' '} else if (mode == 't') {tribename = prompt("which tribe pl0x?", "Crazy Muthas")} else if (mode == 'b') {} else {getMode()}}function trim(str) {return str.replace(/^\s+|\s+$/g, "")}if(game_data.screen == "map") {getMode();var coords = [];var col, row, coord, village, player, points;for (row = 0; row < TWMap.size[1]; row++) {for (col = 0; col < TWMap.size[0]; col++) {coord = TWMap.map.coordByPixel(TWMap.map.pos[0] + (TWMap.tileSize[0] * col), TWMap.map.pos[1] + (TWMap.tileSize[1] * row));if (coord) {village = TWMap.villages[coord.join("")];if (village) {player = null;if (parseInt(village.owner || "0", 10)) {player = TWMap.players[village.owner];var ally = TWMap.allies[player.ally]}if (player) {if (mode == "p") {if (trim(player.name) == trim(playername)) {coords.push(coord.join("|"))}} else if (mode == "t") {if (ally) {if (trim(ally.name) == trim(tribename)) {coords.push(coord.join("|"))}}}} else {if (mode == "b") {coords.push(coord.join("|"))}}}}}}document.write(coords.join(" "))} else {alert("Run this script from the Map.\nRedirecting now...");location.href = game_data.link_base_pure.replace(/screen\=/i, "screen=map")}void(0);

if the changed version doesn`t work, let me know

and excuse me for my bad english (you may correct me, so that I learn better english ^^) :p
 

DeletedUser98932

Guest
Thanks mate. This one works just fine. Idk why mine stopped working... Thanks again. :D
 

DeletedUser

Guest
np, if there are more scripts that needs fixing, just ask and I will look into it ;)
 
Top