Jump to content
Sign in to follow this  
Eternalty

Help with a One-Button Hotkey loop

Recommended Posts

Eternalty

So here's the thing, I made this Script for a game to be a simple macro but the only thing wrong with it is I want it just to be one button instead of having to press the "HOME" key to start and the "END" key to stop. I wanted it to be "NUMPADDOT" but can't seem to tweak it the way I want. Any suggestions?

;##################### Options #######################
Opt("SendKeyDownDelay", 0)
Opt("SendKeyDelay", 0)
;##################### Hotkeys #######################
HotkeySet("{HOME}", "_Start")
HotkeySet("{END}", "_Stop")
;##################### Variables #######################
$stop = 0
;##################### Main Loop #######################
While 1
$stop = 0
Sleep(5)
WEnd
;##################### Functions #######################
Func _Start()
Do
Send("d4")
Sleep(200)
Until $stop = 1
EndFunc


Func _Stop()
$stop = 1
EndFunc

Share this post


Link to post
Share on other sites
Authenticity

;##################### Options #######################
Opt("SendKeyDownDelay", 0)
Opt("SendKeyDelay", 0)
;##################### Hotkeys #######################
HotKeySet("{NUMPADDOT}", "_StartUndStop")
HotKeySet("{ESC}", "_Quit")
;##################### Variables #######################
Local $fStart = False
;##################### Main Loop #######################
While 1
    Sleep(20)
WEnd
;##################### Functions #######################
Func _StartUndStop()
    $fStart = Not $fStart
    
    While $fStart
        Send("d4")
        Sleep(200)
    WEnd
EndFunc   ;==>_Start

Func _Quit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites
Eternalty

Thank you it is much appriciated

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  

×