Cactuscat222 Posted January 11, 2008 Posted January 11, 2008 Hello, I am designing a hot key program for a game, and I want to include a "pause" script, that stops the hot keys from activating. I searched all through the help file, and couldn't find anything, besides the example, which I have used in my script. However, everytime it "pauses", when I clicked one of the hot keys, the function still activates! Any help would be appreciated. Thank you! Global $Paused Traysetstate(1) HotKeySet("1", "InvSlot1") HotKeySet("p", "Pause") HotKeySet("{ESC}", "Terminate") While 1 sleep(10) WEND Func Pause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Hotkeyz is "Paused"',0,0) WEnd ToolTip("") EndFunc Func InvSlot1() Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("classname=TRunnerForm","") If Not WinActive("classname=TRunnerForm","") Then WinActivate("classname=TRunnerForm","") WinWaitActive("classname=TRunnerForm","") MouseClick("left", 545, 63, 1, 0) sleep(20) MouseClick("left", 420, 162, 1, 0) sleep(20) MouseClick("left", 545, 63, 1, 0) sleep(20) EndFunc Also, any way to condense the script, or better place to put the "HotKeySet" (IE in the "While 1") would be loved!
narayanjr Posted January 11, 2008 Posted January 11, 2008 (edited) expandcollapse popupGlobal $Paused Traysetstate(1) HotKeySet("1", "InvSlot1") HotKeySet("p", "Pause") HotKeySet("{ESC}", "Terminate") While 1 sleep(10) WEND Func Pause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Hotkeyz is "Paused"',0,0) HotKeySet("1") WEnd HotKeySet("1", "InvSlot1") ToolTip("") EndFunc Func InvSlot1() Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("classname=TRunnerForm","") If Not WinActive("classname=TRunnerForm","") Then WinActivate("classname=TRunnerForm","") WinWaitActive("classname=TRunnerForm","") MouseClick("left", 545, 63, 1, 0) sleep(20) MouseClick("left", 420, 162, 1, 0) sleep(20) MouseClick("left", 545, 63, 1, 0) sleep(20) EndFunc Func Terminate() Exit EndFunc Edited January 11, 2008 by narayanjr
covaks Posted January 11, 2008 Posted January 11, 2008 (edited) Oops! narayanjr has it working. Edited January 11, 2008 by covaks
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