Where am I ()

Talk about anything in Runes of Magic. This does not need to pertain to botting.
Message
Author
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Where am I ()

#21 Post by BlubBlab » Sun Jun 14, 2015 4:30 pm

Finding your position works like this:

Code: Select all

local x1= player.X
local y1 = player.Y
local z1 = player.Z
Arrays in lua are associative arrays like in php too.

First basic is :

Code: Select all

array1 = {324324,"I want beef", true, 567}
You can see you can mix the datatypes this would be a simple numbered array which is number 1 until 4
e.g.

Code: Select all

local output = array1[2];
print(output);
Gives us the message :"I want beef", unlike other languages lua's array index start with 1;

You can also use labels as index like in php;

Code: Select all

array1["MyPony"] = " Johnny";

--- the crack point is I think is this:
array1 = { myfirstPony = " Johnny", secondPony = "Mulz", thirdPony="Mulzwasnussine" };
-- This left side is the label , the right side the value there are 2 ways to access them which are equal.
 output1 = array1.myfirstPony;
--or
output1 = array1["myfirstPony"];
you can also put tables into tables(tables are the arrays in lua), same goes for function pointers/closures. if you want to know what they are in real they are hash-maps.

In the waypoint file you must check your position than compare that and load either a waypoint tag or a new waypoint file which match with the position you found.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Where am I ()

#22 Post by beanybabe » Sun Jun 14, 2015 6:27 pm

i tried various versions of this but keep getting errors in onload or wp it seems like it should work

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
while not(RoMScript("UnitExists("somenpc")") )
print "aaa"
end
</onload>        
</waypoints>

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Where am I ()

#23 Post by BlubBlab » Sun Jun 14, 2015 6:38 pm

correction:

Code: Select all

	
Code:
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
while not(RoMScript("UnitExists("somenpc")") )do
print("aaa")
end
</onload>       
</waypoints>
Lua has a bit different semantic than C languages.

Code: Select all

while(true) do  
dosomething()
end ; 

if(true) then
dosomething()
end;


if(true) then
dosomething()
else
somethingelse();
end

This may help : http://www.lua.org/pil/contents.html

Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Where am I ()

#24 Post by beanybabe » Sun Jun 14, 2015 7:29 pm

I notice that travelto and teleportto were updated im going to see if i can make them work.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Where am I ()

#25 Post by lisa » Sun Jun 14, 2015 8:21 pm

BlubBlab wrote: I think waypoint files are better we use tons of code in them but in theory what crossed my mind was I record the NPC(pos) and the Quest which I take and give from them. I think it would be nice to use automatic pathfinding for the NPC. It would make things sometimes easier(when you run in the session a complete wrong way). To be true with the code examples out of AQB and yGather there isn't anything I couldn't find automatically , so a 100% record of everything ...moment.
I came across this post which might explain what I mean better, you could do tasks without the use of waypoints.
lisa wrote:

Code: Select all

Type in 'q' (without quotes) to quit.
Command> travel2(110591,true) player:target_NPC("Snoop the Stubborn") ChoiceOptionByName("Varanas") yrest(1000) sendMacro('StaticPopup_OnClick(StaticPopup1, 1);') waitForLoadingScreen() print("it works")

Destination found
10 points left to go before destination.
9 points left to go before destination.
8 points left to go before destination.
7 points left to go before destination.
6 points left to go before destination.
5 points left to go before destination.
4 points left to go before destination.
3 points left to go before destination.
2 points left to go before destination.
1 points left to go before destination.
Arrived at destination.
We try to find NPC Snoop the Stubborn:
We successfully target NPC Snoop the Stubborn and try to open the dialog window.

Use MACRO: Executing RoMScript "ChoiceOption(3);".
Use MACRO: Executing RoMScript "StaticPopup_OnClick(StaticPopup1, 1);".
Player address changed: 0x3A637800
Ranged skill found: MAGE_FLAME
it works
Command>
it walked to snoop from other side of map and then used snoop to get to varanas.
Keep in mind there have been a lot of things added to the bot since this was worked on which would make things much easier. The big issue with the idea was creating the points for each map and the task was a bit to big really but it was still a good idea.

Basically the code would then start to look like this for what you want done by the "WP"

Code: Select all

travel(110726) -- travel to NPC with this ID
player:target_NPC(110726) --pick up quests
travel("merchant") -- travel to nearest merchant
player:merchant("Phil Buji") -- does auto sell/buy
travel({110,2000,140}) -- travel to a spot on map
farmmob("Bear",30) --function to kill # mobs.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Where am I ()

#26 Post by BlubBlab » Mon Jun 15, 2015 3:41 am

I think the problem with that is that not only you must see the full collision-box but also all mobs and NPC's before you can see them. Which result in overkill.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Where am I ()

#27 Post by rock5 » Wed Jun 17, 2015 3:20 am

lisa wrote:travel(110726) -- travel to NPC with this ID
Except npcs can move or even appear in multiple locations. Maybe they have different ids in different locations. I'm not sure.
lisa wrote:travel({110,2000,140}) -- travel to a spot on map
This should be the default functionality but coordinates can overlap on different continents so there would need to be an extra argument indicating the continent.


Any manual marking of points will always lead to failure I think because the world is just too big. It needs to be automated as much as possible for any chance of it working. With Administrator talking about collision detection, I had an idea. What if we filled a map with computer generated points and have it automatically add links between points and their nearest neighbors. Then as the travel function is used by users and it encounters an obstacle blocking it, it removes the link between those 2 points and recalculates the path. That way it will still get to the destination, in theory, and will avoid those obstacles in the future. If this data could be uploaded automatically it wouldn't take long before most common locations could be reached easily. The only issues I see are things like water - which you might want to avoid, or you might want to use a path instead of running through a monster infested area. Ideally it should also be collecting information about mobs and npcs etc. That way you could specify you want to take a safe route instead of the most direct if you are trying to get a low level character through a higher level area.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: Where am I ()

#28 Post by noobbotter » Wed Jun 17, 2015 7:26 am

If you made it with a way of marking/recording locations of mobs, it would sure make it easy in the future to... say you needed the card for xxx mob... to just do a farm(xxx) and it would travel to that mob location and start farming the mobs.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Where am I ()

#29 Post by BlubBlab » Wed Jun 17, 2015 7:38 am

rock5 wrote:
lisa wrote:travel(110726) -- travel to NPC with this ID
Except npcs can move or even appear in multiple locations. Maybe they have different ids in different locations. I'm not sure.
lisa wrote:travel({110,2000,140}) -- travel to a spot on map
This should be the default functionality but coordinates can overlap on different continents so there would need to be an extra argument indicating the continent.


Any manual marking of points will always lead to failure I think because the world is just too big. It needs to be automated as much as possible for any chance of it working. With Administrator talking about collision detection, I had an idea. What if we filled a map with computer generated points and have it automatically add links between points and their nearest neighbors. Then as the travel function is used by users and it encounters an obstacle blocking it, it removes the link between those 2 points and recalculates the path. That way it will still get to the destination, in theory, and will avoid those obstacles in the future. If this data could be uploaded automatically it wouldn't take long before most common locations could be reached easily. The only issues I see are things like water - which you might want to avoid, or you might want to use a path instead of running through a monster infested area. Ideally it should also be collecting information about mobs and npcs etc. That way you could specify you want to take a safe route instead of the most direct if you are trying to get a low level character through a higher level area.
This was the reason I said it is overkill. Your idea is maybe possible but also highly complex. What you can do when you have the a route finding option and the collision-box is that you use a different way of moveTo(..), so you can put points where your NPC should stay and also be able to put checkpoints between so you can force a different route, at least that seems the most basic solution.

I know when I read that code I became aware why admin didn't wanted waypoints XML files any more in future versions but I don't see a simpler solution the other way would be creating huge tables with countless braces in it to easy to miss a } or {. Even when we found somehow all infos about ROM you can't expect to have it in other games.

About the regions moving outside of a continent would properly create a "I can't find route error" if the point is on another map I think adding the map id/name additionally to XYZ on the waypoint would be a good idea.(like I suggest long before).
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Where am I ()

#30 Post by lisa » Wed Jun 17, 2015 9:27 pm

rock5 wrote:
lisa wrote:travel(110726) -- travel to NPC with this ID
Except npcs can move or even appear in multiple locations. Maybe they have different ids in different locations. I'm not sure.
Some do walk around and those keep the same ID, the ones in different spots have different Id's, best example is that long chain quest in Thunderhoof Hills, the dragon guy or what ever his name was, for each location he has a different Id.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Where am I ()

#31 Post by beanybabe » Wed Jun 17, 2015 11:21 pm

For cards hunting I just created hundreds of special focused wps aimed at just 1 mob. Most what i have done is simple point to point but some have area hunting. I often thought of expanding with a master wp that called them and set char to each for a designated time or number focusing on main stat cards needed. If you plan to hunt cards put this in the onload

Code: Select all

 sendMacro('SetInstanceLevel("hard")');
set move speed up a tiny bit and use damage food.

Trying to code global could be done if you used 2 characters to map it out. Have one running ahead a bit and the lagging one checking line of sight to it as it moves point to point. just an idea but beyond my ability's.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Where am I ()

#32 Post by beanybabe » Thu May 05, 2016 8:56 pm

I am thinking of trying to use this to run mir ror path so you just need 1 wp for all have it check what zone and start. may be nice for mini also.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest