Pixel search help

Ask gaming related questions (AHK v1.1 and older)
briebelle
Posts: 4
Joined: 01 Jul 2022, 15:28

Pixel search help

Post by briebelle » 01 Jul 2022, 18:12

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.

User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Pixel search help

Post by mikeyww » 01 Jul 2022, 19:29

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!
Attachments
2AED46.png
BGR 0x2AED46
2AED46.png (321 Bytes) Viewed 807 times

briebelle
Posts: 4
Joined: 01 Jul 2022, 15:28

Re: Pixel search help

Post by briebelle » 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
}

briebelle
Posts: 4
Joined: 01 Jul 2022, 15:28

Re: Pixel search help

Post by briebelle » 02 Jul 2022, 12:05

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
    }
}
Last edited by BoBo on 02 Jul 2022, 12:07, edited 1 time in total.
Reason: Added [code][/code]-tags.

User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Pixel search help

Post by mikeyww » 02 Jul 2022, 12:35

MouseMove to your coordinate to confirm it. Add sleep before the pixel check. Display the color that is found.

briebelle
Posts: 4
Joined: 01 Jul 2022, 15:28

Re: Pixel search help

Post by briebelle » 02 Jul 2022, 15:36

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.

User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Pixel search help

Post by mikeyww » 02 Jul 2022, 16:19

:arrow: SetTimer is an alternative. Example

Post Reply

Return to “Gaming Help (v1)”