Sardith Posted June 10, 2006 Share Posted June 10, 2006 expandcollapse popup;Global Commands Global $Paused = 0 ;Hotkeys HotKeySet("{F2}", "form") HotKeySet("{F3}", "Stop") HotKeySet("{F4}", "Terminate") ;Run Method While 1 If $Paused = 1 Then Exist() sleep(100) EndIf ToolTip("") WEnd ;Main Program Funcations Func Exist() If WinActive("Counter-Strike") Then Box1() Else ToolTip("Counter-Strike not active.", 0, 0) Sleep(2000) ToolTip("", 0, 0) EndIf EndFunc Func Box1() Send("2") $search = PixelGetColor(542, 730) If $search = "11468800" Then sleep(100) Box2() Else Box1() EndIf EndFunc Func Box2() Send("2") $search = PixelGetColor(562, 730) If $search = "11468800" Then Send("2") sleep(100) Box3() Else Box2() EndIf EndFunc Func Box3() Send("2") $search = PixelGetColor(581, 730) If $search = "11468800" Then Send("2") sleep(100) Box4() Else Box3() EndIf EndFunc Func Box4() Send("2") $search = PixelGetColor(602, 730) If $search = "11468800" Then Send("2") sleep(100) Finisher() Else Box4() EndIf EndFunc Func Finisher() $search = PixelGetColor(622, 730) If $search <> "11468800" Then Sleep(100) Send("2") Else Send("4") Finisher() EndIf EndFunc ;Exit Hotkey loop Func Stop() Sleep(1000) $Paused = 0 Sleep(1000) EndFunc ;Activates form Macro Func form() If $Paused = 0 Then $Paused = 1 Else $Paused = 0 EndIf EndFunc ;Hotkey exit Func Terminate() Exit 0 EndFunc I can't get this script to pause with another hotkey, or the same hot that I used. My Guess is, that the loop for finisher keeps going. This is the only real method that seemed to work for me. Searching for the different boxes. If anyone could help me with a better way of attempting the 5 box searchs, or pausing this current configuration, that would be great. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Nomad Posted June 10, 2006 Share Posted June 10, 2006 Well, this code: ;Exit Hotkey loop Func Stop() Sleep(1000) $Paused = 0 Sleep(1000) EndFunc isn't going to stop the script, it will only pause it for 2 seconds. Nomad Link to comment Share on other sites More sharing options...
Sardith Posted June 10, 2006 Author Share Posted June 10, 2006 Try looking at that, when $Paused = 1 it runs, if $Paused = 0 then it shouldn't run the funcations. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Nomad Posted June 10, 2006 Share Posted June 10, 2006 (edited) Try looking at that, when $Paused = 1 it runs, if $Paused = 0 then it shouldn't run the funcations. Since you are using recursive functions, calling functions from within a function, it will not stop running unless it returns to Exist() and returns. The $Pause will only stop it from entering the Exist() function, it will not interrupt the script once the script has started.Understand?Edit: Also, from the way it looks it is possible for this script to loop into infinity, meaning it may never return to the beginning. Edited June 10, 2006 by Nomad Link to comment Share on other sites More sharing options...
Sardith Posted June 10, 2006 Author Share Posted June 10, 2006 Yep, I understand. Thank you. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted June 10, 2006 Share Posted June 10, 2006 expandcollapse popupGlobal $Paused = 0 Global $pause ;Hotkeys HotKeySet("{F2}", "form") HotKeySet("{F3}", "Stop") HotKeySet("{F4}", "Terminate") ;Run Method While 1 If $Paused = 1 Then Exist() sleep(100) EndIf ToolTip("") WEnd ;Main Program Funcations Func Exist() If WinActive("Counter-Strike") Then Box1() Else ToolTip("Counter-Strike not active.", 0, 0) Sleep(2000) ToolTip("", 0, 0) EndIf EndFunc Func Box1() Send("2") $search = PixelGetColor(542, 730) If $search = "11468800" Then sleep(100) Box2() Else Box1() EndIf EndFunc Func Box2() Send("2") $search = PixelGetColor(562, 730) If $search = "11468800" Then Send("2") sleep(100) Box3() Else Box2() EndIf EndFunc Func Box3() Send("2") $search = PixelGetColor(581, 730) If $search = "11468800" Then Send("2") sleep(100) Box4() Else Box3() EndIf EndFunc Func Box4() Send("2") $search = PixelGetColor(602, 730) If $search = "11468800" Then Send("2") sleep(100) Finisher() Else Box4() EndIf EndFunc Func Finisher() $search = PixelGetColor(622, 730) If $search <> "11468800" Then Sleep(100) Send("2") Else Send("4") Finisher() EndIf EndFunc ;Exit Hotkey loop Func Stop() $pause = Not $pause While $pause Msgbox(0,"Pause","Pause") SleeP(300) WEnd EndFunc Func form() If $Paused = 0 Then $Paused = 1 Else $Paused = 0 EndIf EndFunc ;Hotkey exit Func Terminate() Exit 0 EndFunc 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