From 06921ffec960c97d15cf56fd25b403610be31912 Mon Sep 17 00:00:00 2001 From: TheBestPessimist Date: Fri, 12 Apr 2019 23:36:46 +0300 Subject: [PATCH] Move all StarCraft 2 stuff to its own script --- AutoHotkeyU64.ahk | 2 +- StarCraft2.ahk | 137 ++++++++++++++++++++++++++++++++++++ appHandling_autoExecute.ahk | 6 -- app_handling.ahk | 125 -------------------------------- 4 files changed, 138 insertions(+), 132 deletions(-) create mode 100644 StarCraft2.ahk diff --git a/AutoHotkeyU64.ahk b/AutoHotkeyU64.ahk index 9608b68..57d8d20 100644 --- a/AutoHotkeyU64.ahk +++ b/AutoHotkeyU64.ahk @@ -39,7 +39,7 @@ Menu, Tray, Icon, resources/blueStar.ico #include CapsLockToggle.ahk #include GenericHotstrings.ahk #include SoundBalance.ahk - +#include StarCraft2.ahk diff --git a/StarCraft2.ahk b/StarCraft2.ahk new file mode 100644 index 0000000..ce39b96 --- /dev/null +++ b/StarCraft2.ahk @@ -0,0 +1,137 @@ +; #include Tippy.ahk +#include lib/ToggleTimerAndShowTooltip.ahk +#include Tippy.ahk + + +CapsLock & LButton::SC2.ClickAndSaveMousePosition() + +; Dragoons are always on group 8 +CapsLock & Numpad8::SC2.ToggleDragoonQ() + +; Spectre is always in group 2 +CapsLock & Numpad2::SC2.ToggleSpectrePlay() + +; Centurion is always in group 4 +CapsLock & Numpad4::SC2.ToggleCenturionPlay() + +CapsLock & Numpad1::SC2.ToggleAutoupgrade() + + + +; This contains all the stuff and timers and macros for SC2 (mostly Fallen World map) +class SC2 +{ + ahk_SC2 := "ahk_exe SC2_x64.exe" + + xPos := 0 + yPos := 0 + + dragoonQMillis := 2000 + spectrePlayMillis := 1053 + centurionPlayMillis := 1017 + autoupgradeMillis := 15003 + + + ; Save mouse position to use in SC2 + ClickAndSaveMousePosition() + { + MouseGetPos, xPos, yPos + Tippy("Mouse position is: x:" xPos " y:" yPos) + Click 123 + } + + ; Dragoon is always in group 8 + ToggleDragoonQ() + { + ToggleTimerAndShowTooltip("SC2.DragoonQ", dragoonQMillis, SC2.DragoonQ.Bind(SC2)) + } + + ; Spectre is always in group 2 + ToggleSpectrePlay() + { + ToggleTimerAndShowTooltip("SC2.SpectrePlay", spectrePlayMillis, SC2.SpectrePlay.Bind(SC2)) + } + + ; Centurion is always in group 4 + ToggleCenturionPlay() + { + ToggleTimerAndShowTooltip("SC2.CenturionPlay", centurionPlayMillis, SC2.CenturionPlay.Bind(SC2)) + } + + + ToggleAutoupgrade() + { + ToggleTimerAndShowTooltip("SC2.Autoupgrade", autoupgradeMillis, SC2.Autoupgrade.Bind(SC2)) + } + + + ; Dragoons is always in group 8 + DragoonQ() + { + Critical + + SetKeyDelay, 60, 5 + SetControlDelay 0 + + if (WinActive(ahk_SC2)) { + Tippy("DragoonQ") + } + + ; use the saved position + x := xPos + y := yPos + + ; ControlClick, must have the coordinates as "x100 y100", not just "100 100" + x := "x" . x + y := "y" . y + + ControlSend,, 8q, % ahk_SC2 + ControlClick,, % ahk_SC2,, LEFT, 1, % "NA" x y + ControlSend,, h, % ahk_SC2 + } + + ; Spectre is always in group 2 + SpectrePlay() + { + Critical + + SetKeyDelay, 60, 5 + + if (WinActive(ahk_SC2)) { + Tippy("SpectrePlay") + } + + ; need "eee" because somehow it takes more time to switch from q to w guns + ControlSend,, 2weeqh, % ahk_SC2 + } + + + ; Centurion is always in group 4 + CenturionPlay() + { + Critical + + SetKeyDelay, 60, 5 + + if (WinActive(ahk_SC2)) { + Tippy("CenturionPlay") + } + + ControlSend,, 4whhh, % ahk_SC2 + } + + Autoupgrade() + { + Critical + + SetKeyDelay, 60, 5 + + if (WinActive(ahk_SC2)) { + Tippy("Autoupgrade") + } + + ControlSend,, 1uqwertsdfgzxc1hh, % ahk_SC2 + } + + +} diff --git a/appHandling_autoExecute.ahk b/appHandling_autoExecute.ahk index bd448bc..3b7b647 100644 --- a/appHandling_autoExecute.ahk +++ b/appHandling_autoExecute.ahk @@ -11,18 +11,12 @@ global ahk_goland := "ahk_exe goland64.exe" global ahk_teamviewer_sponsoredsession := "Sponsored session ahk_exe TeamViewer.exe" global ahk_teamviewer := "TeamViewer ahk_exe TeamViewer.exe" global ahk_CorsairCUE := "ahk_class CUEBorderlessWindow ahk_exe iCUE.exe" -global ahk_SC2 := "ahk_exe SC2_x64.exe" global ahk_Skype := "ahk_exe Skype.exe" SetTimer, hideTeamviewerSponsoredsession, 5000 - ; SetTimer, SC2SpectrePlay, % (spectreTimer := !spectreTimer) ? 1000 : "Off" - ; SetTimer, SC2PressT, % (pressT := !pressT) ? 15000 : "Off" - ; SetTimer, SC2TemplarPlay, % (TemplarPlay := !TemplarPlay) ? 2107 : "Off" - - ; 2018.09.07: no need for this as sublime text is licensed now! ; SetTimer, hideSublimeRegister, 1000 diff --git a/app_handling.ahk b/app_handling.ahk index d9718fe..88c1c6c 100644 --- a/app_handling.ahk +++ b/app_handling.ahk @@ -222,131 +222,6 @@ F4:: SendInput !{F4} #If -; autostim -CapsLock & Numpad9:: -SC2PressTTimer() -{ - static pressT - SetTimer, SC2PressT, % (pressT := !pressT) ? 15000 : "Off" - if (pressT) - { - Tippy("t on") - } - else - { - Tippy("t off") - } -} - -SC2PressT() -{ - Critical - - SetKeyDelay, 60, 5 - - if (WinActive(ahk_SC2)) { - Tippy("t") - } - - ; ControlSend,, 3t1{BackSpace 3}, % ahk_SC2 - - ; autoupgrade spectre - ControlSend,, 1uqwertsdfgzxc1hh, % ahk_SC2 - -} - - -CapsLock & Numpad8::SetTimer, SC2TemplarPlay, % (TemplarPlay := !TemplarPlay) ? 2107 : "Off" - -; camera lock MUST be on! -; this is used when playing the templar and -; we are all staying on the right of the map and -; we are at the bottom of the "way" (eg where lategame position is) -SC2TemplarPlay() -{ - Critical - - SetKeyDelay 105 - SetMouseDelay 105 - - if (WinActive(ahk_SC2)) { - Tippy("qq") - - ; save mouse pos to move it back here - MouseGetPos, x, y - - Send 7 - Sleep 100 - Send q - Sleep 100 - Click - ; Click, 1231, 300 - Sleep 100 - Send h - - ;Sleep 100 - ;Send w - ;Sleep 100 - ;Click ; , 1200, 179 - ; Send h - - ; Sleep 100 - ; Send 8 - ; Sleep 100 - ; Send q - ; Sleep 100 - ; Click - ; ; Click, 1231, 300 - ; Sleep 100 - ; Send h - - ; move mouse at the initial position - MouseMove, x, y - } -} - - - - - -; Spectre -CapsLock & Numpad7:: -SC2SpectreTimer() -{ - static spectreTimer - SetTimer, SC2SpectrePlay, % (spectreTimer := !spectreTimer) ? 1053 : "Off" - if (spectreTimer) - { - SC2SpectrePlay() - Tippy("spectre on") - } - else - { - Tippy("spectre off") - } -} - -SC2SpectrePlay() -{ - Critical - - SetKeyDelay, 60, 5 - - if (WinActive(ahk_SC2)) { - Tippy("spectre") - } - - ; need "eee" because somehow it takes more time to switch from q to w guns - ControlSend,, 2weeqh{BackSpace 6}, % ahk_SC2 - - ; i'm lazy to make a new macro, so this one is for centurion: w and h - ; ControlSend,, 6whhh{BackSpace 5}, % ahk_SC2 - -} - -; SC2 multipel clicks -CapsLock & Lbutton::Click 123 - ; ------------------------------------------------ ; ------------------------------------------------