pixelSearch relativ to another pixel

06/28/2013 10:37 1337_pu55y#1
Hei guys,

i want to write a script, that looks for a specific pixel.
if the pixel is found, it should look for another pixel, in the area around the first one.

my problem is:

the array returns a "x" and "y" coordinate, which is a specific point on the screen. i thougt i could take the coordinates and do like "x" -50 = $newx
"y" -50 = $newy
"x" +50 = $new2x
"y" +50 = $new2y
and then PixelSearch($newx, $newy, $new2x, $new2y, 2)
( this is an area around the first pixel found.)

this is not possible for me, i cant figure out how to calculate with the first pixelcoordinates, in order to get an area around the first pixel.

I hope it is clear enough and anyone can help me.

If theres a better way to search for a pixel in an area around another pixel, let me know :P

grettings.
06/28/2013 11:35 Croco™#2
I hope this isn't your real code:
Quote:
"x" -50 = $newx
"y" -50 = $newy
"x" +50 = $new2x
"y" +50 = $new2y
But something like that should work:
Code:
$Pixel = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0xFFFFFF)
	If IsArray($Pixel) Then
		$X 	= $Pixel[0]-50
		$Y	 = $Pixel[1]-50
		$X2 	= $Pixel[0]+50
		$Y2 	= $Pixel[1]+50
		$New = PixelSearch($X,$Y,$X2,$Y2,0x00FF00)
	EndIf
06/28/2013 12:13 1337_pu55y#3
No this isnt my real code, its just to express what i was trying, since my english is not the best :D

But your code seems to wrk for me, thanks.