HELP WITH PIXELSEARCH PLEASE

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Jakk_Uber_Noob
Posts: 18
Joined: 19 Sep 2017, 04:14

HELP WITH PIXELSEARCH PLEASE

25 Sep 2017, 02:11

Code: Select all

PixelSearch, 1Pttx, 1Ptty, 0, 0, A_ScreenWidth, A_ScreenHeight, 0xc9cb04,, Fast
PixelSearch, 2Pttx, 2Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xdada02,, Fast
PixelSearch, 3Pttx, 3Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xd9da02,, Fast
PixelSearch, 4Pttx, 4Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xdadb02,, Fast
PixelSearch, 5Pttx, 5Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xe1e172,, Fast
PixelSearch, 6Pttx, 6Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xe1e711,, Fast
PixelSearch, 7Pttx, 7Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xe0e50f,, Fast
PixelSearch, 8Pttx, 8Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xe1e812,, Fast
PixelSearch, 9Pttx, 9Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xe0e611,, Fast
PixelSearch, 0Pttx, 0Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xe1e712,, Fast
PixelSearch, 00Pttx, 00Ptty, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xe0e610,, Fast

If ErrorLevel = 0   ;;; If it finds any of the colours listed above
	{
	Click
	}
How do i make this work please somebody!
User avatar
Spawnova
Posts: 555
Joined: 08 Jul 2015, 00:12
Contact:

Re: HELP WITH PIXELSEARCH PLEASE

25 Sep 2017, 02:41

All caps title is not needed, people will help if they can =P

As for your script it is only checking the very last pixelsearch since you do not check errorLevel on most of them.
Check out the pixelsearch docs here PixelSearch
it explains how the command works and the parameters

it looks like all your colors are very close to eachother, it could be simplified by adding shade variance

Code: Select all

PixelSearch, outputX, outputY, 0, 0,  A_ScreenWidth, A_ScreenHeight, 0xe0e610,20, Fast ;20 shades of variation allowed, if your color is RGB format, add RGB after Fast
If however you need to search for multiple colors this may help

Code: Select all

x1 := 0
y1 := 0
x2 := a_screenwidth
y2 := a_screenheight
colors := [0xc9cb04,0xdada02,0xd9da02,0xdadb02] ;this is an array, add more to increase colors to search for, separate with comma
return

f1::
loop % colors.Length() { ;go through the colors added in the array above
	PixelSearch, outputX, outputY, x1, y1, x2, y2, colors[a_index],, Fast ;colors[a_index] = the color at a_index in array, so colors[1] = 0xc9cb04
	If (ErrorLevel == 0) {  ; color was found
		msgbox % "Color was found at " outputX "," outputY
		break ;break the loop
	}
}
return
Jakk_Uber_Noob
Posts: 18
Joined: 19 Sep 2017, 04:14

Re: HELP WITH PIXELSEARCH PLEASE

25 Sep 2017, 20:20

you sir are an absoloute legend. <3 Spawnova

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: DanH44, wineguy and 382 guests