-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRL_QuickChat_Controller.ahk
241 lines (223 loc) · 7.67 KB
/
RL_QuickChat_Controller.ahk
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance, force
Menu Tray, tip, %A_ScriptName% ; Custom traytip
OverlayVisible := 0
POVReleased := 1
; ---------------------- CUSTOMIZE BELOW HERE ----------------------
PositionX := 31 ; x position of top left corner of overlay
PositionY := 423 ; y position of top left corner of overlay
ControllerMode := "XB" ; which controller icons to use (PS, XB, XB1), can set to PC to use numbers
FadeDelay := 2000 ; number of milliseconds before overlay fades
SleepInterval := 200 ; number of milliseconds to wait between sending chat hotkey and sending message (increase this if the message sometimes doesn't get sent)
PollInterval := 5 ; number of milliseconds to wait between checks of the controller d-pad
SetTimer Sub_WatchPOV, %PollInterval%
; Trigger hotkey (can add multiple triggers with different groups of messages, just copy this, replace Joy6 with another hotkey, and change the messages)
#IfWinActive ahk_exe RocketLeague.exe
Joy6::
ChatHotkey := "T" ; key assigned to chat (or teamchat if you want to output to teamchat)
MessageGroup := "CUSTOM" ; the category heading for this group (INFORMATIONAL/COMPLIMENTS/REACTIONS/APOLOGIES are the in-game headings)
MessageUp := "gg" ; message assigned to up for this group
MessageLeft := "glhf" ; message assigned to left for this group
MessageRight := "What a pass!" ; message assigned to right for this group
MessageDown := "Nice clear!" ; message assigned to down for this group
Gosub Sub_BuildHTML
Gosub Sub_ToggleOverlay
return
; ---------------------- CUSTOMIZE ABOVE HERE ----------------------
Sub_Up:
if OverlayVisible {
Send %ChatHotkey%
Sleep %SleepInterval%
SendRaw %MessageUp%
Send {enter}
Gosub Sub_ToggleOverlay
} else {
PressedHotkey = %A_ThisHotkey%
PressedKey := SubStr(PressedHotkey, 2)
Send %PressedKey%
}
return
Sub_Left:
if OverlayVisible {
Send %ChatHotkey%
Sleep %SleepInterval%
SendRaw %MessageLeft%
Send {enter}
Gosub Sub_ToggleOverlay
} else {
PressedHotkey = %A_ThisHotkey%
PressedKey := SubStr(PressedHotkey, 2)
Send %PressedKey%
}
return
Sub_Right:
if OverlayVisible {
Send %ChatHotkey%
Sleep %SleepInterval%
SendRaw %MessageRight%
Send {enter}
Gosub Sub_ToggleOverlay
} else {
PressedHotkey = %A_ThisHotkey%
PressedKey := SubStr(PressedHotkey, 2)
Send %PressedKey%
}
return
Sub_Down:
if OverlayVisible {
Send %ChatHotkey%
Sleep %SleepInterval%
SendRaw %MessageDown%
Send {enter}
Gosub Sub_ToggleOverlay
} else {
PressedHotkey = %A_ThisHotkey%
PressedKey := SubStr(PressedHotkey, 2)
Send %PressedKey%
}
return
Sub_ToggleOverlay:
if !OverlayVisible {
Gosub Sub_ShowOverlay
} else {
Gosub Sub_HideOverlay
}
OverlayVisible := !OverlayVisible
return
; Creates and shows the GUI
Sub_ShowOverlay:
Gui GUI_Overlay:New, +ToolWindow +LastFound +AlwaysOnTop -Caption -Border +hwndGUI_Overlay_hwnd
Gui Margin, 0,0
Gui Add, ActiveX, w400 h225 vWB BackGroundTrans, Shell.Explorer
URL := "file:///" . A_ScriptDir . "/overlay.html"
WB.Navigate(URL)
WinSet Transparent, 240
;WinSet TransColor, White 0
Gui Show, Hide, Overlay
WinMove PositionX, PositionY
Gui GUI_Overlay:Show, NoActivate
SetTimer Sub_TimeoutOverlay, -%FadeDelay%
return
Sub_HideOverlay:
Gui GUI_Overlay:Destroy
return
Sub_TimeoutOverlay:
if OverlayVisible {
Gosub Sub_ToggleOverlay
}
return
Sub_WatchPOV:
if WinActive("ahk_exe RocketLeague.exe")
{
GetKeyState POV, JoyPOV
if OverlayVisible {
if (POV >= 0 and POV <= 4500) {
Gosub Sub_Up
} else if (POV > 4500 and POV <= 9000) {
Gosub Sub_Right
} else if (POV > 9000 and POV <= 18000) {
Gosub Sub_Down
} else if (POV > 18000 and POV <= 27000) {
Gosub Sub_Left
}
} else {
if (POV < 0) {
POVReleased = 1
} else if (POV >= 0 and POV <= 4500 and POVReleased) {
Send 1
POVReleased = 0
} else if (POV > 4500 and POV <= 9000 and POVReleased) {
Send 3
POVReleased = 0
} else if (POV > 9000 and POV <= 18000 and POVReleased) {
Send 4
POVReleased = 0
} else if (POV > 18000 and POV <= 27000 and POVReleased) {
Send 2
POVReleased = 0
}
}
}
return
Sub_BuildHTML:
FileDelete, overlay.html
FileAppend,
(
<!DOCTYPE html>
<html>
<meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge"/>
<head>
<style type="text/css">
body {
background: url("images/background.png") repeat-y left;
background-color: black;
color:white;
margin-top:16px;
margin-left:16px;
overflow:hidden;
}
@font-face {
font-family:"Arial Narrow";
src: url("fonts/1_Arial Narrow.ttf")
}
@font-face {
font-family:"Bourgeois Medium";
src: url("fonts/7_Bourgeois Medium.ttf")
}
@font-face {
font-family:"Bourgeois Thin";
src: url("fonts/9_Bourgeois Thin.ttf")
}
#header1 {
font-family:"Bourgeois Thin";
font-size:23px;
font-weight:900;
letter-spacing:.6px;
word-spacing:-6px;
line-height:18px;
color:#21abcd;
}
#header2 {
font-family:"Bourgeois Medium";
font-size:30px;
text-shadow: 0 0 4px rgba(255,255,255,0.6);
}
.text {
font-family:"Arial Narrow";
font-size:24px;
padding-left:12px;
word-spacing:-6px;
}
div.icon {
display:inline-block;
vertical-align:middle;
}
span {
font-size:18px;
color:#21abcd;
}
#selections {
padding-top:3px;
padding-left:3px;
}
.select-left,.select-right {
margin-left:-3px;
}
</style>
</head>
<body>
<div id="header1">QUICK CHAT</div>
<div id="header2">%MessageGroup%</div>
<div id="selections">
<div class="select select-up"><div class="icon"><img width="28" height="32" class="img-up" src="images/GamepadIcon_DPadU_%ControllerMode%.png" /></div><span class="text">%MessageUp%</span></div>
<div class="select select-left"><div class="icon"><img width="32" height="32" class="img-left" src="images/GamepadIcon_DPadL_%ControllerMode%.png" /></div><span class="text">%MessageLeft%</span></div>
<div class="select select-right"><div class="icon"><img width="32" height="32" class="img-right" src="images/GamepadIcon_DPadR_%ControllerMode%.png" /></div><span class="text">%MessageRight%</span></div>
<div class="select select-down"><div class="icon"><img width="28" height="32" class="img-down" src="images/GamepadIcon_DPadD_%ControllerMode%.png" /></div><span class="text">%MessageDown%</span></div>
</div>
</body>
</html>
), overlay.html
return