Implemented: Additional Map Data

DeletedUser

Guest
Some old legacy Map Scripts are unable to be legally updated due to missing data on the map.
(NOTE: "missing" is actually misleading... the data needs to be fetched on demand via AJAX calls)

The TWMap Javascript Object requires some additional data:

Code:
TWMap.villages[coord_minus_pipe_char]
	id:string
	img:number
	name:string
	points:string
	owner:string
	mood:string
	bonus:undefined
	###########
	attackInfo:object
		reportDateTime:string	- Dec 19,2010 01:39 o'clock
		status:string		- [dots/green.png,dots/yellow.png,dots/red.png,dots/blue.png]
		loot:string		- [max_loot/0.png,max_loot/1.png]		
	###########


Code:
TWMap.allies[id]
	name:string
	points:string
	###########
	tag:string			- Tribes are generally identified by Tag (not name)
	###########

It would be extremely useful if the developers could update the Objects with those attributes.
 

DeletedUser

Guest
Seeing as 7.0 had disabled some of the functionality of existing scripts, I'd like to see this change, to help resurrect those old scripts that were broken.

It's hard enough going through a major change like we saw in 7.0, but to then also lose some of the functionality, seems a step backwards, not forwards.

Seeing as I know nothing about scripting, I'm going to take dales word that this accomplishes what needs to be accomplshed :p~
 

DeletedUser

Guest
What's the status of this request?
Has it even been considered?

These changes are required to fix quite a few existing scripts.
 

DeletedUser73

Guest
My apologies, it appears that it got lost under the other Idea threads. I'll be passing this on tomorrow, in the mean time I'd like to hear some more from people familiar with script writing.
 

DeletedUser

Guest
Will be implemented with the next update.

However, to save server resources this 'feature' is not enabled by default. Script authors will have to set a special flag in the TWMap object:
Code:
TWMap.scriptMode = true;

This has to be done before any map sector is loaded (aka as soon as possible). If the flag is set your browser will automatically request detailed information for each visible village and store the information in TWMap.villages[].extra.
Of course this is still an additional AJAX request, so it is up to your script to check when the extra information become available.

Also, the ally tag was added: TWMap.alles[].tag

I hope this helps :)
 

DeletedUser

Guest
Will be implemented with the next update.

However, to save server resources this 'feature' is not enabled by default. Script authors will have to set a special flag in the TWMap object:
Code:
TWMap.scriptMode = true;

This has to be done before any map sector is loaded (aka as soon as possible). If the flag is set your browser will automatically request detailed information for each visible village and store the information in TWMap.villages[].extra.
Of course this is still an additional AJAX request, so it is up to your script to check when the extra information become available.

Also, the ally tag was added: TWMap.alles[].tag

I hope this helps :)

Sounds great, thanks!
This will make a lot of people very happy.

Don't forget that some of the information will only be available for Premium Accounts.
 

DeletedUser1385

Guest
This is good to see. It will mean that the last of the script fix requests from the v7.0 update can be completed legally.

It caused alot of upset amongst the players when they were told things couldnt be fixed.
 

DeletedUser895

Guest
The thread says this has been implemented, and I just wanted to make sure this was the case.

I see both TWMap.villages[].extra and TWMap.allies[] when looking at the TWMap object, but I believe the underlying problem suggested in the first post hasn't been fixed yet: the information in TWMap.villages[].extra seems to only appear after mousing over the village in question. This is exactly how the map worked prior (only, the information was put in TWMap.popup._cache[villageid] and not TWMap.villages[villagecoordinates].extra) and doesn't fix that a script which requires the data (without having to force the AJAX calls systematically, or by having the user mouse over each and every village) cannot effectively be made following many servers' rules on scripts and loading pages in the background. (not to mention, ~70 AJAX calls on an average 15x15 map probably isn't optimal for the servers)

In my pursuit of recreating a "map overlay" script with similar functionality to pre-version 7 scripts, I have tried slightly modifying the TWMap.map.handler.spawnSection function to draw a small box (including how long ago said village was attacked) over each village with extra (and extra.attack) information, followed by calling the TWMap.map.reload function (to let the spawnSector function run with its new code), and finally, tying the TWMap.map.reload function to $(document).ajaxStop so it is called every time an ajax request finishes: the only way to currently have the overlay work requires systematically forcing an AJAX request for every village's extra object, or having the user mouse over each and every village.

It is my hope that the above information is enough to help explain what it is the scripters in this thread hope to do, and what problem(s) stand in the way of doing so effectively.

Thanks for all your time and effort developing this game, we greatly appreciate it.

-LastApparatus
 
Top