Wait for pixel color

Ask gaming related questions (AHK v1.1 and older)
JordanRamos
Posts: 3
Joined: 22 Feb 2020, 20:55

Wait for pixel color

23 Feb 2020, 10:13

Ok, sooo, my programming skills are very basic and I cant make a script work, I want make a script that keep verifying If there is a determined color on a determined pixel, If yes, then click three times, If no, then keep verifying, basically a wait for pixel color.

Sorry If my english is bad, it isin't my mother languague, thank you for your help.
Rohwedder
Posts: 7658
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Wait for pixel color

29 Feb 2020, 09:30

Hallo,
try:

Code: Select all

#Persistent
SetTimer, PixelColor, 1000
PixelColor:
PixelGetColor, Color, 200, 400
IF Color = 0xFFFFFF ;White
{
	Click 3
	SetTimer, PixelColor, Off ;end verifying
}
Else ;keep verifying
	ToolTip, no click because the color is: %Color%
Return
JordanRamos
Posts: 3
Joined: 22 Feb 2020, 20:55

Re: Wait for pixel color

01 Mar 2020, 02:06

Its not working, I aleardy changed the modes but it always detect a different color (slightly different) like, sometimes f8f8f8, then f8f8f9 its possible to add a color tolerance?
Rohwedder
Posts: 7658
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Wait for pixel color

01 Mar 2020, 03:31

Then perhaps:

Code: Select all

#Persistent
SetTimer, PixelColor, 1000
PixelColor:
X := 200, Y := 400
PixelSearch,,,X,Y,X,Y, 0xFFFFFF, 4 ;tolerance = 4
IF !ErrorLevel
{
	Click 3
	ToolTip
	;SetTimer, PixelColor, Off ;end verifying
}
Else ;keep verifying
{
	PixelGetColor, Color, X, Y
	ToolTip, no click because the color is: %Color%
}
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Moongoose and 40 guests