Skip to content

Commit

Permalink
Move all StarCraft 2 stuff to its own script
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBestPessimist committed Apr 12, 2019
1 parent 3c3e607 commit 06921ff
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 132 deletions.
2 changes: 1 addition & 1 deletion AutoHotkeyU64.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Menu, Tray, Icon, resources/blueStar.ico
#include CapsLockToggle.ahk
#include GenericHotstrings.ahk
#include SoundBalance.ahk

#include StarCraft2.ahk



Expand Down
137 changes: 137 additions & 0 deletions StarCraft2.ahk
Original file line number Diff line number Diff line change
@@ -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
}


}
6 changes: 0 additions & 6 deletions appHandling_autoExecute.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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
125 changes: 0 additions & 125 deletions app_handling.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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


; ------------------------------------------------
; ------------------------------------------------
Expand Down

0 comments on commit 06921ff

Please sign in to comment.