Page 1 of 2

Using yGather data to create waypoints...

Posted: Sat Dec 19, 2009 2:31 pm
by Excorio
Hello,

First off i wanna say that i LOVE MicroMacro!

Today i installed MM and i played around with it a bit.
I've read the forums posts and i know that some of u
use yGather (like me) to record resource stack locations.

I was wondering summin about the waypoints and the data
that yGather records about these resources. yGather records
the location of the resources in the SaveVariables.lua file that
is located in the Rune of Magic user directory...

MM needs coordinates, yGather has these coordinates!
(Has em if u ran the map to expose all nodes)

The data from yGather in SaveVariables.lua looks like this:

Code: Select all

yGather_Settings = {
}
yGather_data = {
	[1] = {
		[3001] = {
			[31] = {
				["y"] = 745,
				["x"] = 381.64,
			},
			[2] = {
				["y"] = 356.39,
				["x"] = 348.97,
			},
			[8] = {
				["y"] = 462.96,
				["x"] = 130.22,
			},
			[32] = {
				["y"] = 781.28,
				["x"] = 395.69,
			},
			[33] = {
				["y"] = 711.29,
				["x"] = 406.14,
			},
			[34] = {
				["y"] = 820.6,
				["x"] = 445.45,
And so on. The list is huge once u got the nodes on the maps...

Now... I don't have ANY knowledge of lua or converting or programming :oops:
whatsoever but is it possible to create a little proggie that converts these
waypoints into waypoints for MM so that MM can read it and randomly
(or at order) picks those waypoints to go there and harvest?

Just an idea ;)

Re: Using yGather data to create waypoints...

Posted: Thu Dec 24, 2009 8:15 am
by useless
I've looked into doing this, and have even written a conversion script.. I did notice however, after the fact, that the waypoints in yGather are significantly different than the ones used in RomBot. yGather, for instance, imposes a limitation that the waypoints must be between 0 and 1000 - and RomBot goes at least -10000 -> 10000 from what I can tell so far.

If someone can provide me more information on how to translate these points from yGather to RomBot I'll try to finish my implementation of the converter.

Re: Using yGather data to create waypoints...

Posted: Thu Dec 24, 2009 12:10 pm
by Administrator
Yes, yGather uses map coordinates, whereas the bot uses world coordinates. They really don't align so well.

Re: Using yGather data to create waypoints...

Posted: Thu Dec 24, 2009 7:18 pm
by useless
Administrator wrote:Yes, yGather uses map coordinates, whereas the bot uses world coordinates. They really don't align so well.
Shouldn't be too hard to calculate if I new what world coordinates each map begins with. I assume the upper-left corner of the map is 0,0 map coordinates and we could just add that to the x,y of the world coordinates where the map begins, right?

Re: Using yGather data to create waypoints...

Posted: Fri Dec 25, 2009 1:07 am
by Administrator
No, the maps do not scale 1:1 to world coordinates. It would, however, not be too hard to calculate given the start (top-left) and end (bottom-right) world coordinates, but they start and end at arbitrary locations. Plus, it's kind of a pain to gather this information about every map. Another concern is that yGather's stored coordinates might not be accurate enough.

Re: Using yGather data to create waypoints...

Posted: Fri Dec 25, 2009 2:21 am
by useless
Administrator wrote:No, the maps do not scale 1:1 to world coordinates. It would, however, not be too hard to calculate given the start (top-left) and end (bottom-right) world coordinates, but they start and end at arbitrary locations. Plus, it's kind of a pain to gather this information about every map. Another concern is that yGather's stored coordinates might not be accurate enough.
Well, what about modifying yGather to store the data in a model that is more appropriate to our situation? It wouldn't hinder the operation of yGather and would definitely be a benefit to us.

Another idea might be adding a function to MM that returns the coordinates of the next closest un-harvested resource...

Re: Using yGather data to create waypoints...

Posted: Tue Jun 08, 2010 6:36 am
by wil32
anyway to convert world and map coordinate?

Re: Using yGather data to create waypoints...

Posted: Tue Jun 08, 2010 6:53 am
by rock5
Even if you converted the coordinates, there's the HUGE job of sorting them into a sequence that would actually be traversable.

Re: Using yGather data to create waypoints...

Posted: Tue Jun 08, 2010 10:39 am
by KillerTHC
As rock5 said these co-ordinates are not really close to each other in the sense that there will be no obstacles in between them. This means that your bot will get stuck, in order to put yGather to use I just find all the nodes then create a path that walks to each and everyone of them while avoiding obstacles, this works well.

Re: Using yGather data to create waypoints...

Posted: Tue Jun 08, 2010 4:26 pm
by wil32
i have a script that takes all WP and make a good path -> it takes all WP put the closest to the closest one.

Im not sure if im getting understand but so far it work pretty well

Re: Using yGather data to create waypoints...

Posted: Wed Jun 09, 2010 2:53 pm
by KillerTHC
If someone figures out a way to convert from world coordinates to map coordinates and vice versa let me know, because with this I can develop a way of moving in game that will avoid obstacles almost perfectly.

Re: Using yGather data to create waypoints...

Posted: Wed Jun 09, 2010 3:15 pm
by Administrator
Do explain. If you have some way of gathering all information needed to create a collision map, then I'd like to hear about it.

Re: Using yGather data to create waypoints...

Posted: Thu Jun 10, 2010 12:21 am
by rock5
KillerTHC wrote:If someone figures out a way to convert from world coordinates to map coordinates and vice versa let me know, because with this I can develop a way of moving in game that will avoid obstacles almost perfectly.
Sounds a bit like what I did in an Excel file for visualizing waypoint files.
Basically What I did was visit 2 points at opposite corners of of each map, record the coordinates (both in-game and rombot), then calculate the dimensions of the map in rombot coordinate values. I then changed the min and max values of the axis so I could then plot the values directly to my maps.

Check it out. I also have some mob locations still included. I had to include only 1 of the maps because it was too big to upload. The 2nd tab "Calculations" is what I used to calculate the min and max values to use in the axis.

Re: Using yGather data to create waypoints...

Posted: Thu Jun 10, 2010 3:01 am
by rock5
KillerTHC, I'm working on a highly precise conversion using GetPlayerWorldMapPos to get precise in-game coordinates.

I'll finish it after the servers come back online.

In the mean time I need to ask you something. You mentioned in another thread "I have found a method to walk around in RoM that avoids obstacles, the only problem is that it uses the map coordinates". Does your "method" have to use the current map coordinates or can it use world coordinates? Because GetPlayerWorldMapPos (9999) will give world coordinates which would mean I would only have to do 1 conversion. Otherwise I will have to come up with a solution that would require a database of all the min and max values for each map. Can be done but would need a lot more work.

And, like Administrator asked, what is this method?

Edit: Here is an example of how accurate my method is. It is for Thunderhoof Hills. Put this in any waypoint file and run it. It will display the coordinates as reported by the in-game function GetPlayerWorldMapPos() and the calculated values from rombots player.X and player.Z values. Move around and press DELETE to recalculate at the new location. You will see that it yields values that are correct to about 6-7 decimal places and that was from using 2 points that were only about 500 from each other, very close.

Code: Select all

<onLoad>
	while true do
		xdimension={}
		zdimension={}
		xdimension.min=-20340.028388314
		xdimension.max=9000.0241336583
		zdimension.min=-4095.0192965768
		zdimension.max=17910.019899253
		
		xd=(player.X-xdimension.min)/(xdimension.max-xdimension.min)
		zd=(1-(player.Z-zdimension.min)/(zdimension.max-zdimension.min))
		
		printf("In-game coords    : %.14f, %.14f\n", RoMScript("GetPlayerWorldMapPos()"))
		printf("Calculated coords : %.14f, %.14f\n", xd, zd)
		player:sleep()
	end
</onLoad>
Now, KillerTHC, if you tell me your method can use in-game world coordinates using GetPlayerWorldMapPos() then I can just modify it to work with those values otherwise I've already planned how I will use a database of map min and max values to create a function you can use in any zone.

So hurry up and answer!

Re: Using yGather data to create waypoints...

Posted: Sat Jun 12, 2010 4:50 pm
by KillerTHC
Good work on the conversion, the problem is the function requires map coordinates and not world ones. I didn't make the function I just noticed that in game you can right click on the map and select "move to" or "move here" and it will walk you there without walking into most obstacles. So what I thought we could do is edit the walking function so that it tries to use the RoM command WorldMap AutoMove to navigate the waypoints, however sometimes if the point on the map is to far away then it will not be able to auto walk and in that case then RoM Bot will just use the previously used method. Using this method means that if you resurrect at the wrong place you will still be able to get back to the nearest waypoint and keep going as well as the obvious applications of not walking into fences, logs, rocks, etc...

Sorry for the late reply too, you know school plus after prom party makes for a busy weekend.

Re: Using yGather data to create waypoints...

Posted: Sat Jun 12, 2010 5:22 pm
by rock5
KillerTHC wrote:So what I thought we could do is edit the walking function so that it tries to use the RoM command WorldMap AutoMove
That's exactly what I thought you were going to say. You can specify the map to use so we can use the world map id of 9999 so I can use the same function as before but change the min and max values to the world values.

There's still a couple of problems with that. 1 is it sometimes can't work out a path to the destination and some zones it just doesn't work, the new continent for example.

It might be worth exploring, though, maybe for specific purposes.

I'll update the code and post it soon.

Re: Using yGather data to create waypoints...

Posted: Sat Jun 12, 2010 5:39 pm
by KillerTHC
Hmm I didn't think of that. Also if it can't find a path then the bot will just use the normal method that it uses now, this way we get the best of both worlds.

Re: Using yGather data to create waypoints...

Posted: Sat Jun 12, 2010 6:08 pm
by rock5
Here's the function to convert to ingame world coordinates;

Code: Select all

function ConvertToWorldMapPos(X, Z)
	xdimension={}
	zdimension={}
	xdimension.min=-46080.001323271
	xdimension.max= 41760.003443535
	zdimension.min=-28319.998453998
	zdimension.max= 37560.000064441
	
	xd=(X-xdimension.min)/(xdimension.max-xdimension.min)
	zd=(1-(Z-zdimension.min)/(zdimension.max-zdimension.min))
	
	return xd, zd
end
To use it with WorldMap_AutoMove you could use it like this.
If x, z hold the rombot coordinates you want to go to, then;

Code: Select all

gamex, gamez=ConvertToWorldMapPos(x,z)
sendMacro("WorldMap_AutoMove( 9999, " .. gamex ..", " .. gamez .. " )")
I think some thought still needs to be put into when and how to use it before it could become practical.

Re: Using yGather data to create waypoints...

Posted: Sat Jun 12, 2010 6:14 pm
by KillerTHC
Have you tested this way of walking? I will try to test it soon but I'm a little busy right now.

Re: Using yGather data to create waypoints...

Posted: Sat Jun 12, 2010 6:29 pm
by rock5
KillerTHC wrote:Have you tested this way of walking? I will try to test it soon but I'm a little busy right now.
Well I've tested the function and the command but I haven't done any further testing. I haven't tried it in a "real world" scenario because I'm not sure how or where you would use it.

Also it's getting late for me (or should I say early, in the morning that is). I should get some sleep.