Hi,
I'm running a script wich scans five locations via PixelGetColor.
if (ColorPos1==ColorPink) and (ColorPos2==ColorPink) and (ColorPos3==ColorPink) and (ColorPos4==ColorPink) and (ColorPos5==ColorPink)
gosub, Pink
If all 5 ColorsPositions equal ColorPink the script is hopping to Pink: , so far so good
It would be nice to have the script hopping to Pink: even if only 4 of thoses ColorPositions equal ColorPink..
Using
if ((ColorPos1==ColorPink) and (ColorPos2==ColorPink) and (ColorPos3==ColorPink)) and ((ColorPos4==ColorPink) or (ColorPos5==ColorPink)) and
((ColorPos1==ColorPink) and (ColorPos2==ColorPink) and ((ColorPos3==ColorPink) or (ColorPos4==ColorPink)) and (ColorPos5==ColorPink)) and [..]
looks like a mess.. can someone help me to clean this up?
tyvm
[Mod action: Moved topic to v1 section. The main section is for v2.]
How to use if 4 colors positions of 5 are equal? Topic is solved
Re: How to use if 4 colors positions of 5 are equal? Topic is solved
Code: Select all
#Requires AutoHotkey v1.1.33
sum := (ColorPos1 = ColorPink)
+ (ColorPos2 = ColorPink)
+ (ColorPos3 = ColorPink)
+ (ColorPos4 = ColorPink)
+ (ColorPos5 = ColorPink)
If (sum > 3)
MsgBox 64, Sum = %sum%, Done!
Else MsgBox 48, Sum = %sum%, Not done!