Travian - Farming Machine

By m4rtini Last update Jul 13, 2010 — Installed 36,421 times.

Error

in
Subscribe to Error 30 posts, 10 voices



joel filipe User

Congratulations for the work, but he has a mistake, I do not know if it's only in my case and also with others, but when the script reads the report for no longer continue to send attacks. I wish it solves the problem.

 
m4rtini Script's Author

please deactivate all other script and see if it works then. if not open the error console (ctrl+alt+j) and give me any errors given from the script.

 
joel filipe User

I tried disabling all scripts but still does not.
This is what appears:

userscripts.org / FarmingMachine - MOD Teutonia: Main function called

userscripts.org / FarmingMachine - MOD Teutonia: In the Village Profile Page

userscripts.org / FarmingMachine - Teutonia mod: FarmEditBox Inserton done

userscripts.org / FarmingMachine - Teutonia mod: 1

userscripts.org / FarmingMachine - Teutonia mod: 3

 
m4rtini Script's Author

looks like you have two different versions of the farmingmachine script installer. two different names for the script appear.
and make sure that you have selected the tab "all" and not just the one labeled "messages".

 
joel filipe User

Já desinstalei o outro e mesmo assim ele pára.
Como é que selecciono a guia "todos"?

 
joel filipe User

Now uninstall the other and even then it stops.
How do select the tab "all"?
I have written in Portuguese.: P

 
m4rtini Script's Author

http://i276.photobucket.com/albums/kk32/m4rtini...
that's how you select all.

there's seams that the script don't work with single village account for some reason.

 
joel filipe User

This is the q appears:

Warning: Error in processing the value of property 'FILTER'. Statement ignored.
File source: http://s9.travian.pt/unx.css
Line: 491

Error: document.getElementsByTagName ( "tr") [8] is undefined
The source file: file: / / / C: / Users/utilizador/AppData/Roaming/Mozilla/Firefox/Profiles/ffblq23l.default/gm_scripts/farmingmachine_-_teuton_/farmingmachine_-_teuton_.user.js
Line: 2894

 
Tupac007 User

On travian.org this script don't work(

 
m4rtini Script's Author

isn't travian.org a T3.5 server? if so that version is not supported.

 
G I Z M O User

Czech lang. didnt display corectly special symbols (i tried to change to unicode atc.. -it doenst help) so i rewrite it in source and it works well:


if (ext == "cz") { //Language:Czech, Translator : Rypi
lang = {
'UPDATE_M' :"Aktualizovat",
'UPDATE_M1' :"UserScripts.org nenalezeno.",
'UPDATE_UNKNOWN' :"Verze se neshodují :",
'UPDATE_LAST' :"Používáš poslední verzi",
'UPDATE_BETA' :"Je dostupná nová BETA verze",
'UPDATE_NEW' :"Je dostupná nová verze",
'UPDATE_NOW' :"Chceš aktualizovat teď",
'CONFIRM' :"Jsi si jistý",
'REMOVEING' :"Odebírání",
'SWITCH_V' :"Přepínám vesnici na",
'AFTER' :"za",
'SEC' :"sekund",
'NO_VILLAGE' :"Žádná další vesnice!",
'WAITING' :"Čekámm",
'BEFORE_RE' :"před kontrolou.",
'ADD_FARM' :"Přidávám farmu",
'TROOP_CONFIG' :"Konfigurace jednotek je",
'ATTACK' :"Útok",
'REINFORCE' :"Podpora",
'RAID' :"Loupež",
'ACTIVE_FARM' :"Aktivní farma",
'CANCEL' :"Storno",
'SAVE' :"Uložit",
'ADD_TO' :"Přidat do",
'ADD_AS' :"Přidat jako farmu",
'GLOBAL_IM_EX_PROMPT' :"Kopírovat / Vložit data všech vesnic",
'GLOBAL_IM_EX_M' :"Importovat, Exportovat data všech vesnic",
'LOCAL_IM_EX_PROMPT' :"Kopírovat / Vložit data",
'LOCAL_IM_EX_M' :"Importovat, Exportovat data této vesnice",
'OPTIMIZE_DONE' :"Úspěšně provedena optimalizace vzdálenosti",
'OPTIMIZE_M' :"Optimalizuj farmy ve vybraných vesnicích podle vzdálenosti.",
'OPTIMIZE_SM' :"Budu optimalizovat všechny farmy ve vybraných vesnicích podle vzdálenosti",
'INVALID_FARM' :"Nastavení farmy je neplatné! Odebrat?",
'DELETE_FARM' :"Smazat farmu",
'EDIT_FARM' :"Upravit farmu",
'NO_FARM_YET' :"Nastav si nějakou farmu (přehled cizí vesnice po kliknutí na mapu)",
'FARM' :"Farma",
'SORT_FARM' :"Seřadit farmy podle vzdálenosti od současné vesnice",
'DELETE_M' :"Klikni na X pro smazání farmy",
'EDIT_M' :"Klikni na EDIT pro úpravu farmy",
'END_M' :"Vyber koncovou pozici, klikne zde pro odebrání konce",
'START_M' :"Vyber začáteční pozici z tohoto sloupce",
'START_FARMING' :"Začít farmit od zvolené vesnice",
'MINIMIZE' :"Minimalizovat",
'MAXIMIZE' :"Maximalizovat",
'FARM_INACTIVE' :"Farma nastavena jako neaktivní",
'ERROR' :"Chyba",
'NOT_ENOUGH' :"Málo jednotek pro vyloupení",
'AVAILABLE' :"Dostupné",
'NEEDED' :"Potřeba",
'TROOPS_GONE' :"Jednotky na cestě do",
'NEXT_FARM' :"Vyber další farmu",
'SUCCESS_COUNT' :"Celkem úspěšně poslaných loupenží",
'HALT_FARMING' :"Zastavit farmení",
'MACHINE_RUNNING' :"Farming Machine je spuštěný",
'CHANGE_VILLAGE' :"Zkouším změnit vesnici",
'NO_FARM' :"Žádná farma není dostupná.",
'NOT_FARMER' :"Tohle není Farmářská vesnice",
'USED_TROOPS' :"Použité jednotky",
'GOING_TO' :"Jdeš do",
'INSTALL_M1' :"Pro přidání farmy ji najdi na mapě a klikni na ni",
'INSTALL_M2' :"Veselé farmení",
'TRIBE_SELECT1' :"Jaké jsi národnosti",
'TRIBE_SELECT2' :"Prosím zvol správné číslo.",
'TRIBE_SELECT3' :"Nenastavil jsi správně číslo, Nastavuji si tě jako římana.",
'ROMAN' : "Říman",
'TEUTON' : "Germán",
'GAUL' : "Gal"
};

 
lolzax User

i think i found a bug: the script sets farms to inactive even if i did not loose troops to the
farm. every time i restart it i have to set the farms active again.

is it possible to modify the script so when i add a farm it autosets it to normal attack instead of raid?

 
RoadRunnerBnB User

Script is awsome, but i am having a major problem.
It stops in the reports :(
Btw i have only 1 village , is this a problem?

 
Upgrayedd Scriptwright

Solved!

The script no longer gets stuck in the report page. There are some hardcoded references to dorf3.php - the report page doesn't have any a href=...dorf3.php -> throws error -> gets stuck.

Just rewrite the function by copy/paste-ing the code below over the original. Enjoy!

function checkreports()
{
	for (i=0; i<document>=0;i--){
		pulled.innerHTML = tag.snapshotItem(i).innerHTML;
		attackreporturl = pulled.getElementsByTagName('a')[0].href;
		//alert(attackreporturl);
		endofA = tag.snapshotItem(i).innerHTML.indexOf("");
		testIndex = tag.snapshotItem(i).innerHTML.indexOf("(",endofA);
		if (testIndex != -1 && endofA < testIndex) {
			//Timeout(1000);
			//alert(url);
			GM_setValue("lastreportpage", url);
			window.open(attackreporturl, "_self");
			 setTimeout("window.location.replace('" + attackreporturl + "')",1000);
			break;
		}
	}

	if (i==-1){
		newreport = document.getElementsByTagName('html')[0].innerHTML.indexOf("m1.gif")+document.getElementsByTagName('html')[0].innerHTML.indexOf("m3.gif");
		//alert (newreport);
		//Timeout(1000);
		if ( newreport == -2 || url.indexOf("berichte.php?s=1000") != -1) {
			GM_setValue("lastreportpage", "/berichte.php");
			setTimeout("window.location.replace('" + rootPath + "a2b.php')",1000);
		} else {
			//alert(document.getElementsByTagName('a')[33].href);
				window.open(document.getElementsByTagName('a')[dorf3index-1].href, "_self");
		}
	}
	
}

	//Is this any report page?
	if ((url.indexOf("berichte.php?id=") != -1 || url.indexOf("berichte.php?newdid=") != -1) ) 
	{
		var test = find("//a[contains(@href,'uid=')]",XPList);
		var uids = find("//a[contains(@href,'karte.php?d=')]",XPList);

		//test = find("//a[contains(@href,'uid=')]",XPList);
		if(test.snapshotLength == 3 && uids.snapshotLength==2)
		{
			troopsinattack = document.getElementsByTagName('tr')[7].innerHTML.match(/\d+/g).join();
			casualties = document.getElementsByTagName('tr')[8].innerHTML.match(/\d+/g).join();
			//attackedId = (document.getElementsByTagName('a')[dorf3index-1].href.split('d=')[1].split('&c')[0]);
			attackedId = uids.snapshotItem(1).href.split('d=')[1].split('&c')[0];
			//attackerVillageId = (document.getElementsByTagName('a')[dorf3index-3].href.split('d=')[1].split('&c')[0]);
			attackerVillageId = uids.snapshotItem(0).href.split('d=')[1].split('&c')[0];
			//attackerPlayerId = (document.getElementsByTagName('a')[dorf3index-4].href.split('uid=')[1]);
			attackerPlayerId = test.snapshotItem(1).href.split('uid=')[1];
			playerId = getPlayerId()
			//thisCValue = getParamFromUrl(document.getElementsByTagName('a')[dorf3index-3].href, 'c')
			thisCValue = getParamFromUrl(uids.snapshotItem(0).href.split('d=')[1].split('&c')[0], 'c');
			coords = id2xy(attackedId);
			temp = attacktable();
			efficiency = temp[0]
			gain = temp[1];
			if (troopsinattack.split(',').join() == casualties || gain < 0)
			{
				suffix = suffixGlobal + '_' + attackerVillageId;
				index = getSindexFromXY(coords.x,coords.y, suffix);
				if (index != -1)
				{
					farmSetInactive(index, suffix);
					//alert("farm set inactive");
				}
			}

			if(casualties == "0,0,0,0,0,0,0,0,0,0" && efficiency == 100 && playerId == attackerPlayerId )
			{
				temptroops = troopsinattack.split(',')
				tempsum = 0;
				for (i=0; i>9;i++)
				{
					tempsum = tempsum + parseInt(temptroops[i]);
				}
				troopsinattack = tempsum +",0,0,0,0,0,0,0,0,0";
				//alert("1");
				//no loses and max res gathered. put target in priority queue for asap attack.
				//villageName = document.getElementsByTagName('a')[dorf3index-1].innerHTML
				//playerName = document.getElementsByTagName('a')[dorf3index-2].innerHTML + '(Priority)';
				villageName = uids.snapshotItem(1).innerHTML;
				playerName = test.snapshotItem(2).innerHTML + '(Priority)';
				attackInfo = coords.x +','+ coords.y +'|'+ troopsinattack +'|1|'+playerName+'|1234|'+villageName+'|'+ thisCValue +'|true|4';
				addtoprio(attackInfo, attackerVillageId);

				suffix = suffixGlobal + '_' + attackerVillageId;
				index = getSindexFromXY(coords.x,coords.y, suffix);
				if (index != -1)
				{
					newEditFarm(index, suffix, tempsum+1);
				}

				//alert("adding one ekstra soldier to the farm, since it maxed out.");

				//alert("added to prio");
			}
		}
		setTimeout("window.location.replace('" + rootPath + "berichte.php')",1000);
  
  
}
}

 
shadow^ User

Thanks, I'll try this out.

Edit: It started "working" like the sowrov's script, a.k.a. acting like its not even there. Maybe its a copy-paste mistake, I don't know. I tried it for two times and it still doesn't work, tho.

Edit no. 2: Here's what the error console says:

Error: [Exception... "'JavaScript component does not have a method named: "handleEvent"' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x80570030 (NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED)" location: "JS frame :: chrome://global/content/bindings/popup.xml :: hidePopup :: line 98" data: no]
Source File: chrome://global/content/bindings/popup.xml
Line: 98

and:

Error: missing ) in parenthetical
Source File: file:///C:/Documents%20and%20Settings/Vidux/Application%20Data/Mozilla/Firefox/Profiles/djujqjjn.default/gm_scripts/farmingmachine_-_teuton_/farmingmachine_-_teuton_.user.js
Line: 2972

 
Upgrayedd Scriptwright

can you please post the line. I'm not sure which line that is.

the only changes done by me are:

1.added the uids var and defined both uids and test as local vars

var test = find("//a[contains(@href,'uid=')]",XPList);
var uids = find("//a[contains(@href,'karte.php?d=')]",XPList);

2.
commented the lines that reference dorf3index
you can see the corrected lines right under the commented ones

			//attackedId = (document.getElementsByTagName('a')[dorf3index-1].href.split('d=')[1].split('&c')[0]);
			attackedId = uids.snapshotItem(1).href.split('d=')[1].split('&c')[0];
			//attackerVillageId = (document.getElementsByTagName('a')[dorf3index-3].href.split('d=')[1].split('&c')[0]);
			attackerVillageId = uids.snapshotItem(0).href.split('d=')[1].split('&c')[0];
			//attackerPlayerId = (document.getElementsByTagName('a')[dorf3index-4].href.split('uid=')[1]);
			attackerPlayerId = test.snapshotItem(1).href.split('uid=')[1];
			playerId = getPlayerId()
			//thisCValue = getParamFromUrl(document.getElementsByTagName('a')[dorf3index-3].href, 'c')
			thisCValue = getParamFromUrl(uids.snapshotItem(0).href.split('d=')[1].split('&c')[0], 'c');

and

				//villageName = document.getElementsByTagName('a')[dorf3index-1].innerHTML
				//playerName = document.getElementsByTagName('a')[dorf3index-2].innerHTML + '(Priority)';
				villageName = uids.snapshotItem(1).innerHTML;
				playerName = test.snapshotItem(2).innerHTML + '(Priority)';

 
Upgrayedd Scriptwright

try making the changes yourself, don't rely on copy paste. maybe some characters get altered - i'm thinking &lt instead of <

 
shadow^ User

sorry, I'm not much of a coder, I just tried to copy & paste into the part of script that starts with "function checkreports()" and it stops working. It may as well be my fault :(

Anyone else tried this?

 
Upgrayedd Scriptwright

i'm running out of ideas so i uploaded my patched script here http://userscripts.org/scripts/show/44170

see if that works for you. try this:
1.download the file
2.open it in your text editor, copy the entire text
3.in greasemonkey, select the script from the list and click edit
4.paste the text from step2 over the text file opened at step3 - essentially overwriting everything

the best thing would be for m4rtini to fix his version so I can erase mine instead of polluting this site with yet another script.

 
neozone User

If i don't want increase troop count. what should i do?
and now i halt farming and restart farming again i want to send 5 units but it's still 6 units. how can i reduce to 5 units?

 
shadow^ User

I tried your fix Upgrayedd, and it wroks! Thank you a lot, now I can farm 24/7 ;)

 
Upgrayedd Scriptwright

m4rtin - check out my fixes. it would be great if you can integrate them in your next release. they're here http://userscripts.org/scripts/show/44170

 
m4rtini Script's Author

Thanks Upgrayedd I've integrated your fix in this update.

 
lolzax User

the prioritized attack queue was removed?
seems that the script doesnt send attacks based on maxed bounty anymore. i really liked that feature

 
m4rtini Script's Author

no it wasn't removed. are you sure that it's not working for you?

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel