Question Uberfarm script?

DeletedUser

Guest
Could somebody offer me some help with the script that I'm using two posts up

It's grossly overestimating the resources present in the village :S
 

DeletedUser

Guest
Could somebody offer me some help with the script that I'm using two posts up

It's grossly overestimating the resources present in the village :S

try changing the target Haul value to something closer to what your farmers are finding something like targetHaul: 1000,
 

DeletedUser

Guest
I have a script, I think its this one, I am trying to get it so that the 'attack' box is highlighted when I use the script when choosing troop numbers, so I can press 'Enter' twice... Can I add something to script so that it will do this?
 

DeletedUser

Guest
well minhaul should be less than max if you reduced maxhaul to 1000 but didnt reduce min at the same times perhaps that was the issue
 

DeletedUser

Guest
paste your script with code tags (and preferred haul values) and I'll take a look for you
 

DeletedUser

Guest
Thanks lonestar. I've pasted the script below.
It's telling me to send 124 LC at a barb (that already has an attack enroute btw) whereas FA suggests I only send 11 LC :/

Code:
javascript: var config = { 
fields: 30, 
minHaul: 500, 
targetHaul: 10000, 
scout: true, 
hours: 5, 
farms: '790|604 789|605 788|604 787|604 790|606 787|603 790|602 787|602 791|602 789|601 791|607 792|606 786|605 792|603 789|608 791|600 785|606 793|602 787|608 792|600 785|601 784|604 789|609 792|608 788|609 791|599 787|609 785|608 793|608 785|600 793|600 794|607 788|610 790|610 788|598 795|605 791|598 784|608 785|599 786|610 789|597 788|611 788|597 790|611 794|599 782|603 785|598 793|610 795|608 793|598 785|610 787|611 782|602 786|597 782|601 784|610 783|599 789|612 797|604 790|612 785|611 797|603 788|596 797|605 781|605 793|611 781|602 783|610 795|598 781|601 794|611 794|597 797|608 780|604 798|604 790|595 788|613 782|598 780|606 780|602 798|606 784|596 797|609 798|601 780|601 798|600 796|597' }; $.getScript('http://dl.dropbox.com/u/24469843/Tribalwars/Scripts/uberfarmArcherWorld.js'); void (0);
 

DeletedUser

Guest
Ok I feel a little bit stupid.

the script works exactly as it should. I thought uberfarm was like twfr in that it sent the exact number of troops to loot all the resources in that village :S

Instead it sends a static number of troops to villages that fall under the criteria :)

Sorry for the hassle chief.

Is there any way to get it to acknowledge attacks that are being sent to farms from OTHER villages so that it doesn't double up on the attacks?

Cheers
 

DeletedUser

Guest
Ahh

dunno mate its not a script I use but I know its used a lot by others so thought if there were a problem I could probably look into it

Adding a send in order type thing sounds possible but isn't something I'd spend time on tbh, still Im glad the script is working as it should be
 

DeletedUser

Guest
possibly, its illegal for a script to highlight the attack button BUT if the script leave the coords box focused you can get the same result by pressing enter, paste your script and I may be able to help

If you'ld rather not paste it see my previous post that described how to do this on a different script

http://forum.tribalwars.net/showthread.php?106293-Farming-script&p=6711838&viewfull=1#post6711838


Here is my script mate:

Code:
javascript:var cook="6883433";sp=0;sw=0;ax=0;scout=1;lc=2;hv=0;cat=0;ra=0;no=0;kn=0;coords="356|641 355|641 357|639 356|642 354|641 357|642 358|642 353|638 353|641 360|639 352|639 360|642 352|643 351|640 353|636 351|639 361|638 358|635 361|637 351|643 356|646 362|640 351|644 359|634 353|646 362|643 355|647 363|641 360|634 363|638 349|642 359|647 351|646 362|645 355|648 363|644 348|641 357|632 360|633 348|642 358|632 364|638 362|634 353|648 348|643 363|635 349|635 363|645 360|632 356|649 365|639 365|641 347|638 348|635 365|643 365|644 347|636 347|644 352|631 365|636 349|647 346|640 362|632 364|634 356|650 356|630 358|650 346|638 365|645 361|631 366|637 363|648 362|631 365|646 350|649 345|641 345|639 357|651 367|639 360|629 346|635 367|638 366|635 347|633 345|637 367|637 350|650 347|648 355|628 348|631 364|631 345|635 354|628 358|652 344|642 358|628 344|638 344|637 359|652 360|652 368|636 366|632 348|650 345|633 367|633 355|627 349|652 343|642 354|653 343|638 343|637 359|653 359|627 353|627 369|637 362|628 350|628 350|652 347|630 365|630 360|627 369|644 343|635 342|639 366|630 358|626 354|626 342|638 345|649 367|649 347|629 367|631 359|626 353|654 350|653 342|637 369|634 344|648 370|644 349|653 351|626 366|629 367|650 370|645 367|630 346|629 371|640 356|655 368|631 341|639 357|625 360|625 354|655 350|654 364|627 359|655 353|625 367|651 366|652 366|628 370|647 369|649 361|625 372|639 353|624 372|637 359|624 340|645 342|632 342|648 340|638 348|654 358|624 372|642 340|642 362|625 371|646 350|625 341|634 360|624 372|644 341|633 371|633 349|655 373|640 373|639 367|627 372|634 370|650 353|657 359|623 369|652 339|645 370|629 348|624 341|650 346|625 371|630 374|639 338|641 374|641 350|623 339|633 363|657 369|627 374|646 374|634 350|658 338|646 338|634 362|622 338|638 358|658 359|622 374|637 347|656 365|656 370|628 360|622 370|652 344|626 345|625 371|651 361|622 338|635 ";var%20doc=document;if(window.frames.length>0)doc=window.main.document;url=document.URL;if(url.indexOf("screen=place")==-1)alert("This%20script%20needs%20to%20be%20run%20from%20the%20rally%20point");coords=coords.split("%20");index=0;farmcookie=document.cookie.match("(^|;) ?"+cook+"=([^;]*)(;|$)");if(farmcookie!=null)index=parseInt(farmcookie[2]);if(index>=coords.length)alert("last village");if(index>=coords.length)index=0;coords=coords[index];coords=coords.split("|");index=index+1;cookie_date=new%20Date(2015,11,11);document.cookie =cook+"="+index+";expires="+cookie_date.toGMTString ();doc.forms[0].x.value=coords[0];doc.forms[0].y.value=coords[1];insertUnit(doc.forms[0].spear,sp);insertUnit(doc.forms[0].knight,kn);insertUnit(doc.forms[0].snob,no);insertUnit(doc.forms[0].sword,sw);insertUnit(doc.forms[0].axe,ax);insertUnit(doc.forms[0].spy,scout);insertUnit(doc.forms[0].light,lc);insertUnit(doc.forms[0].heavy,hv);insertUnit(doc.forms[0].ram,ra);insertUnit(doc.forms[0].catapult,cat);end();
 

DeletedUser

Guest
Code:
javascript:var cook="6883433";sp=0;sw=0;ax=0;scout=1;lc=2;hv=0;cat=0;ra=0;no=0;kn=0;coords="356|641 355|641 357|639 356|642 354|641 357|642 358|642 353|638 353|641 360|639 352|639 360|642 352|643 351|640 353|636 351|639 361|638 358|635 361|637 351|643 356|646 362|640 351|644 359|634 353|646 362|643 355|647 363|641 360|634 363|638 349|642 359|647 351|646 362|645 355|648 363|644 348|641 357|632 360|633 348|642 358|632 364|638 362|634 353|648 348|643 363|635 349|635 363|645 360|632 356|649 365|639 365|641 347|638 348|635 365|643 365|644 347|636 347|644 352|631 365|636 349|647 346|640 362|632 364|634 356|650 356|630 358|650 346|638 365|645 361|631 366|637 363|648 362|631 365|646 350|649 345|641 345|639 357|651 367|639 360|629 346|635 367|638 366|635 347|633 345|637 367|637 350|650 347|648 355|628 348|631 364|631 345|635 354|628 358|652 344|642 358|628 344|638 344|637 359|652 360|652 368|636 366|632 348|650 345|633 367|633 355|627 349|652 343|642 354|653 343|638 343|637 359|653 359|627 353|627 369|637 362|628 350|628 350|652 347|630 365|630 360|627 369|644 343|635 342|639 366|630 358|626 354|626 342|638 345|649 367|649 347|629 367|631 359|626 353|654 350|653 342|637 369|634 344|648 370|644 349|653 351|626 366|629 367|650 370|645 367|630 346|629 371|640 356|655 368|631 341|639 357|625 360|625 354|655 350|654 364|627 359|655 353|625 367|651 366|652 366|628 370|647 369|649 361|625 372|639 353|624 372|637 359|624 340|645 342|632 342|648 340|638 348|654 358|624 372|642 340|642 362|625 371|646 350|625 341|634 360|624 372|644 341|633 371|633 349|655 373|640 373|639 367|627 372|634 370|650 353|657 359|623 369|652 339|645 370|629 348|624 341|650 346|625 371|630 374|639 338|641 374|641 350|623 339|633 363|657 369|627 374|646 374|634 350|658 338|646 338|634 362|622 338|638 358|658 359|622 374|637 347|656 365|656 370|628 360|622 370|652 344|626 345|625 371|651 361|622 338|635 ";var%20doc=document;if(window.frames.length>0)doc=window.main.document;url=document.URL;if(url.indexOf("screen=place")==-1)alert("This%20script%20needs%20to%20be%20run%20from%20the%20rally%20point");coords=coords.split("%20");index=0;farmcookie=document.cookie.match("(^|;) ?"+cook+"=([^;]*)(;|$)");if(farmcookie!=null)index=parseInt(farmcookie[2]);if(index>=coords.length)alert("last village");if(index>=coords.length)index=0;coords=coords[index];coords=coords.split("|");index=index+1;cookie_date=new%20Date(2015,11,11);document.cookie =cook+"="+index+";expires="+cookie_date.toGMTString ();doc.forms[0].x.value=coords[0];doc.forms[0].y.value=coords[1];insertUnit(doc.forms[0].spear,sp);insertUnit(doc.forms[0].knight,kn);insertUnit(doc.forms[0].snob,no);insertUnit(doc.forms[0].sword,sw);insertUnit(doc.forms[0].axe,ax);insertUnit(doc.forms[0].spy,scout);insertUnit(doc.forms[0].light,lc);insertUnit(doc.forms[0].heavy,hv);insertUnit(doc.forms[0].ram,ra);insertUnit(doc.forms[0].catapult,cat);doc.forms[0].y.focus();end();


try that once its entered troop levels and coords coord box will be hilighted blue just press return and it should proceed to the attack confirmation screen
 

DeletedUser

Guest
Does this only work with premium? I've bookmarked it, but it doesn't seem to be working
 

DeletedUser

Guest
are we talking about uberfarm or the script you posted above ?

if the later please make your own thread as this is for the uberfarm script, thanks
 

DeletedUser

Guest
Code:
(function () {    try {        var capacity = [25, 15, 10, 10, 0, 80, 50, 50, 0, 0, 100, 0];        var doc = document;        if (window.frames.length > 0) doc = window.main.document;        var url = document.URL;        if (url.indexOf('screen=place') == -1) {            alert('This script needs to be run from the rally point');            return;        }        if (localStorage['uberfarmFarms']) config.farms = localStorage['uberfarmFarms'];        var currentTime = (doc.getElementById('serverDate').firstChild.nodeValue + ' ' + doc.getElementById('serverTime').firstChild.nodeValue).match(/\d+/g);        var currentTime = new Date(currentTime[2], currentTime[1] - 1, currentTime[0], currentTime[3], currentTime[4], currentTime[5]).getTime();        var node = doc.forms[0].textContent;        var openParen = 0;        var closedParen = 0;        var troopCount = {};        var totalCap = 0;        var troops = ['spear', 'sword', 'axe', 'archer', 'spy', 'light', 'marcher', 'heavy', 'ram', 'catapult', 'knight'];        for (i = 0; i < troops.length; i++) {            var troop = parseInt(document.units[troops[i]].parentNode.getElementsByTagName('a')[1].innerHTML.match(/\d+/), 10);            troopCount[i] = parseInt(troop);            if (troopCount[i] < 2) {                troopCount[i] = 0;            }            totalCap += troopCount[i] * capacity[i];        }        var goal, remainder, loads;        if (totalCap < config.minHaul) {            setTimeout(function () {                window.close();            }, 500);            return;        }        else {            goal = config.targetHaul;            remainder = totalCap % goal;            if (remainder != 0) {                loads = Math.floor(totalCap / goal);                if (remainder / loads <= (goal - remainder) / (loads + 1)) goal += remainder / loads;                else {                    loads++;                    goal = totalCap / loads;                }            } else {                loads = totalCap / goal;            }        }        var node = document.getElementById('menu_row2').getElementsByTagName('b')[0];        var coords = node.innerHTML.substring(1, 8);        var cVil = {};        cVil.x = parseInt(coords.split('|')[0]);        cVil.y = parseInt(coords.split('|')[1]);        var options = [];        var data = config.farms.split(' ');        for (var a = 0; a < data.length; a++) {            var d = data[a].split('|');            var x = Math.abs(parseInt(d[0]) - cVil.x);            var y = Math.abs(parseInt(d[1]) - cVil.y);            var dist = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));            if (dist <= config.fields) options.push({                coords: data[a],                distance: dist            });        }        options.sort(function (a, b) {            return a.distance - b.distance;        });        if (options.length == 0) {            alert('There are no farms in range of this village');            return;        }        var prospect = [];        var target = -1;        var store = localStorage['uberfarmData'] || "";        if (store.length == 0) {            var target = 0;            var preCookie = "",                postCookie = "";        }        else {            for (var a = 0; a < options.length; a++) {                index = store.indexOf(options[a].coords);                if (index == -1) {                    var target = a;                    var preCookie = store + "_",                        postCookie = "";                    break;                } else {                    var preCookie = store.substring(0, index);                    var tcookie = store.substring(index);                    var index = tcookie.indexOf("_");                    if (index != -1) {                        var postCookie = tcookie.substring(index);                        tcookie = tcookie.substring(0, index);                    }                    else var postCookie = "";                    var lastTime = parseInt(tcookie.substring(tcookie.indexOf(":") + 1));                    var deltaTime = currentTime - lastTime;                    if (deltaTime > config.hours * 60 * 60 * 1000) {                        var target = a;                        break;                    } else prospect.push({                        deltaTime: deltaTime,                        target: a,                        preCookie: preCookie,                        postCookie: postCookie                    });                }            }        }        if (target == -1) {            prospect.sort(function (a, b) {                return b.deltaTime - a.deltaTime;            });            var target = prospect[0].target;            preCookie = prospect[0].preCookie;            postCookie = prospect[0].postCookie;        }        if (timers.length > 0) timers = [];        var target = options[target].coords;        var targetCoords = target.split('|');        doc.forms[0].x.value = targetCoords[0];        doc.forms[0].y.value = targetCoords[1];        var fields = [        document.forms[0].spear,        document.forms[0].sword,        document.forms[0].axe,        document.forms[0].archer,        document.forms[0].spy,        document.forms[0].light,        document.forms[0].marcher,        document.forms[0].heavy,        document.forms[0].ram,        document.forms[0].catapult,        document.forms[0].knight,        document.forms[0].snob        ];        goal = config.targetHaul;               var troopOrder = [5];        var count = 0;        for (var i = 0; i < troopOrder.length && count < goal; i++) {            var j = troopOrder[i];            if (!troopCount[j]) continue;            var troops = Math.ceil((goal - count) / capacity[j]);            if (troops > troopCount[j]) troops = troopCount[j];            count += capacity[j] * troops;            fields[j].value = troops;        }        if (config.rams && troopCount[8] >= config.rams) {            var rams = 0,                i = loads;            while (rams < config.rams && i > 0) {                rams = Math.floor(troopCount[8] / i);                i--;            }            fields[8].value = rams;        }        if (config.cats && troopCount[9] >= config.cats) {            var cats = 0,                i = loads;            while (cats < config.cats && i > 0) {                cats = Math.floor(troopCount[9] / i);                i--;            }            fields[9].value = cats;        }        if (troopCount[4] > 1 && config.scout) {            fields[4].value = 4;        }        var store = preCookie + target + ":" + currentTime + postCookie;        localStorage['uberfarmData'] = store;    }    catch (e) {        alert(e);    }})();

hey matt, heres the code with it edited to only send LC. you need to save this code as a .js file and host it form your own dropbox... then replace the url in the script with the url to your own hosted script.

ive edited it for 2 things, to only send lc, and will also now send out lc even if you have less than 10 lc in the rally point. useful for micro farming.

the only snag with editing out the lc and wasnt sure how to fix is if troops other than lc are home, it will not close tabs as rally points empty of lc, cos the script still interprets troops being home.

if you want to change the scout value, just change the spy volume near the bottom of the script


in relation to the storage script, i havnt tried it out yet but having the popup box wasnt really what i was asking for, the old storage script would bring up a notebook like window you could see the entire farm list and edit easily. i would love a script like this again for uber, its a pain in the ass to keep editing it in notebook and copy and pasting into my bookmarks.

the old uber script also use to work better for me, i could zoom through the tabs quicker entering the script without it mixing up targets and sending duplicate famring runs. with this version i have to press my shorcuts maybe 1 or 2 a second for it to work without error. oh well, looks like that one wont come back unless anybody has a copy of the original hosted script from twpawnage

can someone please send me a pm explaining how to set up a drop box?
or how to host a script from a site to try and make this script work again?

thanks for any help
zero
 

DeletedUser

Guest
Hi!
This script is too complicated for me. Can you rewrite it so if I go to the rally point from the map (and it puts the coordinates in the field) it fills out the troop's fields?
Thanks :)
 
Top