PixelGetColor click

Ask gaming related questions (AHK v1.1 and older)
Puush
Posts: 1
Joined: 18 Nov 2016, 22:56

PixelGetColor click

18 Nov 2016, 23:06

Hello guys I need some help with a simple script i've been trying to make..

I need it to scan a certain area in a certain window for a color and if that color is true, LButton tap. and everything in a loop.

Code: Select all

#Persistent
CoordMode, Pixel, Relative 
IfWinActive, Window name

PixelGetColor,0xFE0000,960,540 

If Color=0xFE0000 
{
 Click
}
and it doesn't work... I can see in the Window Spy that the color in these cordinates turns 0xFE0000 and I don't get a click ;\ if someone can tell me what i'm doing wrong that would be really helpful.

P.S. if you feel really generous could you please help me expand the scanning area to scan between X 955-965 and Y 535-545
also can I make the script always scan and click when color is true?
Leli196
Posts: 216
Joined: 29 Aug 2015, 05:47
Location: Germany

Re: PixelGetColor click

19 Nov 2016, 09:52

Your code misses the outputvar of PixelGetColor:

PixelGetColor, OutputVar, X, Y [, Alt|Slow|RGB]

Leli196
User avatar
WAZAAAAA
Posts: 88
Joined: 13 Jan 2015, 19:48

Re: PixelGetColor click

19 Nov 2016, 14:50

you should use PixelSearch instead since it supports large scan areas

Code: Select all

::
Loop
{
	PixelSearch, , , 960, 600, 960, 600, 0xFE0000, 0, Fast RGB
	if ErrorLevel = 0
	{
		click left down
		Sleep,50
		click left up
		Sleep,50
	}
}
return

Ins::ExitApp ;press Ins to panic exit the script
YOU'RE NOT ALEXANDER

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 122 guests