gainstaa Posted March 17, 2009 Share Posted March 17, 2009 HotKeySet("h", "SetColor") While(1) WinActive("Paint") WEnd Func SetColor() $var = PixelGetColor( 640 , 400 ) $var2 = PixelGetColor( 640 , 400 ) While (1) $var2 = PixelGetColor( 640 , 400 ) If $var2 NOT = $var Then MsgBox(0,"The old color was", Hex($var, 6)) MsgBox(0,"The new color is", Hex($var2, 6)) ExitLoop EndIf WEnd EndFunc Sleep(20000000) Basically right now when I set the color (by pressing H), it sets $var to the color in the middle of my screen. Then when the pixel color in the middle of the screen changes it should display the messages, and wait for a new color to be set. It does this just fine with black and white, but if I use like red and yellow the display messages do not appear. Anyone know why? Thanks. Link to comment Share on other sites More sharing options...
Szhlopp Posted March 17, 2009 Share Posted March 17, 2009 This what you're trying to do? Global $var Global $Coords[2] = [640, 400] HotKeySet("h", "SetColor") While 1 Sleep(20) If PixelGetColor($Coords[0] , $Coords[1]) <> $var And $var <> 0 Then Sleep(500) MsgBox(0, "", "Changed") EndIf WEnd Func SetColor() $var = PixelGetColor($Coords[0] , $Coords[1]) EndFunc RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
gainstaa Posted March 17, 2009 Author Share Posted March 17, 2009 Global $var Global $Coords[2] = [640, 400] HotKeySet("h", "SetColor") Func SetColor() $var = PixelGetColor($Coords[0] , $Coords[1]) While 1 Sleep(20) If PixelGetColor($Coords[0] , $Coords[1]) <> $var Then Sleep(100) MsgBox(0, "", "Changed") ExitLoop EndIf WEnd EndFunc Sleep(2000000000) I basically just moved the loop into the function, and it works just like I wanted it to. Thanks! 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