Rejected: More data in game_data?

DeletedUser895

Guest
For scripting, it'd make a lot of tasks easier if even just a few of these could be added to the game_data object.

  • World Speed
  • Unit Speed
  • Archers
  • Paladin

I'm sure theres a few other things that would be useful, but I can see many situations where at least these would be extremely useful.
 

fp0815

Staemme in my heart <3
Reaction score
19
As far as I know you can make requests to external scripts in your quick bar scripts. Wouldn't it be better to import these data from the world config files to process them in the scripts?
 

DeletedUser

Guest
As far as I know you can make requests to external scripts in your quick bar scripts. Wouldn't it be better to import these data from the world config files to process them in the scripts?

I think this could mean MASSIVE server overload if the config files are generated dynamically :D
But possible (and somewhat... complicated - XML processing, ...)
 

fp0815

Staemme in my heart <3
Reaction score
19
I don't think that this will cause a massive serverload, because the main script (which is called from the quick bar script) will be stored on a server and the XML must be downloaded only once and can be handled on that server. ;)

edit/ btw. recruitment times, carrying capacities, the exact walking durations etc. would be available then as well.
 
Last edited:

DeletedUser895

Guest
It is true this is possible with interface.php?func=get_config, and thats how I have done it in the past. I'm just unsure if it is a) the most elegant method, and b) allowed on all TW servers.
 

DeletedUser

Guest
Having the info in the game_data would greatly improve the speed of scripts.
However, it is at the cost of bandwidth and server load.

I generally use the following in my scripts when I need to fetch the data via AJAX:
[SPOIL]
Code:
/* sendMethod = "GET" || "POST", params = json, type = xml,json,text */
function fnAjaxRequest(url,sendMethod,params,type){
	var error=null,payload=null;

	win.$.ajax({
		"async":false,
		"url":url,
		"data":params,
		"dataType":type,
		"type":String(sendMethod||"GET").toUpperCase(),
		"error":function(req,status,err){error="ajax: " + status;},
		"success":function(data,status,req){payload=data;}
	});

	if(error){
		throw(error);
	}

	return payload;
}

function fnCreateConfig(name){return win.$(fnAjaxRequest("/interface.php","GET",{"func":name},"xml")).find("config");}
function fnCreateBuildingConfig(){return fnCreateConfig("get_build_info");}
function fnCreateUnitConfig(){return fnCreateConfig("get_unit_info");}
function fnCreateWorldConfig(){return fnCreateConfig("get_config");}

function fnHasArchers(){return (parseInt(win.game_data.worldConfig.find("game archer").text()||"0",10)>0);}
function fnHasChurch(){return (parseInt(win.game_data.worldConfig.find("game church").text()||"0",10)>0);}
function fnHasNotebook(){return (win.$("tr th img[src*=note.png]").length>0);}
function fnHasPaladin(){return (parseInt(win.game_data.worldConfig.find("game knight").text()||"0",10)>0);}

var win=(window.frames.length>0)?window.main:window;

if(typeof(win.game_data.worldConfig)=="undefined"){
		win.game_data.worldConfig = fnCreateWorldConfig();
}

if(typeof(win.game_data.unitConfig)=="undefined"){
		win.game_data.unitConfig = fnCreateUnitConfig();
}

if(typeof(win.game_data.buildingConfig)=="undefined"){
		win.game_data.buildingConfig = fnCreateBuildingConfig();
}
[/SPOIL]

Then you can do crap like:
[SPOIL]
Code:
var worldSpeed = parseFloat(win.game_data.worldConfig.find("speed").text());
var spearSpeed = parseFloat(win.game_data.unitConfig.find("spear speed").text());
var archers = fnHasArchers();
var paladin = fnHasPaladin();
[/SPOIL]
 

fp0815

Staemme in my heart <3
Reaction score
19
Okay, it makes the scripts shorter and will reduce server load etc., but why don't you follow the way the tool pages do actually to download the config files once and to access them locally (from your server)? This would reduce bandwith and server load on the TW servers as well.

And finally, it would create a situation that the next one will need other data like night bonus, prices of coins or whatever. This would mean that all the config data must be embedded in the game data at the end...
 

DeletedUser

Guest
Okay, it makes the scripts shorter and will reduce server load etc., but why don't you follow the way the tool pages do actually to download the config files once and to access them locally (from your server)? This would reduce bandwith and server load on the TW servers as well.

And finally, it would create a situation that the next one will need other data like night bonus, prices of coins or whatever. This would mean that all the config data must be embedded in the game data at the end...

Clearly you do not read posts... It will "increase" the server load.
I provided an alternative solution to the TW Developers changing the game_data variable.
 

fp0815

Staemme in my heart <3
Reaction score
19
I don't know, who is not reading posts, otherwise you would have seen the post from hohes C that any additions to game_data were refused from exception already (posted on .DE). This information is up to date.

Exception also mentioned somewhere else on .DE (a little bit longer ago) that anything that provides further automation of TW will not be supported from TW. But this just for your information. ;)

Furtheron your scripts already make many AJAX requests to the TW servers as you mentioned above (and I guess your scripts are used by many other players as well). Thats why I asked you, why you don't store the config XML's locally on YOUR server (has to be done only once!) and make the request to your server locally instead of making all the requests to the TW servers, because this will really reduce serverload and bandwith on the TW servers.
 

DeletedUser

Guest
I don't know, who is not reading posts, otherwise you would have seen the post from hohes C that any additions to game_data were refused from exception already (posted on .DE). This information is up to date.

Exception also mentioned somewhere else on .DE (a little bit longer ago) that anything that provides further automation of TW will not be supported from TW. But this just for your information. ;)

Furtheron your scripts already make many AJAX requests to the TW servers as you mentioned above (and I guess your scripts are used by many other players as well). Thats why I asked you, why you don't store the config XML's locally on YOUR server (has to be done only once!) and make the request to your server locally instead of making all the requests to the TW servers, because this will really reduce serverload and bandwith on the TW servers.

Personally, I don't give a rats ass about the TW server load or bandwidth.
I am more concerned about the end-user experience & their bandwidth.
TW makes a profit, scripters & end users do not.
Why should I pay to reproduce all the information that TW makes available on my own server?

Whether the data is hosted on my own personal server or on the TW server, the PC running the script still needs to download it.
Since TW gets paid, they can foot the bill for hosting & bandwidth.

Also, what makes you think everybody speaks German & can be bothered to translate threads from the German forums.

As for embedding the info in the game_data object, this means every single page request will be bloated with the additional bytes of data.
This in undesirable for players that use dial-up or mobile phones (which have expensive data plans here in Australia)
 

DeletedUser

Guest

DeletedUser

Guest
:(

first my post gets ignored and then its said that its bad because noone can be bothered with german...

hey i summed up the main point of it in one easy sentence in english right over the link!

and you could also do it like this:
http://translate.google.de/translate?hl=de&ie=UTF-8&sl=auto&tl=en&u=http://forum.die-staemme.de/showthread.php%3Ft%3D132874&prev=_t&twu=1 (english!!!!! with google translator)
thats not much work..and i guess you then get the main parts of whats the topic there...

Who is ignoring your post?
You said the idea was already kinda rejected, then provided a German link for reference.
I usually read this forum from my iPhone, so I'm not going to follow the link if I don't need to.
My entire last post was directed at chisum.

Summary...
I think it would be great to have the info made available in the game_data variable.
However, it is not available and probably won't ever be.
So I provided an alternative solution in the meantime.

So what the hell is the argument about?
 

DeletedUser895

Guest
chisum, I believe you're missing the point. I use dropbox to host my scripts, and that barely works as it is. I don't have my own server, I don't want my own server, and therefore, I cannot and will not grab world data to host on my own server: this is a hobby that I do for fun, and maybe to help a few others enjoy the game a bit more along the way. Other than server space I don't have, the user's cookies should suffice to store data. Beyond that, I don't think you were properly understanding dalesmckay's posts, as you argued him despite his providing a different solution. After clearing up a few things (namely, that using AJAX to get the world config is allowed) as well as being shown a useful bit of code by dalesmckay, I can very easily go on scripting what I want to script without this being implemented.

Dalesmckay: the argument is about nothing more than a misunderstanding apparently, and hopefully its over with. Thanks for your suggestion, I'll most likely have to look into that.
 
Last edited by a moderator:
Top