key press after pixel color change

Ask gaming related questions (AHK v1.1 and older)
guap0035
Posts: 1
Joined: 25 Mar 2023, 17:20

key press after pixel color change

Post by guap0035 » 25 Mar 2023, 17:28

hi i am very new to ahk, i am trying to write a script that will read a pixel change to the color white, then when it appears on my screen in GTA and to press "K" when the pixel appears at 1124,29 ( at least i think these coordinates are correct as i used the ahk window spy and selected the spot i wanted to getcolorpixel )
I honestly have no idea what i am doing but i need this key press to happen within about 1 second or less before the timer expires in game.
heres what i have:

Code: Select all

Loop
{
	PixelGetColor, color, 1124, 29, RGB
	; msgbox, %color%
	if (color = 0xFFFFFF)
	{
		Send k
		Sleep 10000
		Send y
	}
}
Return
	
esc::exitapp
heres a screenshot of what it looks like in game to kind of help
https://i.ibb.co/VMzghZG/Screenshot-2023-03-25-174905-2.png
Attachments
image.png
image.png (13.61 KiB) Viewed 265 times

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

Re: key press after pixel color change

Post by mikeyww » 26 Mar 2023, 10:49

Welcome to this AutoHotkey forum!

What is the question?

Post Reply

Return to “Gaming Help (v1)”