Skip to content

Commit

Permalink
+ added a debug setting to close the script (ALT+F10) and reload it (…
Browse files Browse the repository at this point in the history
…ALT+F11)

- keys are now only released when suspending the script
  • Loading branch information
GenesisFR committed May 23, 2021
1 parent a429c5f commit 267b82c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
24 changes: 22 additions & 2 deletions KeyToggles.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ IsMouseOverWindow(pHwnd)
return pHwnd == mouseWindowID
}

; Disable toggles on focus lost and optionally restore them on focus
; Hook the window and register hotkeys if necessary, disable toggles on focus lost and optionally restore them on focus
OnFocusChanged()
{
global
Expand Down Expand Up @@ -281,6 +281,7 @@ OnFocusChanged()
else
{
OutputDebug, %A_ThisFunc%::saveToggleStates(%bRestoreAiming%, %bRestoreCrouching%, %bRestoreSprinting%)

bRestoreAiming := bAiming
bRestoreCrouching := bCrouching
bRestoreSprinting := bSprinting
Expand Down Expand Up @@ -323,6 +324,9 @@ ReadConfigFile()
IniRead, crouchAutofireKey, %configFileName%, Keys, crouchAutofireKey, F2
IniRead, sprintAutofireKey, %configFileName%, Keys, sprintAutofireKey, F3

; Debug
IniRead, bDebugMode, %configFileName%, Debug, debugMode, 0

if (sWindowName == "put_window_name_here")
ExitWithErrorMessage("You must specify a window name! The script will now exit.")
}
Expand Down Expand Up @@ -565,19 +569,35 @@ else
return
#IfWinActive

#If bDebugMode
; Exit script
!F10:: ; ALT+F10
Suspend, Permit
ExitApp
return

; Reload script
!F11:: ; ALT+F11
Suspend, Permit
Reload
return
#If

; Suspend script (useful when in menus)
!F12:: ; ALT+F12
Suspend

; Single beep when suspended
if (A_IsSuspended)
{
SoundBeep, 1000
ReleaseAllKeys()
}
; Double beep when resumed
else
{
SoundBeep, 1000
SoundBeep, 1000
}

ReleaseAllKeys()
return
4 changes: 4 additions & 0 deletions KeyToggles.ini
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ sprintKey=LShift
aimAutofireKey=F1
crouchAutofireKey=F2
sprintAutofireKey=F3

[Debug]
; Enable debug functions such as closing (ALT+F10) or reloading (ALT+F11) the script (1 to enable)
debugMode=0

0 comments on commit 267b82c

Please sign in to comment.