diff --git a/AutoHotkey64.ahk b/AutoHotkey64.ahk index a931ad4..e198a96 100644 --- a/AutoHotkey64.ahk +++ b/AutoHotkey64.ahk @@ -46,6 +46,8 @@ CoordMode("Mouse", "Screen") #Include lib/_JXON.ahk + + ;------------------------------------------------- ; Handle multiple virtual desktops CapsLock & D::SendInput "^#{Right}" @@ -174,3 +176,20 @@ if(A_PriorKey != "LWin") { } ; end of workarounds */ + + +; SC2 Eterrnal Wrath of Eres +; 3 = marine stim +; 4 = tank boost armor +; 1 = moi +CapsLock & m:: { + static toggle := 0 + SetTimer(stim, (toggle := !toggle) ? 400 : 0) +} + +stim() { + Tippy("stim (caps M)", 3000, 5) + ControlSend("{Blind}{Raw}3tt",, "ahk_exe SC2_x64.exe") +; ControlSend("{Blind}{Raw}4b",, "ahk_exe SC2_x64.exe") + ControlSend("{Blind}{Raw}1h",, "ahk_exe SC2_x64.exe") +} diff --git a/lib/ToggleTimerAndShowTooltip.ahk b/lib/ToggleTimerAndShowTooltip.ahk index 3e62b21..8c080f5 100644 --- a/lib/ToggleTimerAndShowTooltip.ahk +++ b/lib/ToggleTimerAndShowTooltip.ahk @@ -1,47 +1,50 @@ -#include lib/Tippy.ahk - -; Function which toggles a timer (using SetTimer) but also shows if it turned the timer on or off with a tooltip. -; -; How to use: -; call a function with: `ToggleTimerAndShowTooltip("functionName", 1000)` -; call a class method with: -; `ToggleTimerAndShowTooltip("ClassName.MethodName", 7000, ClassName.MethodName.Bind(ClassName))` -; eg. `ToggleTimerAndShowTooltip("SC2.aaa", 7000, SC2.aaa.Bind(SC2))` -; where -; SC2 = class -; aaa = method from class -; -; Note: the `functionIdentifier` and `functionReferences` thing is just a hack to be able to toggle class methods: `class.method.Bind(this)` -; -ToggleTimerAndShowTooltip(functionName, interval, functionIdentifier := 0) -{ - static functionNames := {} - static functionReferences := {} - - ; if there's no functionIdentifier, we're in a normal function call, not class method call - if (functionIdentifier = 0) - { - functionIdentifier := functionName - } - - if !(functionReferences[functionName]) - { - functionReferences[functionName] := functionIdentifier - } - - toggle := !functionNames[functionName] - functionNames[functionName] := toggle - - Fn := functionReferences[functionName] - SetTimer, % Fn, % toggle ? interval : "Off" - - if (toggle) - { - Tippy(functionName . " on",, -1) - %Fn%() - } - else - { - Tippy(functionName . " off",, -1) - } -} +#include Tippy.ahk + + +; ❗ not working for AHK 2 + +; Function which toggles a timer (using SetTimer) but also shows if it turned the timer on or off with a tooltip. +; +; How to use: +; call a function with: `ToggleTimerAndShowTooltip("functionName", 1000)` +; call a class method with: +; `ToggleTimerAndShowTooltip("ClassName.MethodName", 7000, ClassName.MethodName.Bind(ClassName))` +; eg. `ToggleTimerAndShowTooltip("SC2.aaa", 7000, SC2.aaa.Bind(SC2))` +; where +; SC2 = class +; aaa = method from class +; +; Note: the `functionIdentifier` and `functionReferences` thing is just a hack to be able to toggle class methods: `class.method.Bind(this)` +; +ToggleTimerAndShowTooltip(functionName, interval, functionIdentifier := 0) +{ + static functionNames := {} + static functionReferences := {} + + ; if there's no functionIdentifier, we're in a normal function call, not class method call + if (functionIdentifier = 0) + { + functionIdentifier := functionName + } + + if !(functionReferences[functionName]) + { + functionReferences[functionName] := functionIdentifier + } + + toggle := !functionNames[functionName] + functionNames[functionName] := toggle + + Fn := functionReferences[functionName] + SetTimer, % Fn, % toggle ? interval : "Off" + + if (toggle) + { + Tippy(functionName . " on",, -1) + %Fn%() + } + else + { + Tippy(functionName . " off",, -1) + } +}