xyzabc Posted September 4, 2008 Share Posted September 4, 2008 I tried to do a Programm which repeats searching for an colour and if it finds that colour press a button. And then search again until it finds it again and press a second button, and then a third after searching again. And thats the code i tried to do $pixel = PixelSearch(661,409,1035,444,0xFF1E1E,100,50) If $pixel <> 1 Then send(1) sleep(500) I know that this isnt that hard to do but i dont know how to do this. If anyone knows how to do this please give me a help or say where i can find it. Link to comment Share on other sites More sharing options...
Szhlopp Posted September 4, 2008 Share Posted September 4, 2008 I tried to do a Programm which repeats searching for an colour and if it finds that colour press a button. And then search again until it finds it again and press a second button, and then a third after searching again. And thats the code i tried to do $pixel = PixelSearch(661,409,1035,444,0xFF1E1E,100,50) If $pixel <> 1 Then send(1) sleep(500) I know that this isnt that hard to do but i dont know how to do this. If anyone knows how to do this please give me a help or say where i can find it. Here ya go: While 1 Sleep(20) $pixel = PixelSearch(661,409,1035,444,0xFF1E1E,100,50) If @error <> 1 Then send(1) sleep(500) EndIf WEnd 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...
xyzabc Posted September 4, 2008 Author Share Posted September 4, 2008 (edited) First thing i want to say thanks and the second one is Can i do it for more then 1 button this way? While 1 Sleep(20) $pixel = PixelSearch(661,409,1035,444,0xFF1E1E,100,50) If @error <> 1 Then send(1) sleep(500) EndIf WEnd While 1 Sleep(20) $pixel = PixelSearch(661,409,1035,444,0xFF1E1E,100,50) If @error <> 1 Then send(2) sleep(500) EndIf WEnd While 1 Sleep(20) $pixel = PixelSearch(661,409,1035,444,0xFF1E1E,100,50) If @error <> 1 Then send(3) sleep(500) EndIf WEnd and third what is @error? Edited September 4, 2008 by xyzabc Link to comment Share on other sites More sharing options...
Szhlopp Posted September 4, 2008 Share Posted September 4, 2008 (edited) Nope that doesn't work. While 1 Wend Means that it's going to stay in that chunk of code until you tell it to exit. I would do it this way: $Button = 0 While 1 Sleep(20) $pixel = PixelSearch(661,409,1035,444,0xFF1E1E,100,50) If @error <> 1 Then If $Button = 0 Send(1) Sleep(500) $Button = 1 ElseIf $Button =1 Send(10) Sleep(500) $Button = 2 ElseIf $Button =2 Send(5) Sleep(500) $Button = 0 EndIf EndIf WEnd That stays in the loop. And everytime a button is found it increases $Button by 1. @Error is returned by some functions (Like pixelSearch). Help file says: Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y) Failure: Sets @error to 1 if color is not found. Edited September 4, 2008 by Szhlopp 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...
xyzabc Posted September 4, 2008 Author Share Posted September 4, 2008 (edited) Hmm ok thanks but doesnt mean this u press button x if colour is not found an easy yes or no is enoughand a great THANKSAnd our script gives an Error >Running AU3Check (1.54.13.0) from:C:\Programme\AutoIt3C:\Dokumente und Einstellungen\Julian\Desktop\Versuch3.au3(10,23) : ERROR: multi-line 'If' missing 'Then'. If $Button = 0~~~~~~~~~~~~~~~~~~~~~~^C:\Dokumente und Einstellungen\Julian\Desktop\Versuch3.au3(14,26) : ERROR: syntax error ElseIf $Button =1~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Dokumente und Einstellungen\Julian\Desktop\Versuch3.au3 - 2 error(s), 0 warning(s) Edited September 4, 2008 by xyzabc Link to comment Share on other sites More sharing options...
xyzabc Posted September 4, 2008 Author Share Posted September 4, 2008 Ok found error... 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