Extra caution is recommended when installing recently uploaded/updated scripts (read more)
Be sure you trust any scripts you install

Travian Village Building Level Tracker 0.7 (ENG)

Displays all your buildinglevels and compares to wanted levels. Shows witch buildings need to be upgraded, and witch not.

1. Install script.
2. Edit script file from **** EDIT THIS ****
- Change all building levels to what ever you want.
- My levels arr there for example.
3. Save file

That's it. Goto village center page and you see what happens.

Other language variants can be made by editing script file from **** EDIT THIS IF YOU NEED ANOTHER LANGUAGE ****

Special thanks for travspeedster whose script Travian Village Center Numbers .1 I borrowed edited and added my own toughts






May 26, 2008
djaije User

salut a tous
ce script ne marche pas dans http://s1.travian.fr/dorf1.php
peut tu me donner un script de Travian Village Building Level Tracker 0.7 (fr)
et éxpliquer comment je peux faire sa
bye

 
Dec 28, 2007
Tobben User

This script doesent work on the norwegian servers

 
Oct 17, 2007
Guinness User

i am trying it in a pt server... I even made the translation... check it out and see if there is something wrong please....

// ==UserScript==

// @name           Travian Village Building Level Tracker 0.7

// @namespace      Travian

// @description    Displays all your buildinglevels and compares to wanted levels. Shows witch buildings need to be upgraded, and witch not.

// @include        http://*travian*/dorf2*

// @include        http://*travian*/build.php?newdid*

// ==/UserScript==


// ›› Event listener starts things off once the page is done loading.
window.addEventListener("load",init,false);

// ›› Set styles.
function init(){
	var cssString2 = '.TMbuildingtags2{' +
		'background-color:#99FF99;' + 
		'border:thin solid #000000;' +
		'font-family: Verdana, Arial, Helvetica, sans-serif;' +
		'font-size:8pt;' +
		'font-weight:bold;' +
		'text-align:center;' +
		'position:absolute;' +
		'width:230px;' +
		'height:14px;' +
		'cursor:pointer;' +
		'visibility:hidden;' +
		'z-index:50;}';
	var cssString3 = '.TMbuildingtags3{' +
		'background-color:#FF9999;' + // RED
		'border:thin solid #000000;' +
		'font-family: Verdana, Arial, Helvetica, sans-serif;' +
		'font-size:8pt;' +
		'font-weight:bold;' +
		'text-align:center;' +
		'position:absolute;' +
		'width:230px;' +
		'height:14px;' +
		'cursor:pointer;' +
		'visibility:hidden;' +
		'z-index:50;}';
	addCSS(cssString2);
	addCSS(cssString3);
	TM_ShowMainBuildingNumbers();
}

// ›› Main.
function TM_ShowMainBuildingNumbers(){
	// ›› x and y offset in pixels added to every absolutely positioned style element
	var x = 700;
	var y = 350;
	
	// ›› could get this from the styles, but hard coding them is faster and allows for a simpler loop
	buildArr1 = new Array(21);
	buildArr1[0] = x;
	buildArr1[1] = x;
	buildArr1[2] = x;
	buildArr1[3] = x;
	buildArr1[4] = x;
	buildArr1[5] = x;
	buildArr1[6] = x;
	buildArr1[7] = x;
	buildArr1[8] = x;
	buildArr1[9] = x;
	buildArr1[10] = x;
	buildArr1[11] = x;
	buildArr1[12] = x;
	buildArr1[13] = x;
	buildArr1[14] = x;
	buildArr1[15] = x;
	buildArr1[16] = x;
	buildArr1[17] = x;
	buildArr1[18] = x;
	buildArr1[19] = x;
	buildArr1[20] = x;
	buildArr1[21] = x;

	buildArr2 = new Array(21);
	buildArr2[0] = y;
	buildArr2[1] = 20 + y;
	buildArr2[2] = 40 + y;
	buildArr2[3] = 60 + y;
	buildArr2[4] = 80 + y;
	buildArr2[5] = 100 + y;
	buildArr2[6] = 120 + y;
	buildArr2[7] = 140 + y;
	buildArr2[8] = 160 + y;
	buildArr2[9] = 180 + y;
	buildArr2[10] = 200 + y;
	buildArr2[11] = 220 + y;
	buildArr2[12] = 240 + y;
	buildArr2[13] = 260 + y;
	buildArr2[14] = 280 + y;
	buildArr2[15] = 300 + y;
	buildArr2[16] = 320 + y;
	buildArr2[17] = 340 + y;
	buildArr2[18] = 360 + y;
	buildArr2[19] = 380 + y;
	buildArr2[20] = 400 + y;
	buildArr2[21] = 420 + y;

	// ›› Map1 holds building names, level and building spot IDs in area elements (2 are duplicate walls to be ignored).
	var map1Element = document.getElementsByName('map1')[0];
	if (map1Element){
	
		// ›› Map1 ONLY has area children. 
		var areaElements = map1Element.childNodes;	
		var BuildingLevel, smallDIV;
		var BuildingName = new Array(21);
		var BuildingURL = new Array(21);
		
		for (var i = 0; i < 22; i++) {
			BuildingLevel = /(\d+)/.exec(areaElements[i].getAttribute("title"));
			BuildingName = /[A-z0-9äÄöÖåÅ -]+/.exec(areaElements[i].getAttribute("title"));
			var Name = BuildingName[0];
			var spot = Name.indexOf(" taso"); //REPlase this with level
			Name = Name.slice(0,spot);
			BuildingURL = areaElements[i].getAttribute("href");

			// ›› Only show spots with buildings on them.
			if (BuildingLevel){
				
				// *********************************************************************************************************
				// **** EDIT THIS IF YOU NEED ANOTHER LANQUAGE								****
				// **** IN DIFFRENT LANQUAGES, CHANGE BUILDING NAMES AS THEY SHOULD BE 					****
				// **** tHIS WORKS IN FINNISH AND IN THE COMMMENTS YOU CAN FIND BUILDING NAMES IN ENGLISH 		****
				// *********************************************************************************************************

				Buildings = new Array(35);
				Buildings[0] = "Mercado"; 		// Marketplace
				Buildings[1] = "Quartel"; 		// Barracks
				Buildings[2] = "Ponto de Reunião Militar"; 		//Rally Point
				Buildings[3] = "Padaria"; 		//Bakery
				Buildings[4] = "Alvenaria"; 		//Brickyard
				Buildings[5] = "Moinho"; 		//Grain Mill
				Buildings[6] = "Celeiro"; 		//Granary
				Buildings[28] = "Grande Celeiro"; 	//Great Granary
				Buildings[7] = "Grande Armazém"; 	//Great Warehouse
				Buildings[8] = "Fundição"; 		//Iron Foundry
				Buildings[9] = "Serração"; 		//Sawmill
				Buildings[10] = "Armazém"; 		//Warehouse
				Buildings[11] = "Academia"; 		//Academy
				Buildings[12] = "Fábrica de Armaduras"; 		//Blacksmith
				Buildings[13] = "Ferreiro"; 		//Armoury
				Buildings[14] = "Muralha"; 		//City Wall
				Buildings[29] = "Grande Quartel"; 	//Great Barracks
				Buildings[30] = "Grande Cavalariça"; 	// Great Stable
				Buildings[15] = "Mansão do Heroi"; 	//Hero's Mansion
				Buildings[16] = "Cavalariça"; 		//Stable
				Buildings[17] = "Praça de Torneios"; 	//Tournament Square
				Buildings[18] = "Fábrica de Armadilha"; 		//Trapper
				Buildings[19] = "Oficina"; 		//Workshop
				Buildings[20] = "Esconderijo"; 		//Cranny
				Buildings[21] = "Embaixada"; 		//Embassy
				Buildings[22] = "Edificio Principal"; 	//Main Building
				Buildings[23] = "Palácio"; 		//Palace
				Buildings[24] = "Residência"; 		//Residence
				Buildings[25] = "Pedreiro"; 		//Stonemason
				Buildings[26] = "Casa do Povo"; 		//Townhall
				Buildings[27] = "Companhia do Comércio"; 	//Trade Office
				Buildings[31] = "Câmara do Tesouro"; 		//Treasury
				Buildings[32] = "Maravilha do Mundo"; 	//Wonder Of The World
				Buildings[33] = "Muro de Terra"; 		//Earth Wall
				Buildings[34] = "Paliçada"; 		//Palisade
				
				// *********************************************************************************************************
				// **** EDIT THIS											****
				// **** EDIT VALUES FROM HERE, DESIDE HOW FAR YOU WANT TO UPDRADE EACH BUILDING 			****
				// **** EXAMPLE: "WantedLevels[1] = 15; // Barracks" MEANS THAT YOU WANT BARRACKS TO BE AT LEVEL 15 	****
				// *********************************************************************************************************

				WantedLevels = new Array(35);
				WantedLevels[0] = 20; // Marketplace
				WantedLevels[1] = 20; // Barracks
				WantedLevels[2] = 20; //Rally point
				WantedLevels[3] = 5; //Bakery
				WantedLevels[4] = 5; //Brickyard
				WantedLevels[5] = 5; //Grain Mill
				WantedLevels[6] = 20; //Granary
				WantedLevels[7] = 0; //Great Warehouse
				WantedLevels[8] = 5; //Iron Foundry
				WantedLevels[9] = 5; //Sawmill
				WantedLevels[10] = 20; //Warehouse
				WantedLevels[11] = 0; //Academy
				WantedLevels[12] = 20; //Blacksmith
				WantedLevels[13] = 20; //Armoury
				WantedLevels[14] = 0; //City Wall
				WantedLevels[15] = 20; //Hero's Mansion
				WantedLevels[16] = 20; //Stable
				WantedLevels[17] = 1; //Tournament Square
				WantedLevels[18] = 1; //Trapper
				WantedLevels[19] = 15; //Workshop
				WantedLevels[20] = 0; //Cranny
				WantedLevels[21] = 20; //Embassy
				WantedLevels[22] = 19; //Workshop
				WantedLevels[23] = 20; //Palace
				WantedLevels[24] = 10; //Residence
				WantedLevels[25] = 20; //Stonemason
				WantedLevels[26] = 20; //Townhall
				WantedLevels[27] = 20; //Trade Office
				WantedLevels[28] = 1; //Great Granary
				WantedLevels[29] = 1; //Great Barracks
				WantedLevels[30] = 1; // Great Stable
				WantedLevels[31] = 1; //Treasury
				WantedLevels[32] = 1; //Wonder Of The World
				WantedLevels[33] = 20; //Earth Wall
				WantedLevels[34] = 20; //Palisade
				
				// *********************************************************************************************************
				// **** STOP EDITING											****
				// *********************************************************************************************************

				for (var j = 0; j < 35; j++) {
					if (Buildings[j] == Name){
						//document.write(Name);
						//document.write(Buildings[j]);
						//document.write(WantedLevels[j]);
						//document.write(BuildingLevel[0]);
						if (WantedLevels[j] <= BuildingLevel[0]){
							//document.write("vihreä");
							smallDIV = addDiv('TMbuildingtag' + i,'TMbuildingtags2',Name + ' ' + BuildingLevel[0] + '/' + WantedLevels[j],false);
						}else{
							//document.write("punainen");
							smallDIV = addDiv('TMbuildingtag' + i,'TMbuildingtags3',Name + ' ' + BuildingLevel[0] + '/' + WantedLevels[j],false);
						}
					}
				}

				//smallDIV = addDiv('TMbuildingtag' + i,'TMbuildingtags2',Name + ' ' + BuildingLevel[0],false);
				smallDIV.style.top = buildArr2[i] + 'px';
				smallDIV.style.left = buildArr1[i] + 'px';
				smallDIV.style.visibility = "visible";
				smallDIV.setAttribute('goto', BuildingURL);
				smallDIV.addEventListener('click', function() {
					window.location.href = this.getAttribute('goto');
					}, true);
			}
		}
	}
}

// ›› Adds a generic div.
function addDiv(id,style,html,parent){
	var body, div;
	if (!parent){body = document.getElementsByTagName('body')[0];}else{body = document.getElementsByTagName(parent);}
	if (!body) { return false; }
	div = document.createElement('div');
	div.id = id;
	div.className = style;
	if (html){div.innerHTML = html;}
	body.appendChild(div);
	return div;
}

// ›› Add generic CSS.
function addCSS(cssString2) {
	var style = document.createElement('STYLE');
	style.type = 'text/css';
	style.innerHTML = cssString2;
	document.getElementsByTagName('HEAD')[0].appendChild(style);
}

i am usig scite to edit it...

 
Oct 13, 2007
Boeruh User

Doesn't work @ s1.nl(T3) and s3.nl(T2.5)

 
Oct 11, 2007
Rusakko Script's author

Yes I was thinking it and i'll be working to do that. It also encourages to me going if people think this script is usefull, so please comment if you like it or not.

Multilanguage support coming hopefully soon :)

 
Oct 10, 2007
QP Scriptwright

Nice idea, but...

Please make only 1 script with all languages inside... see other scripts that do that (for instance: "Travian: Battle Analyse v2.4.4" http://userscripts.org/scripts/show/10835 )

Otherwise there will be too many scripts... imagine correcting a bug in one... and then in all...

You could comment on this script if you were logged in.