User Scripts

DeletedUser3214

Guest
User scripts are allowed on the dutch server (which is larger than this one). Just wondering, is it possible to allow them here too?
 

DeletedUser

Guest
User scripts being...?

If you mean scripts that you yourself write, that's fine. Just have them approved prior to using them. If you don't want them to be public, they won't be made public.

If you need more information on how to get them approved, check the scripts forum :). Approval takes less than 2 days, usually.
 

DeletedUser4240

Guest
User scripts being...?

If you mean scripts that you yourself write, that's fine. Just have them approved prior to using them. If you don't want them to be public, they won't be made public.

If you need more information on how to get them approved, check the scripts forum :). Approval takes less than 2 days, usually.

§7) Bots and Scripts

The only scripts allowed in the US version can be found here.
Greasemonkey scripts are forbidden on our servers.


these are the scripts hes talking about. for example. the following scripts


// ==UserScript==
// @name Maak bb coordinaten lijsten op de map
// @author Heinzel
// @Version 2.1.0
// @namespace www.tribalwars.nl
// @description Dit script kan op de kaart geactiveerd worden door het indrukken van de 'b'-toets. Vervolgens kan je dorpen aanklikken die je in bb-code wilt hebben. ALs je klaar bent druk je nogmaals op 'b'-toets.
// @include http://*.tribalwars.nl/game.php*screen=map*
// ==/UserScript==


function CCoordlist() {
this.list = new Array();
this.bbCodes = true;
this.activationKey = 'b';

var mapEl = document.getElementById('map');
var dsMap = win.TWMap;
var busy = false;
var popup = null;

function inList(coords) {
for(var x = 0; x < coordList.list.length; x++) {
if(coords == coordList.list[x]) {
return x;
}
}

return false;
}
function addToList(coords) {
coordList.list.push(coords);
}
function removeFromList(coords) {
coordList.list.splice(inList(coords), 1);
}
function markVillage(coords) {
var coords = coords.split('|');
var overlay = document.getElementById('DSmakeBBCoordListOnMap_overlay_' + coords[0]+coords[1]);
overlay.style.outline = '2px solid red';
}
function demarkVillage(coords) {
var coords = coords.split('|');
var overlay = document.getElementById('DSmakeBBCoordListOnMap_overlay_' + coords[0]+coords[1]);
if(overlay) {
overlay.style.outline = '';
}
}
function removeAllVillages() {
for(var x = 0; x < coordList.list.length; x++) {
removeFromList(coordList.list[x]);
}
}
function demarkAllVillages() {
for(var x = 0; x < coordList.list.length; x++) {
demarkVillage(coordList.list[x]);
}
}
function spawnSectorReplacer(data, sector) {
dsMap.mapHandler.DSspawnSector(data, sector);

var beginX = sector.x - data.x;
var endX = beginX + dsMap.mapSubSectorSize;

var beginY = sector.y - data.y;
var endY = beginY + dsMap.mapSubSectorSize;

for(var x in data.tiles) {
var x = parseInt(x, 10);

if(x < beginX || x >= endX) {
continue;
}

for(var y in data.tiles[x]) {
var y = parseInt(y, 10);

if(y < beginY || y >= endY) {
continue;
}

var xCoord = data.x+x;
var yCoord = data.y+y;
var village = dsMap.villages[(xCoord)*1000+yCoord];
if(village) {
var overlay = document.createElement('div');
overlay.style.position = 'absolute';
overlay.style.zIndex = '50';
overlay.style.width = (dsMap.map.scale[0]-1).toString() + 'px';
overlay.style.height = (dsMap.map.scale[1]-1).toString() + 'px';
overlay.id = 'DSmakeBBCoordListOnMap_overlay_' + ((xCoord)*1000+yCoord).toString();
if(inList(xCoord + '|' + yCoord) !== false && busy === true) {
overlay.style.outline = '2px solid red';
}
sector.appendElement(overlay, x-beginX, y-beginY);
}
}
}
}
function echoCoordList() {
if(coordList.list.length > 0) {
if(!document.getElementById('DSmakeBBCoordListOnMap_listPopup')) {
listPopup = new CInlinePopup();
listPopup.init();
} else {
listPopup.show();
}

var outputArea = document.getElementById('outputArea');
if(coordList.bbCodes !== true) {
outputArea.innerHTML = coordList.list.join('<br />')
} else {
outputArea.innerHTML = '[coord]' + coordList.list.join('[/coord]<br />[coord]') + '[/coord]';
}
}
}

this.init = function() {
document.addEventListener('keydown', coordList.handlePressedKeys, false);

dsMap.mapHandler.DSspawnSector = dsMap.mapHandler.spawnSector;
dsMap.mapHandler.spawnSector = spawnSectorReplacer;
};
this.handleClicks = function(e) {
e.preventDefault();

var pos = dsMap.map.coordByEvent(e);
var village = dsMap.villages[pos[0]*1000+pos[1]];

if(village) {
var coords = pos.join('|');

if(inList(coords) === false) {
addToList(coords);
markVillage(coords);
} else {
removeFromList(coords);
demarkVillage(coords);
}
}
};
this.handlePressedKeys = function(e) {
var pressedChar = String.fromCharCode(e.which).toLowerCase();
if(pressedChar == coordList.activationKey.toLowerCase()) {
if(busy === false) {
display.show("DSmakeBBCoordListOnMap: Listing läuft!");
coordList.startCaption();
} else {
display.hide();
coordList.quitCaption();
}
}
};
this.startCaption = function() {
busy = true;

mapEl.addEventListener('click', coordList.handleClicks, false);
};
this.quitCaption = function() {
busy = false;

mapEl.removeEventListener('click', coordList.handleClicks, false);

demarkAllVillages();
echoCoordList();
removeAllVillages();
};
this.toggleBBCodeUse = function() {
this.bbCodes = document.getElementById('addBBCodes').checked;

var outputArea = document.getElementById('outputArea');
if(this.bbCodes === true) {
outputArea.innerHTML = outputArea.innerHTML.replace(/(\d+\|\d+)/g, "[coord]$1[/coord]");
} else {
outputArea.innerHTML = outputArea.innerHTML.replace(/\[coord\](\d+\|\d+)\[\/coord\]/g, "$1");
}
};
}

function CInlinePopup() {
var el = null;

this.init = function(message) {
var popup = el = document.body.appendChild(document.createElement('div'));
popup.id = 'DSmakeBBCoordListOnMap_listPopup';
popup.className = 'popup_style ui-draggable';
popup.style.width = '400px';
popup.style.position = 'absolute';
popup.style.display = 'block';
popup.style.top = '100px';
popup.style.left = '300px';
popup.style.zIndex = '9999';

var head = popup.appendChild(document.createElement('div'));
head.id = 'DSmakeBBCoordListOnMapPopup_menu';
head.className = 'popup_menu';

var closer = head.appendChild(document.createElement('a'));
closer.href = 'javascript:void(0);';
closer.addEventListener('click', listPopup.hide, false);
closer.appendChild(document.createTextNode("Schließen"));
closer.style.paddingRight = '3px';

var content = popup.appendChild(document.createElement('div'));
content.id = 'DSmakeBBCoordListOnMapPopup_content';
content.className = 'popup_content';
content.style.height = '400px';
content.style.padding = '8px';
content.style.overflow = 'auto';

var title = content.appendChild(document.createElement('h3'));
title.innerHTML = "DSmakeBBCoordListOnMap";

var description = content.appendChild(document.createElement('p'));
description.appendChild(document.createTextNode("Weiter unten finden Sie die eben erstellte Liste. Sollen lediglich die Koordinaten ohne BBCodes angezeigt werden, einfach das Häckchen bei 'BBCodes hinzufügen' entfernen. "));

var label = content.appendChild(document.createElement('label'));
var input = label.appendChild(document.createElement('input'));
input.type = 'checkbox';
input.checked = 'checked';
input.id = 'addBBCodes';
input.addEventListener('change', coordList.toggleBBCodeUse, false);
label.appendChild(document.createTextNode("BBCodes hinzufügen"));

content.appendChild(document.createElement('br'));
content.appendChild(document.createElement('br'));
content.appendChild(document.createElement('br'));

var outputContainer = content.appendChild(document.createElement('div'));
outputContainer.style.width = '100%';
var outputArea = outputContainer.appendChild(document.createElement('div'));
outputArea.id = 'outputArea';
outputArea.style.width = '60%';
outputArea.style.height = '220px';
outputArea.style.marginRight = 'auto';
outputArea.style.marginLeft = 'auto';
outputArea.style.backgroundColor = 'white';
outputArea.style.border = '1px solid rgb(127, 157, 185)';
outputArea.style.padding = '3px';
outputArea.style.textAlign = 'center';
outputArea.style.overflow = 'auto';
outputArea.innerHTML = message;
};
this.hide = function() {
var popup = document.getElementById('DSmakeBBCoordListOnMap_listPopup');
if(popup.style.display != 'none') {
popup.style.display = 'none';
}
}
this.show = function() {
var popup = document.getElementById('DSmakeBBCoordListOnMap_listPopup');
if(popup.style.display == 'none') {
popup.style.display = 'block';
}
};
}

function CActivationDisplay() {
this.el = null;
this.temp = "";

this.create = function() {
var title = this.el = document.getElementById('continent_id').parentNode;
title.id = 'DSmakeBBCoordListOnMap_activationDisplay';
};
this.show = function(msg) {
this.temp = this.el.innerHTML;
this.el.innerHTML = msg;
this.el.style.color = 'red';
this.el.style.textAlign = 'center';
};
this.hide = function() {
this.el.innerHTML = this.temp;
this.el.style.color = '';
this.el.style.textAlign = '';
};
}


(function __construct() {
// window-Objekt von außerhalb der GM-Sandbox ermitteln
win = (typeof(unsafeWindow) != 'undefined') ? unsafeWindow : window;

// Aktivierungs-Display erzeugen
display = new CActivationDisplay();
display.create();

// Coordliste laden
coordList = new CCoordlist();
coordList.init();
})();


What it bassicly does, is once u are on your Map U press B and the script launchers, then every village u click will be surrounded with a red square.
for example I hit 4 barb villages I see 4 squares.
then U press B again. a popup comes and gives u all the 458|456 Codes and u can choose with or withouth the [Village ] codes. there are many more. and I would share them with u ofc so they can be tested and approved.

Regards Steven
 
Last edited by a moderator:

DeletedUser4240

Guest
Btw/ U only need greasemonkey for Firefox... so If somebody allways used opera, he wouldn't know, and might violate that rule :D

on topic: I could explain all to u how to use them , on opera/ firefox. (can't debug alot but only a little) (if allowed)
 

DeletedUser

Guest
I have hidden the post, as if it's illegal having it be posted publicly would not be good.

Seeing as Greasemonkey is not allowed, and that appears to be a Greasemonkey type of script, I don't think those are allowed either. Greasemonkey scripts or that type of script is not allowed on .net either, which is larger than .nl; it doesn't have anything to do with server size.
 
Last edited by a moderator:

DeletedUser4240

Guest
I have hidden the post, as if it's illegal having it be posted publicly would not be good.

Seeing as Greasemonkey is not allowed, and that appears to be a Greasemonkey type of script, I don't think those are allowed either. Greasemonkey scripts or that type of script is not allowed on .net either, which is larger than .nl; it doesn't have anything to do with server size.


well, it would be really nice of u guys to reconsider it.
 

DeletedUser4240

Guest
btw, I looked into some of the scripts u guys Allowed, ... they are also based on Greasemonky and are user scripts... so why are they legal?
 

DeletedUser

Guest
I haven't seen any of those, but being based on something and being something are two entirely separate things.

But if they're allowed, you can post them here. Please feel free to explain so we can see :).
 

DeletedUser4240

Guest
PHP:
javascript:
if (document.URL.match(/&screen=info_village&id/g)) {
    var c = document.getElementById("content_value");
    var b = c.getElementsByTagName("table");
    if (b.length >= 2) {
        tableid = 1;
    }
    var table = c.getElementsByTagName("table")[tableid];
    var rows = table.getElementsByTagName("a");
    if (rows[0].innerText == game_data.player.name) {
        for (x = 1; x < rows.length - 1; x++) {
            if (rows[x].innerHTML.match(/overview/g)) {
                var link = rows[x].getAttribute("href").replace("&screen=overview", "&screen=market&mode=own_offer");
                window.navigate(link);
                break;
            }
        }
    }
    else {
        alert("Your user name has not been found");
    }
}
else if(!(document.URL.match(/mode=own_offer/g))){
    var sec = document.URL.split("&screen")[0] + "&screen=market&mode=own_offer";

    window.navigate(sec);
}
else if (document.URL.match(/mode=own_offer/g) && document.getElementsByName('buy')[0].value == "") {

    var wood = new Number(document.getElementById('wood').innerHTML);
    var clay = new Number(document.getElementById('stone').innerHTML);
    var iron = new Number(document.getElementById('iron').innerHTML);
    var forms = document.getElementsByTagName('form');
    var table = "";
    for (i = 0; i < forms.length && table == ""; i++) {
        if (forms[i].action.indexOf('action=modify_offers') != -1) {
            table = forms[i].getElementsByTagName('table')[0];
        }
    }
    for (i = 1; table != "" && i < table.rows.length - 1; i++) {
        child = table.rows[i].cells[1].childNodes;
        res = child[0].title;
        num = "";
        for (j = 0; j < child.length; j++) {
            value = child[j].nodeValue;
            if (value != null) num += value;
        }
        num = num.substring(0, num.length - 1);
        num *= new Number(table.rows[i].cells[2].innerHTML);
        if (res == 'Wood') wood += num;
        if (res == 'Clay') clay += num;
        if (res == 'Iron') iron += num;
    }
    document.getElementById('res_sell_wood').checked = wood > clay && wood > iron; document.getElementById('res_sell_stone').checked = clay > wood && clay > iron;
    document.getElementById('res_sell_iron').checked = iron > clay && iron > wood; document.getElementById('res_buy_wood').checked = wood < clay && wood < iron;
    document.getElementById('res_buy_stone').checked = clay < wood && clay < iron; document.getElementById('res_buy_iron').checked = iron < clay && iron < wood;
    wood = Math.round(wood / 1000);
    clay = Math.round(clay / 1000);
    iron = Math.round(iron / 1000);
    offers = Math.max(Math.max(wood, clay), iron) - Math.min(Math.min(wood, clay), iron);
    offers = Math.round(offers / 2); tables = document.getElementsByTagName('table');
    for (i = 0; i < tables.length; i++) {
        cell = tables[i].rows[0].cells[0].innerHTML;
        if (cell.indexOf('Merchants:') == 0) {
            offers = Math.min(offers, new Number(cell.substring(cell.indexOf(' ') + 1, cell.indexOf('/'))));
        }
    }
    inputs = document.getElementsByTagName('input');
    for (i = 0; i < inputs.length; i++) {
        if (inputs[i].value == 'Create') inputs[i].focus();
    }
    document.getElementsByName('multi')[0].value = offers;
    document.getElementsByName('max_time')[0].value = 40;
    document.getElementsByName('sell')[0].value = 1000;
    document.getElementsByName('buy')[0].value = 1000;

}
else {
    document.getElementsByTagName("input")[document.getElementsByTagName("input").length - 1].click();
}

void (0);


PHP:
// @name				Markt offers aanmaken
// @author				Laoujin / De Goede Fee
// @namespace			
// @description			
// @include			http://nl*.tribalwars.nl/game.php*screen=market*mode=own_offer*
// @include			http://nl*.tribalwars.nl/game.php*mode=own_offer*screen=market*


// ==/UserScript==
// aanpassing op 20100803 om aan de regels te voldoen: geen auto click
  // De configuratie:
  var sell_for = 1000;	//zoveel bied je aan
  var buy_for = 1000;	//zoveel koop je
  var tijd = 50;		//zoveel uren mag de de looptijd zijn
  var aantalKeer = 131;	//standaard worden er zoveel aanbiedingen geplaatst
  
  var useConfig = false;
  // Bij useConfig=true wordt sell voor buy geruild
  var sell = 'leem';	// gebruik leem / hout / ijzer
  var buy = 'ijzer';	// hier mag niet hetzelfde staan als bij sell (hierboven)
  
  // Bij useConfig=false worden de grondstoffen in het dorp bekeken
  // en als het verschil meeste - minste groter is dan minVerschil
  // wordt dat aanbod * offersCoef op de markt gezet
  var minVerschil = 75000;
  var offersCoef = new Array();
  offersCoef[0] = 0.5;	// coef wanneer we hout verkopen
  offersCoef[1] = 0.8;	// coef wanneer we leem verkopen
  offersCoef[2] = 0.5;	// ijzer - ie niemand neemt een ijzer voor leem offer aan :)
  
  if (document.documentElement.innerHTML.indexOf('Ter beschikking gesteld') == -1) {
	  var reg = /Maximale transporthoeveelheid\s(\d+)/
	  var setOffer = true;
	  
	  var regexResult;
    if ((regexResult = reg.exec(document.documentElement.innerHTML)))
  	{
	  	var merchants;
	  	if (aantalKeer > Math.floor(regexResult[1] / buy_for))
	  		aantalKeer = Math.floor(regexResult[1] / buy_for);
		  
		  if (!useConfig) {
			  var res = new Array();

			  res[1] = document.getElementById('stone').innerHTML;
			  res[2] = document.getElementById('iron').innerHTML;
			  
			  var resExplain = new Array();
			  resExplain[0] = 'wood';
			  resExplain[1] = 'clay';
			  resExplain[2] = 'iron';
			  
			  var i;
			  var meeste = 0;
			  var minste = 400000;
			  for (i = 0; i < 3; i++) 
			  {
			  	if (res[i] * 1 > meeste) { meeste = res[i]; meesteIndex = i; }
			  	if (res[i] * 1 < minste) { minste = res[i]; minsteIndex = i; }
			  }
			  if (meeste - minste > minVerschil)
			  {
			  	sell = resExplain[meesteIndex];
			  	buy = resExplain[minsteIndex];
			  	
			  	merchants = Math.floor(((meeste - minste) * offersCoef[meesteIndex]) / buy_for);
			  }
			  else setOffer = false;
		  }
		  else {
		  	merchants = aantalKeer;
		  }
		  if (merchants > aantalKeer) merchants = aantalKeer;
		  
		  if (setOffer && merchants > 0) {
			  if (sell == 'leem' || sell == 'clay') sell = 'res_sell_stone';
			  if (sell == 'hout' || sell == 'wood') sell = 'res_sell_wood';
			  if (sell == 'ijzer' || sell == 'iron') sell = 'res_sell_iron';
			  if (buy == 'leem' || buy == 'clay') buy = 'res_buy_stone';
			  if (buy == 'hout' || buy == 'wood') buy = 'res_buy_wood';
			  
			  if (buy == 'ijzer' || buy == 'iron') buy = 'res_buy_iron';  
		
		  	document.getElementsByName('multi')[0].value = merchants;
			  
			  document.getElementById(buy).checked = true;
			  document.getElementById(sell).checked = true;
			  
			  document.getElementsByName('max_time')[0].value = tijd;
			  document.getElementsByName('sell')[0].value = sell_for;
			  document.getElementsByName('buy')[0].value = buy_for;
			  
			  //submitForm();
  }}}
  
  function submitForm() { var candidates = document.getElementsByTagName("input"); var t; for (t = 0; t < candidates.length; t++) { if (candidates[t].type == "submit") { break; } } candidates[t].click(); }

as u both scripts do same, the difference is just the first script u need to install on every tw and the second one works on every dutch server... btw first script doesn't work tough its found in allowed scripts :D
 

DeletedUser

Guest
greasemonkey is forbidden since forever. Please never use it. And You can be sure that , mods see if you use it.
 
Last edited by a moderator:

DeletedUser4240

Guest
I haven't seen any of those, but being based on something and being something are two entirely separate things.

But if they're allowed, you can post them here. Please feel free to explain so we can see :).

Ima first write a support for it then, let them check into it. and IF they allow. I will explain it here. im no perfect PRO @ stuff, since every version of tw is slightly difference cause of speed of units and stuff. so it might take a while before I can come up with something working. :D
 

DeletedUser2389

Guest
Here's a quote from one of the Elder Mod's on .net as to why greasemonkey is illegal.

The problem with Greasemonkey is that it can automate game play. Scripts can only do one action per click. (This is what makes a script legal.) A Greasemonkey script will be done so that it performs multiple actions in just one click or even on visiting the page. The other scripts (which are legal to use) need to be clicked at least once (depending on what it is doing).
 

DeletedUser4240

Guest
Script Name: Resource Balancer
Short Description: Evens the amount of resources in the villages
Script Link:
Spoiler:
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://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+


......


Tough that opens with 1 click 25 tabs *-) not really 1 action with 1 click... so that makes his statement untrue ...

well, I send a few to support to let them check, it tough, they want me to post them here, ... wich there will be deleted since they arent legit yet... so :D
 

DeletedUser

Guest
They dont get deleted, they get hidden for the Script mod to review. You should create a new thread for each in the scripts section and he will review them.
 

DeletedUser2389

Guest
Tough that opens with 1 click 25 tabs *-) not really 1 action with 1 click... so that makes his statement untrue ...

It's still 1 action with 1 click, the action being a tab opened(regardless of the number).
 

DeletedUser

Guest
We approved that action because your browser likely has that functionality anyways, and there's no point trying to regulate something as small as opening multiple tabs regardless.

However, a script that automates actions, performing multiple on the same page without users needing to do something, is not allowed. UserScripts do that, market balancers do not. The market balancer will only do one thing per click on the script at a time. It'll only open a page, it'll only fill in a box, it'll only click 1 button. A UserScript can, and often does, perform all of the above with only one click. We are not fans of that, so to speak, as it creates more automation.

Therefore yes, it's still true that it automates the game and is not allowed, unlike a resource balancer.
 

DeletedUser

Guest
Userscripts, greasemonkey, etc run in a sandbox and can't be properly moderated. Thus they are forbidden. Yes, we can detect them.

Scripts that perform more than one action per click typically won't be approved unless it's data management - setting text, loading information, making calculations, etc. Premium Account emulators definitely will not be approved.
 

DeletedUser

Guest
Funny thing this,
I didn't know userscripts are illegal on the .us server,
so i've been using them for 2 years now and never got banned.
Now I know this I will stop using them over here... But if you guys do are able to detect them you're doing a pretty lazy job never banning me in those 2 years hahaha
 

Deleted User - 419875

Guest
If the scripts are legal on the .net server they are legal on the US server. Some user scripts no longer work due to the need to be transfered to https format. You will need to talk the script author to see if their scripts have been moved to the https format.
 
Top