RoM bot

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Locked
Message
Author
bbf
Posts: 5
Joined: Wed May 13, 2009 9:48 pm

Re: RoM bot

#1001 Post by bbf » Thu May 14, 2009 5:06 pm

Administrator wrote:Thanks for the info. I've committed the changes to (hopefully) fix the death detection problem and improvement to wander to SVN.
I found a "bug" in my code. You might wanna change that code to this:

Code: Select all

function resumeCallback()
   if( settings.profile.options.PATH_TYPE == "wander" ) then
      player:update();
      printf("Setting wander point to our current location (%d, %d).\n", player.X, player.Z);
      __WPL = CWaypointListWander();
      __WPL:setRadius(settings.profile.options.WANDER_RADIUS);
   end
end
atResume(resumeCallback);
When you resume the script, player data hasn't been updated for quite some time, and thus makes an waypoint on your old location. All I needed to add is the player:update().

I also changed the CWaypointListWander:getnextWaypoint()

Code: Select all

function CWaypointListWander:getNextWaypoint()
	local randAngle = math.random(0, 359);
	local randAngleRad = math.rad(randAngle);
	local randRadius = math.random(0, self.Radius);
	
	local randX = math.cos(randAngleRad) * randRadius;
	local randY = math.sin(randAngleRad) * randRadius;

	local X = self.OrigX + randX;
	local Z = self.OrigZ + randY;

	return CWaypoint(X, Z);
end
The fact that you specify a radius for the wander area, means you should have a circle around it. The old code was creating a box, in which the corners would have been farther from the center then the radius. This is more of a cosmetic fix.




I also did some other changes, to implement on the fly waypoint generation (clear, insert, save) from inside bot.lua. But due to the way RoM's code is currently structured, it didn't really work as it should. We would need to change all the code to prevent it from being blocking function calls (like player:moveTo()).

BTW, Administrator, have you tried to map the memory on the client where the enemy/entity list is?

cya

frank
Posts: 26
Joined: Wed Apr 22, 2009 12:11 pm

Re: RoM bot

#1002 Post by frank » Thu May 14, 2009 6:41 pm

Administrator wrote:Thanks for the info. I've committed the changes to (hopefully) fix the death detection problem and improvement to wander to SVN.

If you figure out what '8' is supposed to stand for, let me know. Maybe it has to do with how you died? Perhaps if you don't get debt (under level 10, PKed, etc.) that could cause this.
Oops I spoke to soon. I was just PK'd awhile ago and my Bot kept going on as if I was alive. The only time my bots ever die is to PKers, so I am not sure why most of the time they detect the death, but some times do not.

Rajinn
Posts: 33
Joined: Mon Apr 13, 2009 12:43 pm

Re: RoM bot

#1003 Post by Rajinn » Thu May 14, 2009 7:10 pm

bbf wrote: BTW, Administrator, have you tried to map the memory on the client where the enemy/entity list is?
I have, finding the location of the target is easy, finding the location of all monsters around you is a pain. I've tried 6 or 7 different manners to do so, but overall it's too dynamic and it makes it annoying as utter hell.

What do you need it for??

Rajinn
Posts: 33
Joined: Mon Apr 13, 2009 12:43 pm

Re: RoM bot

#1004 Post by Rajinn » Thu May 14, 2009 7:12 pm

frank wrote:
Administrator wrote:Thanks for the info. I've committed the changes to (hopefully) fix the death detection problem and improvement to wander to SVN.

If you figure out what '8' is supposed to stand for, let me know. Maybe it has to do with how you died? Perhaps if you don't get debt (under level 10, PKed, etc.) that could cause this.
Oops I spoke to soon. I was just PK'd awhile ago and my Bot kept going on as if I was alive. The only time my bots ever die is to PKers, so I am not sure why most of the time they detect the death, but some times do not.
I believe being pked changes your state differently than dying normally.
For the record, I have no problems with being pked, killed, dying randomly, falling from a cliff... etc. It still revives perfectly. (It might be something I have done though, I've modded the everloving hell out of this bot)

bbf
Posts: 5
Joined: Wed May 13, 2009 9:48 pm

Re: RoM bot

#1005 Post by bbf » Thu May 14, 2009 7:57 pm

Rajinn wrote:
bbf wrote: BTW, Administrator, have you tried to map the memory on the client where the enemy/entity list is?
I have, finding the location of the target is easy, finding the location of all monsters around you is a pain. I've tried 6 or 7 different manners to do so, but overall it's too dynamic and it makes it annoying as utter hell.

What do you need it for??
It would be a lot more efficient to just go straight to the closest monster, than steering around until "tab" selects an enemy. Sometimes you are near agro monsters, and a pack gang bangs you. And the bot after killing the first one, starts looking for a target, and targets a far away enemy before the one his back get's targeted.
Not to mention, you could filter your targets.

Rajinn
Posts: 33
Joined: Mon Apr 13, 2009 12:43 pm

Re: RoM bot

#1006 Post by Rajinn » Thu May 14, 2009 8:30 pm

you can already filter mobs...
as for checking the closest, constantly iterating through every monster and triangulating its position compared to yours then checking for anything blocking the path etc etc etc is a lot of calculations and will make the bot eat up more cpu than it should.

simple works - keep it simple.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: RoM bot

#1007 Post by Administrator » Thu May 14, 2009 9:43 pm

Here's an experimental change to help prevent you from getting gang raped...Need some people to test it out for me.

Line 416 of player.lua,

Code: Select all

		if( canTarget and (not ignoreCycleTargets) ) then
Change to:

Code: Select all

		if( canTarget and (not ignoreCycleTargets) and (not self.Battling) ) then
This will prevent you from attacking more monsters when you're already in combat.


And yes, I do have some code to access the monster list. However, there are problems with it, such as: A) needing to improve the injector for Vista, B) Improving speed and memory usage, C) Improving speed across IPC channel.

birdy64
Posts: 20
Joined: Fri May 08, 2009 9:06 am

Re: RoM bot

#1008 Post by birdy64 » Fri May 15, 2009 5:29 am

For some reason my bot stopped targeting and stopped looting this morning. I did a complete reinstall of RoM bot and updated the addresses.

Izebize
Posts: 18
Joined: Tue Apr 07, 2009 11:38 am

Re: RoM bot

#1009 Post by Izebize » Fri May 15, 2009 5:38 am

Administrator wrote:Here's an experimental change to help prevent you from getting gang raped...Need some people to test it out for me.
I tried it. It works good for me, but if I use this, then it doesn't use the target selector (TAB) bind, so only attacks after an aggro mob attacks me (getting in battle).

birdy64
Posts: 20
Joined: Fri May 08, 2009 9:06 am

Re: RoM bot

#1010 Post by birdy64 » Fri May 15, 2009 6:03 am

Izebize wrote:
Administrator wrote:Here's an experimental change to help prevent you from getting gang raped...Need some people to test it out for me.
I tried it. It works good for me, but if I use this, then it doesn't use the target selector (TAB) bind, so only attacks after an aggro mob attacks me (getting in battle).
Thanks! I guess it was a long night and didn't realize I made the change. I get gang raped all the time because I target another mob even though I'm getting hit from behind. I wish there was this coding but still used the Tab targeting.

bbf
Posts: 5
Joined: Wed May 13, 2009 9:48 pm

Re: RoM bot

#1011 Post by bbf » Fri May 15, 2009 3:26 pm

Administrator wrote:Here's an experimental change to help prevent you from getting gang raped...Need some people to test it out for me.

Line 416 of player.lua,

Code: Select all

		if( canTarget and (not ignoreCycleTargets) ) then
Change to:

Code: Select all

		if( canTarget and (not ignoreCycleTargets) and (not self.Battling) ) then
This will prevent you from attacking more monsters when you're already in combat.


And yes, I do have some code to access the monster list. However, there are problems with it, such as: A) needing to improve the injector for Vista, B) Improving speed and memory usage, C) Improving speed across IPC channel.
I already changed a lot of code, but I think I have another idea how to solve the problem.
Anyways, I might do a complete overhaul of the bot, but I'm not sure if you would like the changes.
What I intend in doing, is separating logic in modules, each with it's own behavior and actions (targeting, movement).

That's why I was asking if there are anymore informations we can pull from the client that are already mapped.
I used to code a bot for Diablo2 (d2jsp or somehting), and I was able to do a Pindleskin run in 15-17 seconds =), while the default bot took 30-40. So I know there's a lot room for improvement in this bot aswell.

But initially, the enemy list would already help a lot. And if anyone has really time, terrain for map finding would be great. I'm really new to Runes of Magic, so I'm not sure on how complex that is. Do you have bridges that you can go under on this game ? Or is it a flat map just with elevation ?

Izebize
Posts: 18
Joined: Tue Apr 07, 2009 11:38 am

Re: RoM bot

#1012 Post by Izebize » Fri May 15, 2009 4:47 pm

Can you share your code?

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: RoM bot

#1013 Post by Administrator » Fri May 15, 2009 6:13 pm

But initially, the enemy list would already help a lot. And if anyone has really time, terrain for map finding would be great. I'm really new to Runes of Magic, so I'm not sure on how complex that is. Do you have bridges that you can go under on this game ? Or is it a flat map just with elevation ?
The DLL that I'm working on will do 90% of the prep-work for gathering monster info for you. It'll be easy to access the monster list out of it. Just once every x seconds, you would query the list, and use that until the next query. But you'd also have to check that all the information in the list is still going to be valid (that is, it would be possible that an object is deleted from the client while it still shows up in the monster list for a short time--not really any way around this), which is simple to do.

There are bridges and stuff that you can go under. For the most part, though, it's best to avoid all lakes and rivers, while going over a bridge would be fine. With the way the terrain works near rivers, it's sometimes incredibly difficult to get out of them for a human, so it's going to be quite difficult for a bot to do it.

And then there's also things like The Tower of Wailing Wind, which would be difficult to navigate unless split into multiple levels. You could create a 2D VMAP with multi-tiers that are selected based on Y position. It wouldn't be too much different from how the original DOOM did it's collision detection. Actually, the cross-axis algorithm would work great here. And A* could be used for path finding.


Also, an update to the anti-gang-rape test:
Change inBattle_offset to 0x572 in your addresses.lua

Then, line ~598 of player.lua, you'll need to fix the self.Battling line:

Code: Select all

	self.Battling = debugAssert(memoryReadBytePtr(getProc(), staticcharbase_address, inBattle_offset), language[41]) == 1;
It should now work normally.

bbf
Posts: 5
Joined: Wed May 13, 2009 9:48 pm

Re: RoM bot

#1014 Post by bbf » Sat May 16, 2009 11:18 am

Izebize wrote:Can you share your code?
As soon as I have something usable, I'll share it. But don't hold your breath because until there's enough stuff to build on, I'm not really starting to work on it.

birdy64
Posts: 20
Joined: Fri May 08, 2009 9:06 am

Re: RoM bot

#1015 Post by birdy64 » Mon May 18, 2009 5:55 am

The Anti-Gang-Rape coding is working great! I'm still having the issue where the dead corpse stays in my focus after it has been 100% looted and not clearing. This causes me to miss good targets and run right by them. Does the bot acquire new targets via the Tab key?
Last edited by birdy64 on Mon May 18, 2009 6:12 am, edited 1 time in total.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: RoM bot

#1016 Post by Administrator » Mon May 18, 2009 6:00 am

Check classes/player.lua, ~line 336:

Code: Select all

		--self:clearTarget();
Remove the '--' in that line to re-enable target clearing. Although it may still appear that you have something targeted (it doesn't update the UI), it will be cleared.

birdy64
Posts: 20
Joined: Fri May 08, 2009 9:06 am

Re: RoM bot

#1017 Post by birdy64 » Mon May 18, 2009 6:16 am

Administrator wrote:Check classes/player.lua, ~line 336:

Code: Select all

		--self:clearTarget();
Remove the '--' in that line to re-enable target clearing. Although it may still appear that you have something targeted (it doesn't update the UI), it will be cleared.
Ok I am trying it now, thanks for the fast reply! I will keep you updated.

MatthiasB
Posts: 7
Joined: Tue Mar 17, 2009 11:52 am

Re: RoM bot

#1018 Post by MatthiasB » Mon May 18, 2009 8:05 am

Administrator wrote: To use:
Very simple. Just open up RoM and log in. Now open MicroMacro and execute the script rom/bot.lua and then press DELETE to start. That's it. If you have multiple RoM windows open (multiple bots are supported) then you must bring the window to attach to to top then press DELETE again.
Can someone help me with this? I run two RoM windows and tried to run two bots.
First I ran the first bot, working fine like always. Then I started another RoM and tried to run MM. I entered the bot.lua and got this:
"Multiple RoM windows found. Keep the RoM window to attach this bot to on top, and press XY."

Before I started the 2nd bot I minimized the first RoM window and maximized the 2nd one ... Where is the problem? :X

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: RoM bot

#1019 Post by Administrator » Mon May 18, 2009 8:18 am

MatthiasB wrote: Before I started the 2nd bot I minimized the first RoM window and maximized the 2nd one ... Where is the problem? :X
There is none. The bot just recognizes that there are two RoM clients running, and is asking which client it should be using. You do this by bringing the client you want to bot with on top (in front of all other windows), and then pressing the hotkey it asks for.

MatthiasB
Posts: 7
Joined: Tue Mar 17, 2009 11:52 am

Re: RoM bot

#1020 Post by MatthiasB » Mon May 18, 2009 8:28 am

Administrator wrote:
MatthiasB wrote: Before I started the 2nd bot I minimized the first RoM window and maximized the 2nd one ... Where is the problem? :X
There is none. The bot just recognizes that there are two RoM clients running, and is asking which client it should be using. You do this by bringing the client you want to bot with on top (in front of all other windows), and then pressing the hotkey it asks for.
Hm like I said, I tried that, but it's not working. It says:

"playerAddr: 0x0
playerTarget: 0x0
Cannot open file 'C:/XYZ/.xml' for reading."

So he can't read the players addr of the 2nd char (even if the window is on top)? Thanks for your fast reply <3!

Locked

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests