stagius24 Posted May 1, 2009 Share Posted May 1, 2009 Func Start() while 1 $var = PixelGetColor( 877 , 167 ) $var1 = PixelGetColor( 829 , 136 ) while $var <> $var1 MsgBox(0,"different", $var) Msgbox(0,"different", $var1) Sleep(5000) WEnd Msgbox(0,"same", $var) Msgbox(0,"same", $var1) sleep(500) wend EndFunc I m in the process of learning, so please pardon my ignorant. I m trying to write a script that can tell the different of pixel over and over again. The problem with this script is they tend to recognize the two pixels only ONE. After that, the pixelgetcolor function did not update the new pixel color again even though I present a different pixel. THe question is how I gonna write this script so that the $var = pixelcolor get updated everytime, over and over again. Thank you Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 1, 2009 Moderators Share Posted May 1, 2009 (edited) Func Start() Local $var, $var1 While 1 $var = PixelGetColor( 877 , 167 ) $var1 = PixelGetColor( 829 , 136 ) While $var <> $var1 ; Do something here Sleep(5000) ; If we never check while we are in this loop ; Then $var and $var1 values never change, so we'll be stuck here $var = PixelGetColor( 877 , 167 ) $var1 = PixelGetColor( 829 , 136 ) WEnd ; Do something here? Sleep(500) Wend EndFunc But really, it looks like you just need a conditional statement:Func Start() Local $var, $var1 While 1 $var = PixelGetColor( 877 , 167 ) $var1 = PixelGetColor( 829 , 136 ) If $var <> $var1 Then ; Do something here Sleep(5000) Else ; Do something that you would do if they were equal Sleep(500) EndIf Wend EndFunc Edited May 1, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
stagius24 Posted May 1, 2009 Author Share Posted May 1, 2009 What is the use of local in your script? I press F1, and it sound complicated to me. Can you explain why you declare $var, var1 as a variable, constant? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 1, 2009 Moderators Share Posted May 1, 2009 What is the use of local in your script? I press F1, and it sound complicated to me. Can you explain why you declare $var, var1 as a variable, constant?http://www.autoitscript.com/forum/index.php?showtopic=24062 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now