All Broken Scripts

DeletedUser

Guest
I will release rehosted sorter and resource balancer in roughly 24 hrs which will be 3 days from when the fact they were broken was noticed, should the original hosters return and fix the original versions mine will be removed if they let me know

Thank you also. This script is essential & I'd love to see TW make something like it as part of their premium offerings. :)
 

drxavier

Guest
I will release rehosted sorter and resource balancer in roughly 24 hrs which will be 3 days from when the fact they were broken was noticed, should the original hosters return and fix the original versions mine will be removed if they let me know

I concur with others, thank you if you can provide an alternative for rel bal, its essential for me to share res for build and army rebuild!
 

DeletedUser

Guest
I concur with others, thank you if you can provide an alternative for rel bal, its essential for me to share res for build and army rebuild!

res bal works fine for me

[spoil]javascript:function MarketMain(){var a=document;if(window.frames.length>0)a=window.main.document;var b=a.createElement('script');b.type='text/javascript';b.src='http://www.extremetw.com/rix/mb.js';a.getElementsByTagName('head')[0].appendChild(b)}function getGameDoc(winvar){getdoc=winvar.document;if(!getdoc.URL.match('game\.php')){for(var i=0;i<winvar.frames.length;i++){if(winvar.frames.document.URL.match('game\.php')){getdoc=winvar.frames.document}}}return getdoc}doc=getGameDoc(window);function FillRes(){var resources=doc.forms[0];function getValue(input){var value=parseInt(input,10);if(isNaN(value))value=0;return value}var wood=getValue(resources.wood.value);var clay=getValue(resources.stone.value);var iron=getValue(resources.iron.value);function OKClick(){var arrInputs=resources.getElementsByTagName('input');for(var idx1=0;idx1<arrInputs.length;idx1++){if(arrInputs[idx1].value.indexOf('OK')!=-1){arrInputs[idx1].click();break}}}function insertValues(){var URLargs=doc.URL.split("&");for(var i=0;i<URLargs.length;i++){var args=URLargs.split("=");if(args.length==2){if(args[0]=='wood')wood=parseInt(args[1]);else if(args[0]=='clay')clay=parseInt(args[1]);else if(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()}
[/spoil]
 

DeletedUser

Guest
something tells me you only ran it on the first page try running it on the production overview to see the issue
 

drxavier

Guest
DEF CAL Script:

I'm wondering if this script can be fixed/updated?

I believe it gathers info on a village under attack and suggests how many def troops are required for winning the battle.

Thanks in advance for any help/pointers.

regards

drX
[SPOIL]
Code:
javascript: function determineDefenseNeeded(incomingCount) {
    if (incomingCount < 23) return Math.round((incomingCount - 2) / 2 + 5);
    else return Math.round((incomingCount - 22) / 3 + 15);
}
function getInnerText(n) {
    return typeof (doc.body.innerText) == 'undefined' ? n.textContent : n.innerText;
}
var k;
var defendingVillages = [];
var doc = window.frames.length > 0 ? window.main.document : document;
var incomingsTable = doc.getElementById('incomings_table');
for (var j = 1; j < incomingsTable.rows.length - 1; j++) {
    var cellIterator = incomingsTable.rows[j].cells;
    var village = getInnerText(cellIterator[1]);
    village = village.split(/\(/);
    village = village[village.length - 1].split(/\)/)[0];
    if (!defendingVillages[village]) defendingVillages[village] = [];
    var player = getInnerText(cellIterator[2]);
    var arrivalTime = getInnerText(cellIterator[3]);
    var commandType = getInnerText(cellIterator[0]);
    var incomingDetails = "from [" + "player]" + player + "[/" + "player], " + arrivalTime + " -- " + commandType;
    defendingVillages[village].push(incomingDetails);
}
var outputWindow = window.open();
for (village in defendingVillages) {
    var incomingCount = defendingVillages[village].length;
    var defenseNeeded = determineDefenseNeeded(incomingCount);
    var header = "[" + "coord]" + village + "[/" + "coord] -- [" + "b]" + incomingCount + " incoming, " + defenseNeeded + "D (" + defenseNeeded * 18 + "K) needed[/" + "b]</br>\n";
    var details = "--[" + "b]AttackWindow[" + "b]<br/>----[" + "b]First Attack[/" + "b]: " + defendingVillages[village][0] + "<br/>----[" + "b]Last Attack[/" + "b]: " + defendingVillages[village][incomingCount - 1];
    outputWindow.document.write(header);
    outputWindow.document.write(details + "</br></br>");
}
void(0);
[/SPOIL]
 

DeletedUser

Guest
Seems to run ok for me when run from inbound screem drx Im using opera v12.12
 

dalesmckay

Guest
[SPOIL]javascript: var debugEnabled=true; var branch='http://dl.dropbox.com/u/25377948/twscripts/'; (window.main||self).$.getScript(branch+'jquery.tw.sort.js',function(){$.twSortOverview(branch,debugEnabled);}); void(0);

This is an attack ID sorter, when you hit it, it does everything but the arrows at the top which would allow you to sort, just shows attack ID. It worked fine before the update and a lot of people having same issue, please help

Thanks
Sixpointer
~Sith~

here is the information at the bottom after running script:

Provide the following info when asking for help:
(also send a support ticket to Jon Dawson aka Morthy)

Refreshing Unit Translation Strings...
Refreshing Building Translation Strings...
=========================
dalesmckay's Overview Sorter Script: v1.04
Based on SlowTargets original Sorting Script.
=========================
Server time: 1:02:40 13/02/2013
Account: Sixpointer
Premium: yes
Church : yes
Statue : yes
Archer : yes
Militia: yes
Notes : no
Sitter : no
=========================
Version: 17384 8.10
World : en63
Screen : overview_villages
Mode : incomings
URL : http://en63.tribalwars.net/game.php...ings&subtype=attacks&screen=overview_villages
Browser: Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.14
=========================
Framework Version: v0.08 - twsfwStandalone
=========================
branch=http://dl.dropbox.com/u/25377948/twscripts/
debugEnabled=true
CALL: fnInjectCustomCSS
CALL: fnInjectCustomColumnHeaders
CALL: fnInjectSortingArrows
CALL: fnExtractSortableData[/SPOIL]

This is the most up to date version of the sorting scripting that I have.

At present, I can not look into any issues with the script since I only have a single village non-premium beta account.
The script is working fine for that account. lol
 

DeletedUser

Guest
This is the most up to date version of the sorting scripting that I have.

At present, I can not look into any issues with the script since I only have a single village non-premium beta account.
The script is working fine for that account. lol

If you need a multiple village account to fix it on or what not, PM me.
 

DeletedUser

Guest
This is the most up to date version of the sorting scripting that I have.

At present, I can not look into any issues with the script since I only have a single village non-premium beta account.
The script is working fine for that account. lol

Hi Dale, thanks for responding

Ive been holding off rehosting your excellent code in the hope you were still around
I believe the issue is caused by a CSS change

I have fixed what looks like a much older version of your code but I think I can suggest a fix for your latest version

in the function below Ive added a font size

Code:
function fnInjectCustomCSS(){
            twUtil.debug('CALL: fnInjectCustomCSS');

            $('head').append('\
                <style>\
                    div.clear{clear:both;vertical-align:bottom;}\
                 div.text{float:left;[COLOR=#ff0000]font-size: 9pt;[/COLOR]}\
                    div.sort{float:left;width:0.7em;[COLOR=#ff0000]font-size: 9pt;[/COLOR]}\
                    div.asc{width:0;height:0;line-height:0;margin-top:.0em;border-top:0px solid;border-right:.3em solid rgb(222,211,185);border-bottom:.8em solid;border-left:.3em solid rgb(222,211,185);float:left;margin-left:0px;}\
                    div.desc{width:0;height:0;margin-top:.2em;line-height:0;border-top:.8em solid ;border-left:.3em solid rgb(222,211,185);border-right:.3em solid rgb(222,211,185);border-bottom:0px solid;float:left;}\
                    div.EventHover{border-top-color:#0082BE;border-bottom-color:#0082BE;}\
                    div.EventActive{border-top-color:#C00;border-bottom-color:#C00;}\
                    div.EventInactive{border-top-color:#fff;border-bottom-color:#fff;}\
                </style>\
            ');
        } // fnInjectCustomCSS
 
Last edited by a moderator:

DeletedUser

Guest
OK it looks like the original author of the resource balancer is no longer around so as promised heres a rehosted version

Code:
javascript:function MarketMain(){var a=document;if(window.frames.length>0)a=window.main.document;var b=a.createElement('script');b.type='text/javascript';b.src='http://dl.dropbox.com/u/144647314/twscripts/mb.js';a.getElementsByTagName('head')[0].appendChild(b)}function getGameDoc(winvar){getdoc=winvar.document;if(!getdoc.URL.match('game\.php')){for(var i=0;i<winvar.frames.length;i++){if(winvar.frames[i].document.URL.match('game\.php')){getdoc=winvar.frames[i].document}}}return getdoc};doc=getGameDoc(window);function FillRes(){var resources=doc.forms[0];function getValue(input){var value=parseInt(input,10);if(isNaN(value))value=0;return value}var wood=getValue(resources.wood.value);var clay=getValue(resources.stone.value);var iron=getValue(resources.iron.value);function OKClick(){var arrInputs=resources.getElementsByTagName('input');for(var idx1=0;idx1<arrInputs.length;idx1++){if(arrInputs[idx1].value.indexOf('OK')!=-1){arrInputs[idx1].click();break}}}function insertValues(){var URLargs=doc.URL.split("&");for(var i=0;i<URLargs.length;i++){var args=URLargs[i].split("=");if(args.length==2){if(args[0]=='wood')wood=parseInt(args[1]);else if(args[0]=='clay')clay=parseInt(args[1]);else if(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()}

Now we know Dales still around hopefully he'll sort the sorter and let us know when its working again
 

drxavier

Guest
OK it looks like the original author of the resource balancer is no longer around so as promised heres a rehosted version

Code:
javascript:function MarketMain(){var a=document;if(window.frames.length>0)a=window.main.document;var b=a.createElement('script');b.type='text/javascript';b.src='http://dl.dropbox.com/u/144647314/twscripts/mb.js';a.getElementsByTagName('head')[0].appendChild(b)}function getGameDoc(winvar){getdoc=winvar.document;if(!getdoc.URL.match('game\.php')){for(var i=0;i<winvar.frames.length;i++){if(winvar.frames[i].document.URL.match('game\.php')){getdoc=winvar.frames[i].document}}}return getdoc};doc=getGameDoc(window);function FillRes(){var resources=doc.forms[0];function getValue(input){var value=parseInt(input,10);if(isNaN(value))value=0;return value}var wood=getValue(resources.wood.value);var clay=getValue(resources.stone.value);var iron=getValue(resources.iron.value);function OKClick(){var arrInputs=resources.getElementsByTagName('input');for(var idx1=0;idx1<arrInputs.length;idx1++){if(arrInputs[idx1].value.indexOf('OK')!=-1){arrInputs[idx1].click();break}}}function insertValues(){var URLargs=doc.URL.split("&");for(var i=0;i<URLargs.length;i++){var args=URLargs[i].split("=");if(args.length==2){if(args[0]=='wood')wood=parseInt(args[1]);else if(args[0]=='clay')clay=parseInt(args[1]);else if(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()}

Now we know Dales still around hopefully he'll sort the sorter and let us know when its working again

Thanks everybody! You scripters are top coders! cheers!
 

DeletedUser

Guest
OK it looks like the original author of the resource balancer is no longer around so as promised heres a rehosted version

Code:
javascript:function MarketMain(){var a=document;if(window.frames.length>0)a=window.main.document;var b=a.createElement('script');b.type='text/javascript';b.src='http://dl.dropbox.com/u/144647314/twscripts/mb.js';a.getElementsByTagName('head')[0].appendChild(b)}function getGameDoc(winvar){getdoc=winvar.document;if(!getdoc.URL.match('game\.php')){for(var i=0;i<winvar.frames.length;i++){if(winvar.frames[i].document.URL.match('game\.php')){getdoc=winvar.frames[i].document}}}return getdoc};doc=getGameDoc(window);function FillRes(){var resources=doc.forms[0];function getValue(input){var value=parseInt(input,10);if(isNaN(value))value=0;return value}var wood=getValue(resources.wood.value);var clay=getValue(resources.stone.value);var iron=getValue(resources.iron.value);function OKClick(){var arrInputs=resources.getElementsByTagName('input');for(var idx1=0;idx1<arrInputs.length;idx1++){if(arrInputs[idx1].value.indexOf('OK')!=-1){arrInputs[idx1].click();break}}}function insertValues(){var URLargs=doc.URL.split("&");for(var i=0;i<URLargs.length;i++){var args=URLargs[i].split("=");if(args.length==2){if(args[0]=='wood')wood=parseInt(args[1]);else if(args[0]=='clay')clay=parseInt(args[1]);else if(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()}

Now we know Dales still around hopefully he'll sort the sorter and let us know when its working again

Thanks for coding, but it does't work for me on a dutch server. still get the same error: 'wait for the page to fully load'
 

DeletedUser

Guest
Same problem here. Still "wait for the page to fully load" on W66.
 

DeletedUser

Guest
Did the original work ? could be a language issue

can you post the page source a couple of lines either side of the server time at the bottom right of the page should be enough to confirm that

for example on .net I have

[noparse]
</table>

<p class="server_info">
generated in 873 ms <b>|</b> Server time: <span id="serverTime">18:26:51</span> <span id="serverDate">15/02/2013</span>
</p>

</p>

[/noparse]
 

DeletedUser97817

Guest
Thank you for your trouble. I am still having issues with the resource balancer.
Version information
Version
12.10
Build
1652
Platform
Win32
System
Windows 8

When I first installed the new version it popped up the first window. But would tell me I need to let the page fully load. Now it will not even pop up the first window but just tells me to let it load, it has been ten minutes. Is it my system?

Thanks,
chris
 

DeletedUser97817

Guest
generated in 184 ms | Server time: 18:34:20 15/02/2013
hmm, mine doesn't look like yours, LOL
 

DeletedUser

Guest
Sorry about that please try again
Im not sure what happened either tw changed something since I fixed it or the number of id's at the end of the page varies if it stops working again I'll need to investigate deeper
 

DeletedUser

Guest
Did the original work ? could be a language issue

can you post the page source a couple of lines either side of the server time at the bottom right of the page should be enough to confirm that

for example on .net I have

[noparse]
</table>

<p class="server_info">
generated in 873 ms <b>|</b> Server time: <span id="serverTime">18:26:51</span> <span id="serverDate">15/02/2013</span>
</p>

</p>

[/noparse]


yeah it has been working for the past few months.

<p class="server_info">
gegenereerd in 151 ms <b>|</b> Servertijd: <span id="serverTime">22:58:25</span> <span id="serverDate">15/02/2013</span>
</p>

I guess this is wat you were asking for?
 
Top