Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Wednesday, January 18, 2017

Resource Balancer Script

Might one of the most useful script is this one. I helps you to reallocate your resources equally among a group of your villages, or among all of your villages. It also enable you to only balance one resource.
The script gain uses information with the help of algorithms, such as the resources, warehouse capacity and available merchants in your villages. It figures out what villages need to send resources where, and spits out a page detailing this and links to help you get there. It also calculate how many fields your merchant transports will travel on average, so you will need the approximate time of the reallocation.
Script's 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++){if(winvar.frames[i].document.URL.match('game\.php')){getdoc=winvar.frames[i].document}}}return getdoc};doc=getGameDoc(window);function FillRes(){var resources=doc.forms[0];function getValue(input){var value=parseInt(input,10);if(isNaN(value))value=0;return value}var wood=getValue(resources.wood.value);var clay=getValue(resources.stone.value);var iron=getValue(resources.iron.value);function OKClick(){var arrInputs=resources.getElementsByTagName('input');for(var idx1=0;idx1<arrInputs.length;idx1++){if(arrInputs[idx1].value.indexOf('OK')!=-1){arrInputs[idx1].click();break}}}function insertValues(){var URLargs=doc.URL.split("&");for(var i=0;i<URLargs.length;i++){var args=URLargs[i].split("=");if(args.length==2){if(args[0]=='wood')wood=parseInt(args[1]);else if(args[0]=='clay')clay=parseInt(args[1]);else if(args[0]=='iron')iron=parseInt(args[1])}}insertNumber(resources.wood,wood);insertNumber(resources.stone,clay);insertNumber(resources.iron,iron)}if(wood+clay+iron>0){OKClick()}else{insertValues()}}if(doc.URL.match(/clay=/)||doc.URL.match(/confirm_send/)){FillRes()}else{MarketMain()}
How to use:
Embedded in the links are the resources that need to be sent. Clicking each link takes you to the relevant market page with the target input.


1. Click the script to enter in the resources embedded in the url
2. Click the script again to automatically press the "ok" button
3. On the confirm page, click the script again to send off your resources.



Take note! To use the script, you need to allow popups from Tribal Wars. (since TW does not use popups, you will not get any from it, only from your script when you use).


Source:
ronpaul2008, 2009. Tribal Wars Forum. [Online] 
Available at: https://forum.tribalwars.net/index.php?threads/resource-balancer-script.172320/
[Accessed 18 01 2017].

Monday, January 16, 2017

Scripts

Many of you have indicated the need of such a guide, so I decided to create a -hopefully- good and precise one. I think running through frequently asked question would be a good start before we check the details.

What is a script?
Scripts are codes, which generally help you playing the Tribal Wars. They are written by programmers, as far as  I know with Javascript. Fortunately we do not need to be experts in coding and programming. We will not create our own scripts, just use others'.


How do I use them?
As far as I know, you can use scripts with any browser, but I tested them on Google Chrome, and you will need Java as well.
Basically, there are two main types of scripts. Some of them can be used without paying for it, but there are complex ones, which required premium account (PA).
Without Premium: Not all scripts will work without PA, e.g. the mass-recruit script, which uses a page which non-premium users do not have. We will check how scripts work later.


With Premium: Open up your quick bar (settings > edit quick bar). Click on "Add new link" and give it a sensible name. Then copy the script into the "Target-URL" box, and hit OK.


Why do I need them?
Scripts are created to help you. It will make easier your tasks and make it a daily routine. Things which would usually take hours can be completed in minutes, with the click of a button. You are not forced to use them if you feel like it ruins the game, but it is highly recommended.

The scripting rules
The rules are available from the help pages. It may differ from country to country, so check it yourself. International TW rule about scripts (§7) is available here. If there were not rules with scripting, people would be able to run an account without actually touching it. Accounts could look after themselves, eliminating all skill involved. People could manage totally amazing timing, noble trains in 3 ms, and then splitting these trains! Which would not be a good thing. You find all the approved scripts here, but I have also gathered the most useful ones.

Resource Balancer

Mass Village Renamer
Attack Timing / Labelling
Farm Assistant Key Binding