Page 1 of 1

Pixel search help

Posted: 01 Jul 2022, 18:12
by briebelle
i have the components for my script, i just don't know how to put it together. All i need to do is when this pixel is on the screen (0x46ED2A) Send D.

Re: Pixel search help

Posted: 01 Jul 2022, 19:29
by mikeyww
Welcome to this AutoHotkey forum!

Code: Select all

#Persistent
bgr := 0x2AED46
CoordMode, Pixel
CoordMode, Mouse
Loop {
 SoundBeep, 1900
 PixelSearch, x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, %bgr%,, Fast
} Until !ErrorLevel
Send d
MouseMove, x, y
MsgBox, 64, Done, Done!

Re: Pixel search help

Posted: 02 Jul 2022, 10:42
by briebelle
Thank for the response! I realize now pixel search is not what im looking for. But thats how you learn. would a loop or WaitPixelColor work for this?
I changed it, it works but not exactly as intended. I would like whenever the desired color comes up to do said action.

;PixelGetColor, OutputVar, X, Y
PixelGetColor,Color,3710,238

If Color=0x826589
{
MsgBox it works
}

Re: Pixel search help

Posted: 02 Jul 2022, 12:05
by briebelle
briebelle wrote:
02 Jul 2022, 10:42
Thank for the response! I realize now pixel search is not what im looking for. But thats how you learn. would a loop or WaitPixelColor work for this?
I changed it, it works but not exactly as intended. I would like whenever the desired color comes up to do said action.

;PixelGetColor, OutputVar, X, Y
PixelGetColor,Color,3710,238

If Color=0x826589
{
MsgBox it works
}
Edit:
I added a loop. it works, but it will not work within the application.

Code: Select all

Loop{
PixelGetColor,Color,1135, 1014
If (Color=0x2dAED46){
    sleep 500
	Send {D}
  sleep 10
    }
}

Re: Pixel search help

Posted: 02 Jul 2022, 12:35
by mikeyww
MouseMove to your coordinate to confirm it. Add sleep before the pixel check. Display the color that is found.

Re: Pixel search help

Posted: 02 Jul 2022, 15:36
by briebelle
So the script works as is. but there is one flaw, when i put other inputs, specifically a right click. it will break that cycle of the loop. any suggestions on fix? so far all ive tried is changing the send modes.

Re: Pixel search help

Posted: 02 Jul 2022, 16:19
by mikeyww
:arrow: SetTimer is an alternative. Example