WIP interceptor combat audio cues for shield down and imminent enrage

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* WIP interceptor combat audio cues for shield down and imminent enrage
Currently binds to t key. Also F23 for exiting script and F24 for reloading script.
Usage:
Taps are done within 200ms of each other and a hold is the key down > 200ms.
Before the fight starts:
hold: set for Cyclops (audio: exclamation and 1 warning sound)
tap-hold: set for Basilisk (audio: exclamation and 2 warning sounds)
tap-tap-hold: set for Medusa (audio: exclamation and 3 warning sounds)
tap-tap-tap-hold: set for Hydra (audio: exclamation and 4 warning sounds)
When you start the fight or destroy a heart:
tap: starts/restarts timers (audio: exclamation)
After the fight, maybe:
tap-tap-tap-tap-hold: clear settings and stop timers (audio: logon sound)
*/
#NoEnv
#Persistent
#Warn ; Enable warnings to assist with detecting common errors.
SetWorkingDir %A_ScriptDir%
#IfWinActive Elite - Dangerous (CLIENT)
#SingleInstance force
SetKeyDelay 50, 50 ; Elite doesn't like rapid keys, so an overall delay is added
; from https://github.com/evilC/TapHoldManager
#Include %A_ScriptDir%\lib\TapHoldManager.ahk
thargoidTHM := new TapHoldManager(200, -1, "$")
thargoidTHM.Add("t", Func("thargoidCallback"))
thargoidShieldTime := 0
thargoidEnrageTime := 0
thargoidSet := 0
thargoidWarningPlay(x:=1) {
loop %x% {
SoundPlay, C:\Windows\media\Windows Battery Low.wav, 1
}
}
thargoidConfirm1Play(x:=1) {
loop %x% {
SoundPlay, C:\Windows\media\Windows Exclamation.wav, 1
}
}
thargoidConfirm2Play(x:=1) {
loop %x% {
SoundPlay, C:\Windows\media\Windows Logon.wav, 1
}
}
ShieldDownTick() {
thargoidWarningPlay(1)
}
EnrageImminentTick() {
thargoidWarningPlay(3)
}
thargoidSetInterceptorInfo(shieldTime, enrageTime, state, warningCount) {
global thargoidShieldTime, thargoidEnrageTime, thargoidSet
thargoidShieldTime := shieldTime
thargoidEnrageTime := enrageTime
thargoidSet := state
if (state) {
thargoidConfirm1Play(1)
thargoidWarningPlay(warningCount)
}
}
thargoidCallback(isHold, taps, state) {
global thargoidShieldTime, thargoidEnrageTime, thargoidSet
/*
thargoid timers: cyclops, basilisk, medusa, hydra
shield times: 1:45, 3:00, 4:00, 5:20
enrage: 6:00, 7:00, 7:00, 8:00
*/
if (isHold) {
if (state == 1) { ; config
if (taps == 1) { ; cyclops
thargoidSetInterceptorInfo(-105000 /*1:45*/, -330000 /*5:30*/, 1, 1)
} else if (taps == 2) { ; basilisk
thargoidSetInterceptorInfo(-180000 /*3:00*/, -390000 /*6:30*/, 1, 2)
} else if (taps == 3) { ; medusa
thargoidSetInterceptorInfo(-240000 /*4:00*/, -390000 /*6:30*/, 1, 3)
} else if (taps == 4) { ; hydra
thargoidSetInterceptorInfo(-320000 /*5:20*/, -450000 /*7:30*/, 1, 4)
} else if (taps == 5) { ; cancel
thargoidSetInterceptorInfo(0, 0, 0, 0)
SetTimer, ShieldDownTick, Off
SetTimer, EnrageImminentTick, Off
thargoidConfirm2Play(1)
}
}
} else if (thargoidSet and taps == 1) { ; reset
; uncomment the math if you want to test it out
shieldTick := thargoidShieldTime ; / 10
rageTick := thargoidEnrageTime ; / 10
SetTimer, ShieldDownTick, %shieldTick%
SetTimer, EnrageImminentTick, %rageTick%
thargoidConfirm1Play(1)
}
}
#IfWinActive ; so these work no matter what window is active
;exit script
F23::ExitApp
;reload script
F24::
Reload
Sleep, 1000
ExitApp
return
; this has to be set again so that the hotkeys created dynamically by
; TapHoldManager only apply to Elite's window
#IfWinActive Elite - Dangerous (CLIENT)