-
Notifications
You must be signed in to change notification settings - Fork 1
/
CSGO_TTS AxynoS.ahk
166 lines (131 loc) · 8.48 KB
/
CSGO_TTS AxynoS.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
; ,╓~
; ,╥@╣╣▒▒▒
; ,╓@╬╢╣╣╣╢▒▒▒
; ,@╬╣╣╣╣╣╣╣╣▒▒▒`
; ,@╣╣╣╣╣╣╣╣╣╣╣▒▒▒┘
; ╥╬╣╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒
; ,@╢╣╣╣╣╣╣╣╣╣╣╣╣╢╣▒▒▒
; ,╫╢╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒
; ,@╢╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒░
; g╢╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒
; ╓╣╣╣╣╣╣╢╣╣╣╣╢╣╣╣╣╣╣╣╢▒▒▒
; ╟╢╣╣╣╣╣╣╣╣╣▒╢╣╣╣╣╣╣╣╢▒▒▒`
; ,╬╣╣╣╣╣╣╣╣╣▒▒╢╣╣╣╣╣╣╣╣▒▒▒▒
; ╓╢╣╣╣╣╣╣╣╣▒▒▒╢╣╣╣╣╣╣╣╣╣▒▒▒
; ╟╣╣╣╣╣╣╣╣╢▒▒▒▒╣╣╣╣╣╣╣╣╣▒▒▒`
; ╫╣╣╣╣╣╣╣╣╢▒▒▒\╢╣╣╣╣╣╢╣╣╣▒▒▒
; ╫╣╣╣╣╣╣╣╣╢▒▒▒ ╫╣╢╣╣╣╣╣╣╢▒▒▒
; ╬╣╢╣╣╣╣╣╣╣▒▒▒`]╢╣╣╣╣╣╣╣╣╣▒▒▒
; ╫╣╣╣╣╣╣╣╣╣▒▒▒` ╫╣╣╣╣╣╣╣╣╢▒▒▒`²,=╓╥@@@╬╬╬╣╣╣╬@@╖╓
; ╫╣╣╣╣╣╣╣╣╣▒▒▒Ü ,╢╣╣╣╣╣╣╣╣╣╢╢╣╣╢╣╣╣╣╣╣╣╣╣╣╣╣╣╢╢╢╣▒▒▒║╖,
; ║╣╣╣╣╣╣╣╣╣╣▒▒▒ ╟╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╢╢╣▒▒▒▒▒▒▒Ñ╝╜╜╜╙"`
; ╓╣╣╣╣╣╣╣╣╣╣▒▒╢╬╬╢╣╣╣╣╣╣╣╣╣╣╣╣╣╣╢╣▒▒▒▒▒Ñ╜╜"`
; ╓╢╣╣╣╣╣╣╣╣╣╣╢╣╣╣╣╣╣╣╣╣╣╣╣╣╣╢╣▒▒▒▒Ñ╜╙`
; ╫╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒"
; ╟╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒
; ]╣╣╣╣╣╣╣╣╣╣╣╣╣╣╣╢╣▒╢╣╣╣╣╣╣╣╣▒▒▒▒
; ╢╣╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒▒Ñ╫╣╣╣╣╣╢╣╣▒▒▒░
; ]╣╣╣╣╣╣╣╣╣╣╣▒▒▒▒╜" ]╣╣╣╣╣╣╣╣▒▒▒`
; ╢╣╣╣╣╣╣╣╣╣╣╣▒▒▒ ]╣╣╣╣╣╣╣╣▒▒▒
; ║╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒ ╢╣╣╣╣╣╣╣▒▒▒
; ╢╣╣╣╣╣╣╣╣╣╣╣▒▒▒▒ ╫╣╣╣╣╣╣╣▒▒▒▒
; ╓╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒ `╙╨Ñ╣╣╣╣▒▒▒
; ╙╣╣╣╣╣╣╣╣╣╣╣╣▒▒▒ "╙╜╝▒
; "╙Ñ╣╣╣╣╣╣╣▒▒▒
; ╙╨╬╢╣▒▒▒
; "╙╜
; -------------------- CREDITS -------------------------
; Made by AxynoS - youtube.com/c/axynos. Reddit account Axistra(proof in video description.)
; Modify this script to your liking, but give me credit if you do.
; Version 1.0
; -------------------- END OF CREDITS ------------------
; -------------------- AHK VERSION ---------------------
;- Shows the AHK version : Uncomment to check AHK version.
;- AHK verison must be 1.1 OR ABOVE.
;MsgBox % A_AhkVersion
; -------------------- END AHK VERSION -----------------
; -------------------- VARIABLES -----------------------
;- LogFile : Constantly updating logfile. Created by the console command con_logfile !tts-axynos
;- CommandBuffer : Extracted commands from log get written to this file
;- ChatCommand : Define the chat command here - anything writter after the = is considered the command
;- ChatCommandLengthGetter() : Gets the command length used to calculate where the actual message is in the line
;- StartingLine : Indicates the next line to be read
;- CurrentLine : Current line being read
;- StartupText : Text to speak on startup.
;- TTS : TTS engine(Microsoft SAPI)
;- CHANGE THIS | EXAMPLE: E:\Steam\SteamApps\common\Counter-Strike Global Offensive\csgo\!tts-axynos
LogFile = "" ;- CHANGE THIS TO YOUR LOG FILE IN THE CSGO FOLDER
;- Don't change anything from this point onwards unless you know what you are doing.
CurrentLine = 0
StartingLine = 0
ChatCommand = !tts
ChatCommandLengthGetter()
EnvGet, LocalAppData, LOCALAPPDATA
TTS := ComObjCreate("SAPI.SpVoice")
CommandBuffer = %LocalAppData%\csgo_tts\csgottsbuffer.txt
StartupText = <volume level="20">TTS FOR CS:GO, MADE BY AXYNOS. ENJOY!</volume>
; -------------------- VARIABLES END -------------------
; -------------------- STARTUP -------------------------
;- Deletes current command list. Note that this is separate from the log file in the csgo directory.
IfExist, %CommandBuffer%
FileDelete, %CommandBuffer%
if LogFile = ""
{
MsgBox, Log file not specified. Please add in your logfile to the script variables section.
Exit
}
;- Comment out the following line if you do not want to listen to the startup voice.
TTS.Speak(StartupText)
; -------------------- END STARTUP ---------------------
Loop ;- TTS COMMAND USAGE CHECKER LOOP
{
;- Extracts commands from logfile to buffer.
Loop, read, %LogFile%, %CommandBuffer%
{
IfInString, A_LoopReadLine, %ChatCommand%, FileAppend, %A_LoopReadLine%`n
}
Loop, read, %CommandBuffer%
{
FileReadLine, ThisLineOutput, %CommandBuffer%, CurrentLine
;IfInString, ThisLineOutput, %ChatCommand%
;{
;- Tells the script that we want to use a global variable
global ChatCommandLength
global StartingLine
global CurrentLine
last_line = 0
Loop, read, %CommandBuffer%
last_line++
;MsgBox, %last_line%
;- Gets the entire unmodified chat message length.
StringLen, lineLength, ThisLineOutput
;MsgBox, %lineLength% - length
;- Gets command position and skips it, so it doesn't get included in the TTS message.
StringGetPos, cmdPos, ThisLineOutput, %ChatCommand%
MessageStartPos = %cmdPos%
MessageStartPos += %ChatCommandLength%
MessagePos = %lineLength%
MessagePos -= %MessageStartPos% ;- Gets actual TTS message start position
;- Gets actual TTS message to be played out
StringRight, Message, ThisLineOutput, %MessagePos%
;- Plays TTS
if CurrentLine <= %last_line%
{
TTS.Speak(Message)
CurrentLine++
}
;}
}
IfExist, %CommandBuffer%
{
FileDelete, %CommandBuffer%
;FileDelete, %LogFile%
}
;- Wait before relooping, time in milliseconds.
Sleep, 100
} ;- LOOP END
;- Returns command length, used for message separation.
ChatCommandLengthGetter() {
global ChatCommand
StringLen, ChatCommandLength, ChatCommand
}