Jump to content

"or" expression throwing things off?


Recommended Posts

Hello! I am wondering what is wrong with the following function.

Func _Find() ;Searches for the occurance of colors and clicks when found
    $Coord1 = PixelSearch(515, 500, 515, 500, 0x52C550, 30);
    $Coord2 = PixelSearch(515, 500, 515, 500, 0x7DD56B, 30);
    $Coord3 = PixelSearch(515, 500, 515, 500, 0x3CBB0F, 30);
    $Coord4 = PixelSearch(515, 500, 515, 500, 0x6CDB96, 30);
    If $TriggerA = 'false' and $TriggerB = 'false' and $TriggerC = 'false' and $Status = 'ON' and $AIM = 'false' and IsArray($Coord1) or IsArray($Coord2) or IsArray($Coord3), or IsArray($Coord4) Then
    Sleep(100)
    MouseClick("Left")
    Else
    EndIf
EndFunc

The function worked perfectly when it was just one PixelSearch command like so:

If $TriggerA = 'false' and $TriggerB = 'false' and $TriggerC = 'false' and $Status = 'ON' and $AIM = 'false' and IsArray($Coord1) Then

However when I added the other three PixelSearches things stopped working.

It seems to become completely non-responsive to the colors(including the original one).

My guess is it has to do with the "or" expressions throwing the conditions off.

I would still like all of the AND entries to apply:

If $TriggerA = 'false' and $TriggerB = 'false' and $TriggerC = 'false' and $Status = 'ON' and $AIM = 'false'

But instead of just looking for one color, to monitor the presence of three additional colors(with shade variation) at the same coordinate.

Thank you for your time!

Edited by Vicate
Link to comment
Share on other sites

Try

If ($TriggerA = 'false' and $TriggerB = 'false' and $TriggerC = 'false' and $Status = 'ON' and $AIM = 'false') and (IsArray($Coord1) or IsArray($Coord2) or IsArray($Coord3), or IsArray($Coord4)) Then

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...