Page 1 of 1

Pixelsearch 2 areas?

Posted: 24 Sep 2022, 14:09
by hellohithere
Hello! First of all thank you for checking out my post..
Secondly, how do I set conditions using pixelsearch?

Scenario:
Square area “A”(x1,y1 x2,y2) purple will appear at first, then blue
square area “B”(x3 y3 x4y4) purple will appear first then blue

What i would like to do:

-When both areas are purple do 1
-When A = Purple, B = Blue do 2
-When A = Blue, B = Purple do 3
-When both areas are Blue do 4

Thank you in advance!

Re: Pixelsearch 2 areas?

Posted: 25 Sep 2022, 03:08
by Rohwedder
Hallo,
first do the two Pixelsearch with color Purple and save the results in AisPurple and BisPurple. Try:

Code: Select all

PixelSearch,,, X1, Y1, X2, Y2, 0x800080,, Fast RGB
AisPurple := !ErrorLevel
PixelSearch,,, X3, Y3, X4, Y4, 0x800080,, Fast RGB
BisPurple := !ErrorLevel
Switch AisPurple BisPurple
{
Case True True:
	MsgBox, do 1
Case True False:
	MsgBox, do 2
Case False True:
	MsgBox, do 3
Case False False:
	MsgBox, do 4
}

Re: Pixelsearch 2 areas?

Posted: 25 Sep 2022, 08:02
by hellohithere
Rohwedder wrote:
25 Sep 2022, 03:08
Hallo,
first do the two Pixelsearch with color Purple and save the results in AisPurple and BisPurple. Try:

Code: Select all

PixelSearch,,, X1, Y1, X2, Y2, 0x800080,, Fast RGB
AisPurple := !ErrorLevel
PixelSearch,,, X3, Y3, X4, Y4, 0x800080,, Fast RGB
BisPurple := !ErrorLevel
Switch AisPurple BisPurple
{
Case True True:
	MsgBox, do 1
Case True False:
	MsgBox, do 2
Case False True:
	MsgBox, do 3
Case False False:
	MsgBox, do 4
}
Thank you for the reply! This is so amazing, thank you so much! I have tried looking for days but didnt find the answer so i decided to post it. Youre a life saver!!!!

If its possible :
If i want to add another colour, do i just do another pixel search and add CisPurple ? And does that mean i will have to add all conditions aswell or only the ones i need?

Re: Pixelsearch 2 areas?

Posted: 25 Sep 2022, 09:05
by Rohwedder
Yes just do another pixel search and add CisPurple. And use only the conditions you need.