no_messiah 0 Posted February 20, 2005 If Not PixelGetColor ( 801 , 49 ) = $color1 Then MouseClick("left", 576, 731, 1) EndIf i having problems getting this to work what am i doing wrong? in case its not clear what i want, i wont it to left click if the color at the given pixel does not match the varible Share this post Link to post Share on other sites
SlimShady 1 Posted February 20, 2005 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 Share this post Link to post Share on other sites
no_messiah 0 Posted February 20, 2005 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) EndIf2.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 Share this post Link to post Share on other sites
SlimShady 1 Posted February 20, 2005 (edited) I'll show you some equations and their solutions.NOT 1 equals 0NOT 0 equals 1NOT 100 equals 0NOT NOT 1 equals 1NOT NOT 100 equals 1Edit: some more5 + 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 February 20, 2005 by SlimShady Share this post Link to post Share on other sites
Insolence 2 Posted February 21, 2005 Excellent post, Slim "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. Share this post Link to post Share on other sites
Blue_Drache 260 Posted February 21, 2005 Excellent post, Slim <{POST_SNAPBACK}>NOT. :) Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Share this post Link to post Share on other sites