Page 1 of 2

Detect cursor change?

Posted: Thu Jun 04, 2009 7:09 pm
by xxsinz
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.

Re: Detect cursor change?

Posted: Thu Jun 04, 2009 8:57 pm
by Administrator
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.

Re: Detect cursor change?

Posted: Thu Jun 04, 2009 9:25 pm
by xxsinz
Alright, but do I need to be hover over the node or actual click it to do the next scan?

Re: Detect cursor change?

Posted: Thu Jun 04, 2009 9:33 pm
by Administrator
Just hover over it so that the mouse cursor changes, then scan for changed value.

Re: Detect cursor change?

Posted: Thu Jun 04, 2009 9:41 pm
by xxsinz
Doing that now, but their over 100,000 values... no better way of doing this?

Re: Detect cursor change?

Posted: Thu Jun 04, 2009 11:26 pm
by Administrator
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.

Re: Detect cursor change?

Posted: Fri Jun 05, 2009 11:45 am
by xxsinz
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?

Re: Detect cursor change?

Posted: Fri Jun 05, 2009 4:30 pm
by Administrator
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.

Re: Detect cursor change?

Posted: Fri Jun 05, 2009 5:53 pm
by xxsinz
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.

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 12:36 pm
by kumpel100
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 :)

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 12:48 pm
by xxsinz
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?

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 1:51 pm
by kumpel100
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.

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 2:28 pm
by xxsinz
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?

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 3:15 pm
by kumpel100
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 ^^.

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 3:27 pm
by xxsinz
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!

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 3:40 pm
by kumpel100
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.

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 4:01 pm
by xxsinz
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.

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 4:19 pm
by kumpel100
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.

Re: Detect cursor change?

Posted: Tue Jun 09, 2009 4:40 pm
by xxsinz
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.

Re: Detect cursor change?

Posted: Wed Jun 10, 2009 5:01 am
by d003232
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 ?