-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTurboAIGUI.au3
270 lines (240 loc) · 9.29 KB
/
TurboAIGUI.au3
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <TurboAIHelpFunctions.au3>
#include-once
; Label Sizes
Global Const $labelWidth = 150
Global Const $labelHeight = 20
; CTRLS GUI Hero
Global $ctrlColor
Global $ctrlPosition
Global $ctrlLevel
Global $ctrlHealth
Global $ctrlDead
; CTRLS componets Game
Global $ctrlIngame
Global $ctrlTimer
Global $ctrlFaction
; CTRLS componetes Towers
Global $ctrlOffT1_Frindly
Global $ctrlOffT2_Frindly
Global $ctrlOffT3_Frindly
Global $ctrlMidT1_Frindly
Global $ctrlMidT2_Frindly
Global $ctrlMidT3_Frindly
Global $ctrlSafelaneT1_Frindly
Global $ctrlSafelaneT2_Frindly
Global $ctrlSafelaneT3_Frindly
Global $ctrlOffT1_Enemy
Global $ctrlOffT2_Enemy
Global $ctrlOffT3_Enemy
Global $ctrlMidT1_Enemy
Global $ctrlMidT2_Enemy
Global $ctrlMidT3_Enemy
Global $ctrlSafelaneT1_Enemy
Global $ctrlSafelaneT2_Enemy
Global $ctrlSafelaneT3_Enemy
; CTRLS Log
Global $ctrlLog
; START: MODULE TEST CODE
#cs
_mainGui()
_GUIHero()
_GUIGame()
_GUITowers()
_GUILog()
For $i = 0 to 9
sleep(100)
_setGUIHero (255,0,1,10,false)
_addEntryGUILog("test",642)
Next
_clearEntriesGUILog()
_addEntryGUILog("test",642)
sleep(100)
_addEntryGUILog("test",642)
sleep(100)
_addEntryGUILog("test",642)
_clearEntriesGUILog()
_addEntryGUILog("test",642)
sleep(2000)
#ce
; END MODULE TEST CODE
Func _renderGUI()
_GUImain()
_GUIHero()
_GUIGame()
_GUITowers()
_GUILog()
EndFunc
Func _GUImain()
Opt("GUICoordMode", 0)
Opt("GUIOnEventMode", 1)
$hMainGUI = GUICreate("Turbo AI Monitor", @DesktopWidth / 2, @DesktopHeight / 2)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exitButton")
GUISetState(@SW_SHOW, $hMainGUI)
EndFunc ;==>_GUImain
Func _GUILog()
Local $guiLog = ""
GUICtrlCreateGroup("Log", -635, 40, 400, 300)
$ctrlLog = GUICtrlCreateEdit($guiLog, 10, 20, 380, 300)
EndFunc ;==>_GUILog
Func _addEntryGUILog($setLogEntry, $setTimer)
If Not (IsNumber($setTimer)) Then
Return
EndIf
Local $minutes = Int(_convertTimer($setTimer) / 60)
Local $seconds = Mod(_convertTimer($setTimer), 60)
Local $sTime = $minutes & ":" & $seconds & " "
Local $sLogEntry = $sTime & $setLogEntry & @CRLF
GUICtrlSetData($ctrlLog, $sLogEntry, 1)
EndFunc ;==>_addEntryGUILog
Func _clearEntriesGUILog()
Local $sEmpty = "Log Reset" & @CRLF
GUICtrlSetData($ctrlLog, $sEmpty)
EndFunc ;==>_clearEntriesGUILog
Func _GUIGame()
Local $guiIngame = ""
Local $guiTimer = ""
Local $guiFaction = ""
GUICtrlCreateGroup("Game", 200, -100, 200, 200)
$ctrlIngame = GUICtrlCreateLabel("In-Game: " & $guiIngame, 5, 20, $labelWidth, $labelHeight)
$ctrlTimer = GUICtrlCreateLabel("Timer/sec: " & $guiTimer, 0, 20, $labelWidth, $labelHeight)
$ctrlFaction = GUICtrlCreateLabel("Faction: " & $guiFaction, 0, 20, $labelWidth, $labelHeight)
EndFunc ;==>_GUIGame
Func _setGUIGame($setIngame, $setTimer, $setFaction)
Local $sFaction
If $setFaction = -1 Then
$sFaction = "Not Set"
EndIf
If $setFaction == True Then
$sFaction = "Radiant"
EndIf
If $setFaction == False Then
$sFaction = "Dire"
EndIf
GUICtrlSetData($ctrlIngame, "In-Game: " & $setIngame)
GUICtrlSetData($ctrlTimer, "Timer/Sec: " & $setTimer)
GUICtrlSetData($ctrlFaction, "Faction: " & $sFaction)
EndFunc ;==>_setGUIGame
Func _GUITowers()
; Frindly
Local $guiTower_MidT1_Frindly
Local $guiTower_MidT2_Frindly
Local $guiTower_MidT3_Frindly
Local $guiTower_SafeLaneT1_Frindly
Local $guiTower_SafeLaneT2_Frindly
Local $guiTower_SafeLaneT3_Frindly
Local $guiTower_OfflaneT1_Frindly
Local $guiTower_OfflaneT2_Frindly
Local $guiTower_OfflaneT3_Frindly
; Enemy
Local $guiTower_MidT1_Enemy
Local $guiTower_MidT2_Enemy
Local $guiTower_MidT3_Enemy
Local $guiTower_SafeLaneT1_Enemy
Local $guiTower_SafeLaneT2_Enemy
Local $guiTower_SafeLaneT3_Enemy
Local $guiTower_OfflaneT1_Enemy
Local $guiTower_OfflaneT2_Enemy
Local $guiTower_OfflaneT3_Enemy
; Tower Group
GUICtrlCreateGroup("Towers: Frindly Top | Enemy Bottom", 200, -60, 330, 200)
; Offlane
GUICtrlCreateGroup("Offlane", 10, 20, 100, 170)
; Frindly
$ctrlOffT1_Frindly = GUICtrlCreateLabel("F-T1: " & $guiTower_OfflaneT1_Frindly, 5, 20, $labelWidth / 2, $labelHeight)
$ctrlOffT2_Frindly = GUICtrlCreateLabel("F-T2: " & $guiTower_OfflaneT2_Frindly, 0, 20, $labelWidth / 2, $labelHeight)
$ctrlOffT3_Frindly = GUICtrlCreateLabel("F-T3: " & $guiTower_OfflaneT3_Frindly, 0, 20, $labelWidth / 2, $labelHeight)
GUICtrlCreateLabel("", 0, 20, $labelWidth / 2, $labelHeight) ; Empty Space
; Enemy
$ctrlOffT1_Enemy = GUICtrlCreateLabel("E-T1: " & $guiTower_OfflaneT1_Enemy, 0, 20, $labelWidth / 2, $labelHeight)
$ctrlOffT2_Enemy = GUICtrlCreateLabel("E-T2: " & $guiTower_OfflaneT2_Enemy, 0, 20, $labelWidth / 2, $labelHeight)
$ctrlOffT3_Enemy = GUICtrlCreateLabel("E-T3: " & $guiTower_OfflaneT3_Enemy, 0, 20, $labelWidth / 2, $labelHeight)
; Mid
GUICtrlCreateGroup("Mid", 100, -140, 100, 170)
; Frindly
$ctrlMidT1_Frindly = GUICtrlCreateLabel("F-T1: " & $guiTower_MidT1_Frindly, 5, 20, $labelWidth / 2, $labelHeight)
$ctrlMidT2_Frindly = GUICtrlCreateLabel("F-T2: " & $guiTower_MidT2_Frindly, 0, 20, $labelWidth / 2, $labelHeight)
$ctrlMidT3_Frindly = GUICtrlCreateLabel("F-T3: " & $guiTower_MidT3_Frindly, 0, 20, $labelWidth / 2, $labelHeight)
GUICtrlCreateLabel("", 0, 20, $labelWidth / 2, $labelHeight) ; Empty Space
; Enemy
$ctrlMidT1_Enemy = GUICtrlCreateLabel("E-T1: " & $guiTower_MidT1_Enemy, 0, 20, $labelWidth / 2, $labelHeight)
$ctrlMidT2_Enemy = GUICtrlCreateLabel("E-T2: " & $guiTower_MidT2_Enemy, 0, 20, $labelWidth / 2, $labelHeight)
$ctrlMidT3_Enemy = GUICtrlCreateLabel("E-T3: " & $guiTower_MidT3_Enemy, 0, 20, $labelWidth / 2, $labelHeight)
; Safelane
GUICtrlCreateGroup("Safelane", 100, -140, 100, 170)
; Frindly
$ctrlSafelaneT1_Frindly = GUICtrlCreateLabel("F-T1: " & $guiTower_SafeLaneT1_Frindly, 5, 20, $labelWidth / 2, $labelHeight)
$ctrlSafelaneT2_Frindly = GUICtrlCreateLabel("F-T2: " & $guiTower_SafeLaneT2_Frindly, 0, 20, $labelWidth / 2, $labelHeight)
$ctrlSafelaneT3_Frindly = GUICtrlCreateLabel("F-T3: " & $guiTower_SafeLaneT3_Frindly, 0, 20, $labelWidth / 2, $labelHeight)
GUICtrlCreateLabel("", 0, 20, $labelWidth / 2, $labelHeight) ; Empty Space
; Enemy
$ctrlSafelaneT1_Enemy = GUICtrlCreateLabel("E-T1: " & $guiTower_SafeLaneT1_Enemy, 0, 20, $labelWidth / 2, $labelHeight)
$ctrlSafelaneT2_Enemy = GUICtrlCreateLabel("E-T2: " & $guiTower_SafeLaneT2_Enemy, 0, 20, $labelWidth / 2, $labelHeight)
$ctrlSafelaneT3_Enemy = GUICtrlCreateLabel("E-T3: " & $guiTower_SafeLaneT3_Enemy, 0, 20, $labelWidth / 2, $labelHeight)
EndFunc ;==>_GUITowers
Func _setGUITowers($setFrindlyTowers, $setEnemyTowers)
If Not (IsArray($setFrindlyTowers) And IsArray($setEnemyTowers)) Then
Return False
EndIf
; Frindly Towers
; Offlane
; GUICtrlSetData($ctrlColor, "Color: " & $setColor)
GUICtrlSetData($ctrlOffT1_Frindly, "F-T1: " & $setFrindlyTowers[0])
GUICtrlSetData($ctrlOffT2_Frindly, "F-T2: " & $setFrindlyTowers[1])
GUICtrlSetData($ctrlOffT3_Frindly, "F-T3: " & $setFrindlyTowers[2])
; Mid
GUICtrlSetData($ctrlMidT1_Frindly, "F-T1: " & $setFrindlyTowers[3])
GUICtrlSetData($ctrlMidT2_Frindly, "F-T2: " & $setFrindlyTowers[4])
GUICtrlSetData($ctrlMidT3_Frindly, "F-T3: " & $setFrindlyTowers[5])
; Safelane
GUICtrlSetData($ctrlSafelaneT1_Frindly, "F-T1: " & $setFrindlyTowers[6])
GUICtrlSetData($ctrlSafelaneT2_Frindly, "F-T2: " & $setFrindlyTowers[7])
GUICtrlSetData($ctrlSafelaneT3_Frindly, "F-T3: " & $setFrindlyTowers[8])
; Enemy Towers
; Offlane
GUICtrlSetData($ctrlOffT1_Enemy, "E-T1: " & $setEnemyTowers[0])
GUICtrlSetData($ctrlOffT2_Enemy, "E-T2: " & $setEnemyTowers[1])
GUICtrlSetData($ctrlOffT3_Enemy, "E-T3: " & $setEnemyTowers[2])
; Mid
GUICtrlSetData($ctrlMidT1_Enemy, "E-T1: " & $setEnemyTowers[3])
GUICtrlSetData($ctrlMidT2_Enemy, "E-T2: " & $setEnemyTowers[4])
GUICtrlSetData($ctrlMidT3_Enemy, "E-T3: " & $setEnemyTowers[5])
; Safelane
GUICtrlSetData($ctrlSafelaneT1_Enemy, "E-T1: " & $setEnemyTowers[6])
GUICtrlSetData($ctrlSafelaneT2_Enemy, "E-T2: " & $setEnemyTowers[7])
GUICtrlSetData($ctrlSafelaneT3_Enemy, "E-T3: " & $setEnemyTowers[8])
EndFunc ;==>_setGUITowers
Func _GUIHero()
Local $guiColor = ""
Local $guiPosition = ""
Local $guiLevel = ""
Local $guiHealth = ""
Local $guiDead = ""
; Main Group
GUICtrlCreateGroup("Player Values", 10, 5, 200, 200)
; Group GUI
$ctrlColor = GUICtrlCreateLabel("Color: " & $guiColor, 5, 20, $labelWidth, $labelHeight)
$ctrlPosition = GUICtrlCreateLabel("Position: " & $guiPosition, 0, 20, $labelWidth, $labelHeight)
$ctrlLevel = GUICtrlCreateLabel("Level: " & $guiLevel, 0, 20, $labelWidth, $labelHeight)
$ctrlHealth = GUICtrlCreateLabel("Low-Health: " & $guiHealth, 0, 20, $labelWidth, $labelHeight)
$ctrlDead = GUICtrlCreateLabel("Dead: " & $guiDead, 0, 20, $labelWidth, $labelHeight)
EndFunc ;==>_GUIHero
Func _setGUIHero($setColor, $setPosition, $setLevel, $setHealth, $setDead)
Local $sPosition
; Build Position String - Array or Non array
If IsArray($setPosition) Then
$sPosition = "Position: " & "X" & $setPosition[0] & " Y" & $setPosition[1]
Else
$sPosition = "Position: " & $setPosition
EndIf
GUICtrlSetData($ctrlColor, "Color: " & $setColor)
GUICtrlSetColor($ctrlColor, $setColor)
GUICtrlSetData($ctrlPosition, $sPosition)
GUICtrlSetData($ctrlLevel, "Level: " & $setLevel)
GUICtrlSetData($ctrlHealth, "Low-Health: " & $setHealth)
GUICtrlSetData($ctrlDead, "Dead: " & $setDead)
EndFunc ;==>_setGUIHero
Func _exitButton()
Exit
EndFunc ;==>_exitButton