Detect cursor change?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Detect cursor change?

#21 Post by Administrator » Wed Jun 10, 2009 5:31 am


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

Re: Detect cursor change?

#22 Post by xxsinz » Wed Jun 10, 2009 10:10 am

Yes their is, but I have found it not to work so well, hence why I am using Autoit. If you can get a scan bot (scanning for the nodes) working in Lua, I would like to see the code.

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

Re: Detect cursor change?

#23 Post by kumpel100 » Wed Jun 10, 2009 6:02 pm

xxsinz wrote:Yes their is, but I have found it not to work so well, hence why I am using Autoit. If you can get a scan bot (scanning for the nodes) working in Lua, I would like to see the code.
no way you have on every direction other colors thats why im using Cursor move with Cursor code detect.
ImageSearch didnt work too.

the best way would be find memory offsets and work with it.

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

Re: Detect cursor change?

#24 Post by d003232 » Wed Jun 10, 2009 6:25 pm

kumpel100 wrote: no way you have on every direction other colors thats why im using Cursor move with Cursor code detect.
I'm thinking on a solution with mouse over and an ingame tooltip. The tooltip is attached to the mouse position or could be fixed on the screen. And you could detect specific letters in the tooltip by pixel color or even create an own ingame addon who displays an big :-) red point at an specific window position.

If you 'detect' the red point you could use lua to harvest.

But could you still run two or more RoM windows if you use MouseMove in lua?
The RoM Bot Online Wiki needs your help!

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

Re: Detect cursor change?

#25 Post by Administrator » Wed Jun 10, 2009 6:33 pm

Found it. staticcharbase_address + 0x584 points to the object that the mouse is hovering over. If the mouse is not over any type of pawn (harvestable node, enemy, etc.), then this will contain 0. From this, you can read the pawn's information and gather whether or not it is a harvestable node or not.

Here's an example of the usage:

Code: Select all

	local mousePawn = CPawn(memoryReadIntPtr(getProc(), staticcharbase_address, mousePtr_offset));
	if( mousePawn.Address ) then
		printf("Mouse over node name: %s [0x%X]\n", mousePawn.Name, mousePawn.Address);
	end
Where mousePtr_offset is 0x584. This outputs (when hovering over something):
Mouse over node name: Zinc Ore [0x2E05F500]
Enjoy. I will be interested in seeing what you guys do with this.

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

Re: Detect cursor change?

#26 Post by xxsinz » Wed Jun 10, 2009 10:30 pm

Very nice administrator, and no I did not have ever color of every node. What I did was install a Add On that made the tooltip for Nodes, turn to Purple text (this way it does not get confused with monsters, quest items, etc...) and then scan a certain area of the screen, by moving the mouse, every move of the mouse, it scans for that color in a certain range (the size of the tooltip, so it can scan fast), and once it finds the node, it clicks. After the first harvest, have to rescan again, to find the position of the node (cause the position changes easily), then click 5 times, then move to next waypoint.

I know its a horrible way to do it, but only way I could get it to work, but now with Administrators offsets, I will build something better.

User avatar
Chaosis
Posts: 21
Joined: Sun Jun 07, 2009 5:45 pm

Re: Detect cursor change?

#27 Post by Chaosis » Sat Jun 13, 2009 6:08 pm

I know that this may be advanced, and too slow for lua... But you could put all the pixels on the screen into an array (800x600 res might be good). You could even do just every 5 pixels or whatever. Then search for the area with the most grey color and click there to mine tin ore. A "hotspot" clicking function could be useful.

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

Re: Detect cursor change?

#28 Post by kumpel100 » Sun Jun 14, 2009 11:50 am

d003232 wrote:
kumpel100 wrote: no way you have on every direction other colors thats why im using Cursor move with Cursor code detect.
I'm thinking on a solution with mouse over and an ingame tooltip. The tooltip is attached to the mouse position or could be fixed on the screen. And you could detect specific letters in the tooltip by pixel color or even create an own ingame addon who displays an big :-) red point at an specific window position.

If you 'detect' the red point you could use lua to harvest.

But could you still run two or more RoM windows if you use MouseMove in lua?
mousemove, for any kind of detection your RoM must be infront if you using PixelSearch.

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

Re: Detect cursor change?

#29 Post by kumpel100 » Sun Jun 14, 2009 1:02 pm

Chaosis wrote:I know that this may be advanced, and too slow for lua... But you could put all the pixels on the screen into an array (800x600 res might be good). You could even do just every 5 pixels or whatever. Then search for the area with the most grey color and click there to mine tin ore. A "hotspot" clicking function could be useful.
PixelSearch is the worest/Slowest way we can go but atm the only way we get something to work, ok i just use PixelSearch to check if my Harvest Process starts so i see if i have a resource or a Mob, my main routine checks for CursorChange:

this Displays me the CursoCode in combinate with:

Code: Select all

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

return   

this code lets move my cursor over my screen in a cerain location.

Code: Select all

XStart := ((A_ScreenWidth/2)-220)       ; Start Pos x     + =Mehr Breit    - =Weniger Breit 
yStart := ((A_ScreenHeight/2)-90)         ; Start Pos y   wert klein = sucht nieder
XMax := ((A_ScreenWidth/2)+20)          ; max ScannWeite     
Ymax := ((A_ScreenHeight/2)+80)          ; max ScannHöhe
S= 20          ; ScannSchrittweite
Z= 35          ; Zeilenvorschub


start1:
mouseMove, 50, 50
Gosub Begin_Cursor_Check
mouseMove, xstart, ystart
goSub, Z1
goto start1

Z1:
loop
{
IfWinNotActive, Runes of Magic, , WinActivate, Runes of Magic,
coordMode, Mouse, Screen
mouseMove, x +S , y
mouseGetPos, x, y
if x > %xmax%
    {
    mouseMove, x, y+Z
    mouseGetPos, x, y
    GoSub, Z2
    }
if y > %Ymax%
    {
    x=%xStart%
    y=%yStart%
	goto Z1
    }
	gosub CursorCheckvonLinks
	Gosub AbgleichvonLinks
 }
 
   
Z2:
loop
{
 IfWinNotActive, Runes of Magic, , WinActivate, Runes of Magic,
mouseMove x -S , y
mouseGetPos, x, y
if x < %xmin%
    {
    mouseMove, x, y+Z
    mouseGetPos, x, y
   Return
    }
if y > %ymax%
    {
    x=%xStart%
    y=%yStart%
	ToolTip, FERTIG, 840, 460
    sleep 1000
    ToolTip
    exitapp
       }
gosub CursorCheckvonRechts	
Gosub AbgleichvonRechts
}



with this it works on every Screen solution.

Code: Select all

XStart := ((A_ScreenWidth/2)-220)       ; Start Pos x     + =Mehr Breit    - =Weniger Breit 
yStart := ((A_ScreenHeight/2)-90)         ; Start Pos y   wert klein = sucht nieder
XMax := ((A_ScreenWidth/2)+20)          ; max ScannWeite     
Ymax := ((A_ScreenHeight/2)+80)          ; max ScannHöhe
thats only a few snipes from my whole script, thx to Admin you get me some new work to do :)

Post Reply

Who is online

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