diff --git a/lib/HoldRepeat.ahk b/lib/HoldRepeat.ahk index 8e25af6..ff7e776 100644 --- a/lib/HoldRepeat.ahk +++ b/lib/HoldRepeat.ahk @@ -13,11 +13,13 @@ Hold(Primary, Secondary) { HoldLoop(Primary, Secondary) { if GetKeyState(Primary,"P") { SetTimer, , Delete + return } for index,key in Secondary { if GetKeyState(key,"P") { Send {%Primary% up} SetTimer, , Delete + return } } } @@ -55,4 +57,14 @@ HoldOrRepeat(Primary, Secondary) { } else { Hold(Primary,Secondary) } +} + +; Press Target button extremely rapidly while Hold button is held down +Turbo(Target,Hold) { + While GetKeyState(Hold,"P") { + SendInput, {%Target% down} + Sleep 25 + SendInput, {%Target% up} + Sleep 25 + } } \ No newline at end of file diff --git a/lib/Turbo.ahk b/lib/Turbo.ahk deleted file mode 100644 index 91d1308..0000000 --- a/lib/Turbo.ahk +++ /dev/null @@ -1,10 +0,0 @@ -; Press Target button extremely rapidly while Hold button is held down - -Turbo(Target,Hold) { - While GetKeyState(Hold,"P") { - SendInput, {%Target% down} - Sleep 25 - SendInput, {%Target% up} - Sleep 25 - } -} \ No newline at end of file diff --git a/lib/Wrapper.ahk b/lib/Wrapper.ahk index 75a6815..2f09be7 100644 --- a/lib/Wrapper.ahk +++ b/lib/Wrapper.ahk @@ -10,7 +10,7 @@ CheckWinExist(Window) { Run %WrapperPath% SetTitleMatchMode 3 -WinWait %WrapperWindow%,,30 +WinWait %WrapperWindow%,,600 ; Check if window exists once per second WrapperFunc := Func("CheckWinExist").bind(WrapperWindow) diff --git a/src/Deep Rock Galactic.ahk b/src/Deep Rock Galactic.ahk index 2a0329c..2d3ce92 100644 --- a/src/Deep Rock Galactic.ahk +++ b/src/Deep Rock Galactic.ahk @@ -7,6 +7,7 @@ ; Include relevant libraries #Include ../lib/Prelude.ahk +#Include ../lib/HoldRepeat.ahk ; Make this a wrapper script WrapperPath:="steam://rungameid/548430" @@ -45,13 +46,10 @@ RemoveTooltip: ~*F3:: ToggleFullAuto(3) ~*F4:: ToggleFullAuto(4) +; Alt + E holds E +*!e UP::Hold("e",["e","w","a","s","d","Space","LButton","RButton"]) + ; Do full auto when caps lock is on for enabled weapons #If (GetKeyState("CapsLock","T") and FullAutoEnabled[EquipState]) -~*LButton:: -While GetKeyState("LButton","P") { - Send, {LButton down} - Sleep 25 - Send, {LButton up} - Sleep 25 -} -Return \ No newline at end of file +~*LButton::Turbo("LButton","LButton") + diff --git a/src/Valheim.ahk b/src/Valheim.ahk new file mode 100644 index 0000000..4195ae7 --- /dev/null +++ b/src/Valheim.ahk @@ -0,0 +1,30 @@ +; Script can be directly run by or compiled into an .exe by the open-source software AutoHotkey +; https://www.autohotkey.com + +; +; Front Matter +; + +; Include relevant libraries +#Include ../lib/Prelude.ahk +#Include ../lib/HoldRepeat.ahk + +; Make this a wrapper script +WrapperPath := Format("C:\Program Files (x86)\Steam\steam.exe -applaunch 892970 --doorstop-enable true --doorstop-target {1}\r2modmanPlus-local\Valheim\profiles\Medusa\BepInEx\core\BepInEx.Preloader.dll",A_AppData) +WrapperWindow:="Valheim" +#Include ../lib/Wrapper.ahk + +; +; Hotkeys +; + +; Hold E +*#e UP::Hold("e",["LButton", "RButton","q","r"]) + +; Autorun +*#w UP::Hold("w",["s"]) +*#Shift UP::Hold("Shift",["Ctrl"]) + +; Autoclick +*#LButton UP::HoldOrRepeat("LButton",["RButton","MButton"]) +*#RButton UP::HoldOrRepeat("RButton",["LButton","MButton"]) \ No newline at end of file