Jump to content
Sign in to follow this  
Cactuscat222

Pausing Functions/hotkeys

Recommended Posts

Cactuscat222

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!

Share this post


Link to post
Share on other sites
narayanjr

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)
        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 by narayanjr

Share this post


Link to post
Share on other sites
Cactuscat222

Thank you!

Share this post


Link to post
Share on other sites
covaks

Oops! narayanjr has it working.

Edited by covaks

Share this post


Link to post
Share on other sites
narayanjr

mine already does that

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×