Skip to content

Instantly share code, notes, and snippets.

@ribbanya
Created August 25, 2020 02:37
Show Gist options
  • Save ribbanya/c7d68936eb6fe147ce5ee086832e748a to your computer and use it in GitHub Desktop.
Save ribbanya/c7d68936eb6fe147ce5ee086832e748a to your computer and use it in GitHub Desktop.
SendMode Input
SetWorkingDir, %A_ScriptDir%
#SingleInstance, Force
#IfWinActive, ahk_exe osu!.exe
Thread, interrupt, 0 ; ensure no delay on keypresses
global prev := 0, zDown := false, xDown := false
CheckAlternate(cur)
{
if (prev = cur)
{
SoundPlay, combobreak.wav ; You can just replace to .wav itself or change it here
}
prev := cur
}
SetTimeout:
SetTimer, Timeout, -5000 ; Five-second timeout, can change to whatever. Make sure it stays negative.
return
; Change these to whatever keys you use
~W::
Gosub, SetTimeout
if (zDown)
{
return
}
CheckAlternate(-1)
zDown := true
return
~W Up::zDown := false
~D::
Gosub, SetTimeout
if (xDown)
{
return
}
CheckAlternate(1)
xDown := true
return
~D Up::xDown := false
; These keys reset the alternation. You can change or just remove them if you want.
~Escape::
~LShift::
prev := 0
return
Timeout:
prev := 0
SetTimer, Timeout, Off
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment