Farming script?

busamad

Contributing Poster
Reaction score
34
Try it now:

[spoil]
Code:
javascript:coords='446|499 447|497';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('(^|;)?farm1=([^;]*)(;|$)');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(2099,11,11);document.cookie="farm1="+index+";expires="+cookie_date.toGMTString();doc.forms[0].x.value=coords[0];doc.forms[0].y.value=coords[1];Array.prototype.contains=function(obj){var i,listed=false;for(i=0;i<this.length;i++){if(this[i]===obj){listed=true;break}}return listed};function getGameDoc(){getdoc=window.document;if(!getdoc.URL.match('game\.php')){for(var i=0;i<window.frames.length;i++){if(window.frames[i].document.URL.match('game\.php')){getdoc=window.frames[i].document}}}return getdoc};units=Array('spear','sword','axe','archer','spy','light','heavy','marcher','knight');doc=getGameDoc();form=doc.units;inputs=form.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(inputs[i].type=='text'){if(units.contains(inputs[i].name)){next=inputs[i].nextSibling;do{next=next.nextSibling}while(next.nodeType!=1);s=next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name],next.firstChild.nodeValue.replace(/\(/g,"").replace(/\)/g,""))}}}
[/spoil]

Works with old units as well.

You can add or remove units from this :

Array('spear','sword','axe','archer','spy','light' ,'heavy','marcher','knight')

Depending on what you want to send.

The script above did not work until I removed all the gaps that are in the script due to the way it was copied & reposted examples:

lengtHereh>0
if(uHererl.indexOf
=cHereoords

It happens all the time & its getting old now.
 
Last edited:

DeletedUser77700

Guest
Try it now:

[spoil]
Code:
javascript:coords='446|499 447|497';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%20f rom%20the%20rally%20point');coords=coords.split("% 20");index=0;farmcookie=document.cookie.match('(^| ;) ?farm1=([^;]*)(;|$)');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(2099,11,11);document.cookie ="farm1="+index+";expires="+cookie_date.toGMTString ();doc.forms[0].x.value=coords[0];doc.forms[0].y.value=coords[1];Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('spear','sword','axe','archer','spy','light' ,'heavy','marcher','knight');doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, ""));}}}
[/spoil]

Works with old units as well.

You can add or remove units from this :

Array('spear','sword','axe','archer','spy','light' ,'heavy','marcher','knight')

Depending on what you want to send.

The script above did not work until I removed all the gaps that are in the script due to the way it was copied & reposted examples:

lengtHereh>0
if(uHererl.indexOf
=cHereoords

It happens all the time & its getting old now.

The problem with it now is it keeps repeating the same village.

It also shows 1 and a half of a co ord:

tw1d.jpg


I very much appreciate your time.
 

busamad

Contributing Poster
Reaction score
34
Updated the script I posted above missed a gap :(

Note like many fake scripts it reads the first set of coords last.
 

DeletedUser

Guest
Could someone please fix this farming script for me? Basically all I want is for the script to cycle through each of those coords sending 15 sps and 3 axes.

This script use to work fine before I stopped playing a few months ago but I've come back and its stopped working, strangely.

See the part
Code:
new%20Date(2009,11,11)

It is set for an older date; update it to something in the future and it should work until that date. I'm not very good at scripting, but I used that one and that was the fix there. If someone can remove that part and keep the script in tact that would be great.
 

DeletedUser

Guest
Is there a script where it just inputs 10 lc and 1 scout? :|
 

busamad

Contributing Poster
Reaction score
34
Yes you can use near enough any, all you need to do is change the numbers.

Things like in order or random plus unit type for some worlds do need to be looked at as well.
 

DeletedUser

Guest
This still good ?
<Illegal script removed>

I mean is it legal ?

Or maybe this one
javascript:var[sp,sw,ax,ar,scout,lc,mount,hv,cat,ra]=[0,0,0,0,1,50,0,0,0,0];coords=' 624|524 623|521 624|521 625|521 626|523 622|520 623|526 620|522 623|527 624|527 619|521 618|523 627|526 625|518 618|521 625|528 622|517 629|523 620|528 629|522 623|529 627|528 619|517 616|522 616|524 619|516 616|519 630|519 617|529 616|529 630|516';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('(^|;) ?farm=([^;]*)(;|$)');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(2009,11,11);document.cookie ="farm="+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].sword,sw);insertUnit(doc.forms[0].axe,ax);insertUnit(doc.forms[0].archer,ar);insertUnit(doc.forms[0].spy,scout);insertUnit(doc.forms[0].light,lc);insertUnit(doc.forms[0].marcher,mount);insertUnit(doc.forms[0].heavy,hv);insertUnit(doc.forms[0].ram,ra);insertUnit(doc.forms[0].catapult,cat);end();
 
Last edited by a moderator:

DeletedUser81829

Guest
This still good ?
I mean is it legal ?

Or maybe this one

They should both be fine, but just like the script a few posts ago you need to change the "Date(2009,11,11)" part to a date in the future or it won't work. 2010,11,11 for example :icon_wink:
 

DeletedUser

Guest
They should both be fine, but just like the script a few posts ago you need to change the "Date(2009,11,11)" part to a date in the future or it won't work. 2010,11,11 for example :icon_wink:

Thank you for answering, now i still have an unanswered thought:

The second one that i showed you it's a little bit wrecked but don't know where or why ... when it skips to next village it doesn't insert troops :| that if u don't attack let's say first village ... press again and next village coords are inserted but troops aren't .... i don't remember well but i think it is like this from the begining and it's not a wreck ... if u attack first , then click for next it inserts troops ...
Someone could fix the problem to skip villages and insert troops asswell ? :X preety please ?

If u haven't understood anything i'm sorry but it's tricky to make people understand some codes in a script :)
 

DeletedUser81829

Guest
The first one is a pretty nice script, click it once and it enters the troops and coords, again and it clicks attack, and a third time it clicks ok (pretty sure it's not illegal either since it only performs 1 action per click).

I agree the 2nd one is a bit of a mess, but if you have one that works then why worry about it?

Take a look at http://zomgtw.net/, it's a nice new site that you can use to generate farming scripts if you are having problems with older scripts.
 

2004 Artemis

Guest
The first one is a pretty nice script, click it once and it enters the troops and coords, again and it clicks attack, and a third time it clicks ok (pretty sure it's not illegal either since it only performs 1 action per click).

Actually, it's completely illegal for a script to click or focus on the Attack or the Attack Confirmation (Ok) buttons.
 

DeletedUser81829

Guest
Hmmm, I was just going by this:

§7) Bots and Scripts


Tribal Wars should be played with a normal browser only. Bots, browser add-ons and other applications that automate game activities are forbidden. All Greasemonkey scripts are forbidden.

Premium players are permitted to add approved JavaScript commands to their quick bar. These scripts are allowed to help players by doing things such as automatically filling in forms (like troop recruitment). However, they may not perform more than one action per click.

If you are not sure if a script or tool is allowed you should always ask the support team first. In addition to this, we keep this thread updated with all legal quick bar scripts. If you have a script that doesn't appear here, you must submit a ticket for approval or ask in the scripts forum before installing it.

Tools are permitted to use our world data provided they request it no more than once per hour.


Disclaimer: I would recommend you get approval first since I don't claim to be any kind of expert or authority on the matter.
 

2004 Artemis

Guest
Hmmm, I was just going by this:

Disclaimer: I would recommend you get approval first since I don't claim to be any kind of expert or authority on the matter.

However, you didn't click the » more button, which shows:
Examples:

The use of external tools (such as http://www.twstats.com) is allowed, provided that they do not interact with the game in any way.
All scripts in this topic have been approved can be used.
It is expressly forbidden to offer or use any kind of tool that mimics premium account features.
It is forbidden to install any kind of script that send troops automatically or with fewer clicks.
It is forbidden to create, offer or use any tool that automatically sends information from your account in case of an attack or other event.
It is forbidden to offer or use tools that automatically add information to the map or other areas.
It is forbidden to use any script that focuses or clicks the 'attack' or 'support' buttons and/or the 'ok' button on the command confirmation page. That is something each and every player has to do without a script.

If you look at the bolded section, you'll notice it confirms what I said.
 

DeletedUser81829

Guest
I stand corrected. I was never the sort to go actively searching out more rules :icon_wink:
 

File Not Found

Guest
Thank you for answering, now i still have an unanswered thought:

The second one that i showed you it's a little bit wrecked but don't know where or why ... when it skips to next village it doesn't insert troops :| that if u don't attack let's say first village ... press again and next village coords are inserted but troops aren't .... i don't remember well but i think it is like this from the begining and it's not a wreck ... if u attack first , then click for next it inserts troops ...
Someone could fix the problem to skip villages and insert troops asswell ? :X preety please ?

If u haven't understood anything i'm sorry but it's tricky to make people understand some codes in a script :)


The first script is illegal, due to reasons pointed out by others.

The second script is an easy fix.

You need to replace...

Code:
insertUnit(doc.forms[0].axe,ax); insertUnit(doc.forms[0].archer,ar); insertUnit(doc.forms[0].spy,scout); insertUnit(doc.forms[0].light,lc); insertUnit(doc.forms[0].marcher,mount); insertUnit(doc.forms[0].heavy,hv); insertUnit(doc.forms[0].ram,ra); insertUnit(doc.forms[0].catapult,cat);

with...

Code:
doc.forms[0].axe.value = ax;doc.forms[0].archer.value = ar;doc.forms[0].spy.value = scout;doc.forms[0].light.value = lc;doc.forms[0].marcher.value = mount;doc.forms[0].heavy.value = hv;doc.forms[0].ram.value = ra;doc.forms[0].catapult.value = cat;
 

DeletedUser

Guest
I made it to work with File Not Found's idea but he forgot to add the spear and swords part, he started directly from axes
It looks like this:
javascript:var[sp,sw,ax,ar,scout,lc,mount,hv,cat,ra]=[41,0,0,0,5,22,0,0,0,0];coords='764|325 764|327 763|324';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('(^|;) ?farm=([^;]*)(;|$)');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(2099,11,11);document.cookie ="farm="+index+";expires="+cookie_date.toGMTString ();doc.forms[0].x.value=coords[0];doc.forms[0].y.value=coords[1];doc.forms[0].spear.value = sp;doc.forms[0].sword.value = sw;doc.forms[0].axe.value = ax;doc.forms[0].archer.value = ar;doc.forms[0].spy.value = scout;doc.forms[0].light.value = lc;doc.forms[0].marcher.value = mount;doc.forms[0].heavy.value = hv;doc.forms[0].ram.value = ra;doc.forms[0].catapult.value = cat;end();
I have one single more question ... for autofilling paladin what should i do ...in the begining of the game u use paladin asswell in getting resources right ? :p
 
Top