Jump to content

Pausing Functions/hotkeys


Recommended Posts

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!

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...