Jump to content

If Not PixelGetColor ( 801 , 49 ) = $color1 Then


Recommended Posts

Your code says: If opposite-of-PixelGetcolor equals $color1 then...

And you want: If PixelGetcolor does NOT equal $color1 then...

There are two ways to do this.

1.

If Not (PixelGetColor ( 801 , 49 ) = $color1) Then
MouseClick("left", 576, 731, 1)
EndIf

2.

If PixelGetColor ( 801 , 49 ) <> $color1 Then
MouseClick("left", 576, 731, 1)
EndIf
Link to comment
Share on other sites

Your code says: If opposite-of-PixelGetcolor equals $color1 then...

And you want: If PixelGetcolor does NOT equal $color1 then...

There are two ways to do this.

1.

If Not (PixelGetColor ( 801 , 49 ) = $color1) Then
MouseClick("left", 576, 731, 1)
EndIf

2.

If PixelGetColor ( 801 , 49 ) <> $color1 Then
MouseClick("left", 576, 731, 1)
EndIf

<{POST_SNAPBACK}>

seems to work i dont see the logic how ever, the NOT and other statements are not the good explained in help file
Link to comment
Share on other sites

I'll show you some equations and their solutions.

NOT 1 equals 0

NOT 0 equals 1

NOT 100 equals 0

NOT NOT 1 equals 1

NOT NOT 100 equals 1

Edit: some more

5 + 5 = 10 equals 1 (true)

NOT (5 + 5 = 10) equals 0 (false)

Let me take your code as an example.

$Matched_color = PixelGetColor ( 801 , 49 )
If Not $Matched_color = $color1 Then
MouseClick("left", 576, 731, 1)
EndIf

$Matched_color could be in this case 100 or 1 or 0.

Like I said:

Your code says: If opposite-of-PixelGetcolor equals $color1 then...

And you want: If PixelGetcolor does NOT equal $color1 then...

AutoIt handles the statement just like the equations above.

The advantage of this way is:

You can do: If FileExists() Then ...

and: If NOT FileExists() Then ...

When the function is successful, it returns true (number 1).

Else it would return false (number 0).

Edited by SlimShady
Link to comment
Share on other sites

Excellent post, Slim :lmao:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
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...