Jump to content

HotKeySet multiple Functions Calls


Recommended Posts

Hey everybody,

this is my HotKeySet Code: 

HotKeySet("{NUMPAD0}", "_theFunctionToCall")

And this is my function:

Func _theFunctionToCall()

    While 1
        $rd_time += 1

        ConsoleWrite("testing code")

        If $rd_time > 200 Then
            ExitLoop
            
            
        EndIf
    WEnd
EndFunc   ;==>_theFunctionToCall

Obviously my code is different. In my original code: in the while loop a label is changed in a gui (a kind of randomizer) ..


The problem is that the script ends after about 200 milliseconds. if I call the function normal, everything is fine, but if I call the function via the hotkey, I can start it again if I just press the hotkey again.

 

Is there any easy method to bypass this? So that you can't call the function again (via hotkey) while the function is already running? Maybe like a HotKeyReset?

Link to comment
Share on other sites

Fixed it by myself.

HotKeySet("{NUMPAD0}", "_theFunctionToCall")


Func _theFunctionToCall()
                        HotKeySet("{NUMPAD0}") ;reset hotkey
    While 1
        $rd_time += 1

        ConsoleWrite("testing code")

        If $rd_time > 200 Then
                        HotKeySet("{NUMPAD0}", "_theFunctionToCall") ;set hotkey again before exit
            ExitLoop
            
            
        EndIf
    WEnd
EndFunc   ;==>_theFunctionToCall

 

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...