Hover object and if color detected click

Ask gaming related questions (AHK v1.1 and older)
cgame
Posts: 3
Joined: 13 Dec 2017, 20:03

Hover object and if color detected click

13 Dec 2017, 20:17

Need your help guys, I can't wrap my head around this one.

Basically, the task is.

in a certain area of a screen x1 y1 x2 y2, I need to click the object when the outline color appears while the mouse is moving/hovering to that area.

What is going on here is... THE THING needs the mouse to hover so that its outlines of the object will appear.
After it appears, then it will click on that object. The outline is a specific one, 1 color.

So what I think I need is.
1. Detection for a area x1 y1 x2 y2
2. The mouse will randomly move to that area and if detected the color it will click to that.
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Hover object and if color detected click

13 Dec 2017, 20:47

I think that what you want is the color before the mouse hovers over it.

Code: Select all

PixelSearch, pixelX, pixelY, x1, y1, x2, y2, 0x800080  ; The last parameter should be the color of the targeted pixel *before* it's been highlighted
MouseMove, pixelX, pixelY
Sleep, 250
Click
That's untested. Increase the sleep if it takes longer than that to highlight the object. You could also make it so that it waits until the highlight color is present, but that's more lines and this might be all that you really need.
cgame
Posts: 3
Joined: 13 Dec 2017, 20:03

Re: Hover object and if color detected click

14 Dec 2017, 19:22

Yah I thought of that and actually using that method now. But the problem is it is not working efficiently. So I came up with the idea of why use the 1 color that is always present/visible everytime but the problem is I have to hover it to make it appear. Moreover, all the things that usually show the outline are the object that I would like to click.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 124 guests