Detect cursor change?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Detect cursor change?

#1 Post by xxsinz » Thu Jun 04, 2009 7:09 pm

Anyone know of a way to detect if the actual cursor bitmap changes (not talking underneath the cursor). If anyone has a way of doing this in LUA / micromacro, or anything else that would be great.

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

Re: Detect cursor change?

#2 Post by Administrator » Thu Jun 04, 2009 8:57 pm

You can usually find an integer that describes what the mouse cursor is in game. Usually, something like 0 = none, 1 = normal, 2 = mouse over enemy/attack icon, etc. Start with an unknown value search, and do something in game to change the mouse cursor, then search for changed value. When it hasn't changed, use unchanged value. Keep filtering till you find the address/pointer.

xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Re: Detect cursor change?

#3 Post by xxsinz » Thu Jun 04, 2009 9:25 pm

Alright, but do I need to be hover over the node or actual click it to do the next scan?

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

Re: Detect cursor change?

#4 Post by Administrator » Thu Jun 04, 2009 9:33 pm

Just hover over it so that the mouse cursor changes, then scan for changed value.

xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Re: Detect cursor change?

#5 Post by xxsinz » Thu Jun 04, 2009 9:41 pm

Doing that now, but their over 100,000 values... no better way of doing this?

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

Re: Detect cursor change?

#6 Post by Administrator » Thu Jun 04, 2009 11:26 pm

Nope. That's pretty much it. Remember to move the mouse to another node (to change the cursor) then back, and search unchanged value. This helps narrow down the results greatly. Sometimes, it can be a lengthy process.

xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Re: Detect cursor change?

#7 Post by xxsinz » Fri Jun 05, 2009 11:45 am

Thanks, guess just have to try to narrow it down the best I can. I had a quick question, anyway to target a NPC and open the window with them through LUA?

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

Re: Detect cursor change?

#8 Post by Administrator » Fri Jun 05, 2009 4:30 pm

Not easily, no. I guess the best way to do that would be to scan the area by moving the mouse and checking for cursor change, then send a mouse click.

xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Re: Detect cursor change?

#9 Post by xxsinz » Fri Jun 05, 2009 5:53 pm

Alright, ya for now I am just using a Pixel Scan in certain area, and if it hovers over the NPC, see the color of the NPC name, then it gets the Mouse X / Y coords and clicks, working pretty well for now. Final have a script that auto repairs, makes botting so much better.

kumpel100
Posts: 47
Joined: Sat May 09, 2009 11:12 am

Re: Detect cursor change?

#10 Post by kumpel100 » Tue Jun 09, 2009 12:36 pm

try this:

Code: Select all



b::
start:
gosub CursorCheck
msgbox,,, CursorCode=  %Cursor_h% ,2
goto start

CursorCheck:
{
 VarSetCapacity(ci, 20, 0)
 ci := Chr(20)
 ErrorLevel := DllCall("GetCursorInfo", "uint", &ci)
 ErrorLevel := mod(ErrorLevel + 1, 2)
 Cursor_h := *(&ci+8)+(*(&ci+9) << 8)+(*(&ci+10) << 16)+(*(&ci+11) << 24)
 }
return

q::
pause

n::
exitapp
i use this in my Harvest.exe to detect cursor changes...

is written to use it with autohotkey.

P.s is an example :)

xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Re: Detect cursor change?

#11 Post by xxsinz » Tue Jun 09, 2009 12:48 pm

So your actual able to get cursor information, that is weird, I can do it with Autoit, but the handler seems to change all the time, is this the case for you?

kumpel100
Posts: 47
Joined: Sat May 09, 2009 11:12 am

Re: Detect cursor change?

#12 Post by kumpel100 » Tue Jun 09, 2009 1:51 pm

there is a trick how to handle the cursor changes.

1) Cursocode of random area

2) Cursocode when Cursor change (must be resource or a Mob.)

3) click the found area, get a new CursorCode and check for this code every click on the "Resource" if there no process must be a mob...

and yes i check 1 time for Blue Processbar to see its a Mob or a Resource.


P.s hard to explain for me in english.

xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Re: Detect cursor change?

#13 Post by xxsinz » Tue Jun 09, 2009 2:28 pm

It seems that anytime I get the Handle for the Cursor, then move the mouse anywhere, the Handle changes, so It would be clicking pretty much the entire screen everytime, unless is their a Range for the handles for Mobs / Nodes?

kumpel100
Posts: 47
Joined: Sat May 09, 2009 11:12 am

Re: Detect cursor change?

#14 Post by kumpel100 » Tue Jun 09, 2009 3:15 pm

xxsinz wrote:It seems that anytime I get the Handle for the Cursor, then move the mouse anywhere, the Handle changes, so It would be clicking pretty much the entire screen everytime, unless is their a Range for the handles for Mobs / Nodes?
i use a big route of of waypoints every waypoint is a resource spot on every waypoint i reach i let move my mouse in a little square when cursor change there is a Mob or a Resource.
this way i farm ~200 resources per hr is not much but its AFK ^^.

xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Re: Detect cursor change?

#15 Post by xxsinz » Tue Jun 09, 2009 3:27 pm

Oh, so you already know where the node is going to be. Cause I already built a way to detect a node and then run up to it / harvest it. The trouble I was having was actual finding the node, while I was botting. That is pretty crazy to set up a path that goes to every node like that, I am looking for more a way to be able to bot anywhere and harvest.

Thanks for the information!

kumpel100
Posts: 47
Joined: Sat May 09, 2009 11:12 am

Re: Detect cursor change?

#16 Post by kumpel100 » Tue Jun 09, 2009 3:40 pm

xxsinz wrote:Oh, so you already know where the node is going to be. Cause I already built a way to detect a node and then run up to it / harvest it. The trouble I was having was actual finding the node, while I was botting. That is pretty crazy to set up a path that goes to every node like that, I am looking for more a way to be able to bot anywhere and harvest.

Thanks for the information!
you can wrote in every waypoint your bot reach a look for nodes routine i use this:

Code: Select all

</waypoint>
   <waypoint x="-xxxx" z="-xxxx" >
   yrest(100);
     os.execute("\"C:/Harvest.exe\" arguments");
     yrest(100);
     while(true) do
  local foundProc = findProcessByExe("Harvest.exe");
  if( foundProc == 0 ) then
    break; -- break out, we don't have any Harvest.exe running
  end
  yrest(100);
end
yrest(100);
</waypoint>
while still kill mobs i harvest too.

xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Re: Detect cursor change?

#17 Post by xxsinz » Tue Jun 09, 2009 4:01 pm

That is cool, but see if their is no nodes around all your waypoints, then your not going to have much luck. I can try to give it a try, see what happens, thanks again.

kumpel100
Posts: 47
Joined: Sat May 09, 2009 11:12 am

Re: Detect cursor change?

#18 Post by kumpel100 » Tue Jun 09, 2009 4:19 pm

what i say around 200 nodes a hour...
i know there are much better ways to make a Harvest/Xp bot but for my useage is ok.

xxsinz
Posts: 67
Joined: Wed May 27, 2009 9:45 am

Re: Detect cursor change?

#19 Post by xxsinz » Tue Jun 09, 2009 4:40 pm

Well to be honest, the only way I know how to do is some what using your method, already had something similar, just added the waypoint code, testing it now.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Detect cursor change?

#20 Post by d003232 » Wed Jun 10, 2009 5:01 am

Administrator wrote:Not easily, no. I guess the best way to do that would be to scan the area by moving the mouse and checking for cursor change, then send a mouse click.
Is there a way/function to detect pixel change with lua / MicroMacro ?
The RoM Bot Online Wiki needs your help!

Post Reply

Who is online

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