Script repairs

valtheran88

Non-stop Poster
Reaction score
91
I am wondering if I could get some assistance repairing some scripts that I do not see an update for in the forums.

This is a simple village reorganizer by distance. Also adds the rally point to every village. The box still pops up and lets you enter coords but I assume a change in the overview page in the last few years made it so that it does not actually operate when entered.

javascript: var targetCoord = prompt('Coords Plox!', '');
if (targetCoord) {
function fnDistance(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(cc + dd)
}
var win = (window.main || self),
$ = win.$;
var table = $('[id$=_table]').filter(':not(#group_table)').get(0);
var rows = [];
var ii = ($('[src="note.png"],[class="note-icon"]').length > 0) ? 1 : 0;
var qq, coord, row, cell, villageID, distance;
$('.dsm').remove();
$('<th class="dsm">Distance</th><th class="dsm">Rp</th>').insertAfter($(table.tBodies[0].rows[0]).find('th:eq(' + ii + ')'));
for (qq = 1; qq < table.tBodies[0].rows.length; qq++) {
row = table.tBodies[0].rows[qq];
coord = $.trim($(row.cells[ii]).text()).match(/\d+|\d+/g);
coord = coord ? coord[coord.length - 1] : null;
distance = fnDistance(coord, targetCoord);
villageID = $(row.cells[ii]).html().match(/village=\d+/);
cell = row.insertCell(ii + 1);
cell.className = 'dsm';
cell.innerHTML = distance.toFixed(2);
cell = row.insertCell(ii + 2);
cell.className = 'dsm';
cell.innerHTML = '<a href="' + win.game_data.link_base_pure.replace(/village=\d/i, villageID).replace(/screen=\w/i, 'screen=place') + '" target="_blank"><img src="graphic/buildings/place.png" alt="Rally point" width="16" height="16"/></a>';
rows[qq - 1] = [distance, row];
}
rows = rows.sort(function(a, b) {
return a[0] - b[0];
});
for (qq = 0; qq < rows.length; qq++) {
table.tBodies[0].appendChild(rows[qq][1]);
}
}
void(0);


This is a simple in game clock stop

deleted i forgot about clicking the time in the bottom right to stop clocks.
 
Last edited:
Top