Pixelsearch 2 areas?

Ask gaming related questions (AHK v1.1 and older)
hellohithere
Posts: 11
Joined: 21 Dec 2021, 16:30

Pixelsearch 2 areas?

Post by hellohithere » 24 Sep 2022, 14:09

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!

Rohwedder
Posts: 7551
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Pixelsearch 2 areas?

Post by Rohwedder » 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
}

hellohithere
Posts: 11
Joined: 21 Dec 2021, 16:30

Re: Pixelsearch 2 areas?

Post by hellohithere » 25 Sep 2022, 08:02

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?

Rohwedder
Posts: 7551
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Pixelsearch 2 areas?

Post by Rohwedder » 25 Sep 2022, 09:05

Yes just do another pixel search and add CisPurple. And use only the conditions you need.

Post Reply

Return to “Gaming Help (v1)”