homie Posted August 16, 2009 Share Posted August 16, 2009 (edited) ok so I am new to autoit, but I have done basic programing before. I have my script working fine, and I start it from a hotkey... Global $Paused HotKeySet("{ESC}", "start") While 1 Sleep(100) WEnd Func start() $Paused = NOT $Paused While $Paused sleep(100) $pixel1 = PixelGetColor (602, 290 ) If $pixel1 <> 16777215 Then MouseClick ("left", 602, 290 ) $pixel2 = PixelGetColor (604, 290 ) If $pixel2 <> 14333068 Then MouseClick ("left", 604, 290 ) $pixel3 = PixelGetColor (606, 290 ) If $pixel3 <> 9211020 Then MouseClick ("left", 606, 290 ) $pixel4 = PixelGetColor (608, 290 ) If $pixel4 <> 9211020 Then MouseClick ("left", 608, 290 ) $pixel5 = PixelGetColor (610, 290 ) If $pixel5 <> 9211020 Then MouseClick ("left", 610, 290 ) $pixel6 = PixelGetColor (612, 290 ) If $pixel6 <> 9211020 Then MouseClick ("left", 612, 290 ) $pixel7 = PixelGetColor (614, 290 ) If $pixel7 <> 9211020 Then MouseClick ("left", 614, 290 ) $pixel8 = PixelGetColor (616, 290 ) If $pixel8 <> 9216200 Then MouseClick ("left", 616, 290 ) $pixel9 = PixelGetColor (618, 290 ) If $pixel9 <> 10521740 Then MouseClick ("left", 618, 290 ) $pixel10 = PixelGetColor (620, 290 ) If $pixel10 <> 9211020 Then MouseClick ("left", 620, 290 ) $killed = PixelGetColor( 470 , 278 ) if $killed = 8092539 then Exit there is a bit of the code... basically what I want it to do is $killed = PixelGetColor( 470 , 278 ) if $killed = 8092539 then Exit I want it to go back to being paused, and at the top of the script ready to go when I hit the hotkey again.... any suggestions? thanks Edited August 16, 2009 by homie Link to comment Share on other sites More sharing options...
Genos Posted August 16, 2009 Share Posted August 16, 2009 try using "Return" instead of "Exit" Exit will close the program, return will exit the function, normally with a value Link to comment Share on other sites More sharing options...
homie Posted August 17, 2009 Author Share Posted August 17, 2009 (edited) ok I changed the exit to return... and when my script returns, it goes here: expandcollapse popupGlobal $Paused HotKeySet("{ESC}", "start") While 1 ; <<<<<<------------------------------THIS IS WHERE IT RETURNS TOO----------------------------------- Sleep(100) WEnd Func start() $Paused = NOT $Paused While $Paused sleep(100) $pixel1 = PixelGetColor (602, 290 ) If $pixel1 <> 16777215 Then MouseClick ("left", 602, 290 ) $pixel2 = PixelGetColor (604, 290 ) If $pixel2 <> 14333068 Then MouseClick ("left", 604, 290 ) $pixel3 = PixelGetColor (606, 290 ) If $pixel3 <> 9211020 Then MouseClick ("left", 606, 290 ) $pixel4 = PixelGetColor (608, 290 ) If $pixel4 <> 9211020 Then MouseClick ("left", 608, 290 ) $pixel5 = PixelGetColor (610, 290 ) If $pixel5 <> 9211020 Then MouseClick ("left", 610, 290 ) $pixel6 = PixelGetColor (612, 290 ) If $pixel6 <> 9211020 Then MouseClick ("left", 612, 290 ) $pixel7 = PixelGetColor (614, 290 ) If $pixel7 <> 9211020 Then MouseClick ("left", 614, 290 ) $pixel8 = PixelGetColor (616, 290 ) If $pixel8 <> 9216200 Then MouseClick ("left", 616, 290 ) $pixel9 = PixelGetColor (618, 290 ) If $pixel9 <> 10521740 Then MouseClick ("left", 618, 290 ) $pixel10 = PixelGetColor (620, 290 ) If $pixel10 <> 9211020 Then MouseClick ("left", 620, 290 ) $killed = PixelGetColor( 470 , 278 ) if $killed = 8092539 then return how would I go about making it wait for the hotkey again? thanks edit ==== I figured it out, it is returning to the hotkey, i will prob run into more problems lol but atleast im learning. Edited August 17, 2009 by homie Link to comment Share on other sites More sharing options...
Genos Posted August 17, 2009 Share Posted August 17, 2009 You should be able to get rid of $Paused = NOT $Paused While $Paused sleep(100) That should solve your problem. 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