summaryrefslogtreecommitdiff
path: root/scripts/gugus/digits.lua
blob: 27bde1d5054adbb41e52de43854a90052bd16d64 (plain)
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376

require("scripts/gugus/functions")

-- ============================================================
-- Left and Right Panel functions
-- ============================================================

-----------------------
-- left : 0.0.0:00:0 --
-- right: 0:00.0.0:0 --
-----------------------

function leftDigitsEvent(swFunction)
	lPanel = DigitsEvent(swFunction, "L")
	if lPanel == nil then lPanel = "-.--.---" end
	SetLeftDigits( lPanel )
	return 1
end
function rightDigitsEvent(swFunction)
	rPanel = DigitsEvent(swFunction, "R")
	if rPanel == nil then rPanel = "-:--.---" end
	SetRightDigits( rPanel )
	return 1
end

function DigitsEvent(swFunction, where)
	local swValue = swFunction + 1
	local displaylaptime = GetContextInfo("displaylaptime")
	local displaysectorsplit = mSectorSplit < GetTicks()

	local lr = ""
	if where == "R" then
		lr = "."
	else
		lr = ":"
	end

	local Output = nil

	qi = GetContextInfo("quickinfobutton")
	if qi then
			-- 1.speed [ 3.rpm/gear ]
		    if swValue ==  1 then qi = false ; swValue =  3
			-- 8.laps/total [ 9.remaining laps / total ]
		elseif swValue ==  8 then qi = false ; swValue =  9
		elseif swValue ==  9 then qi = false ; swValue =  8
			-- 11.fuel/speed [ 12.fuel / remaining laps with fuel ]
		elseif swValue == 11 then qi = false ; swValue = 12
			-- 13.water temp [ 14.oil temp ]
		elseif swValue == 13 then qi = false ; swValue = 14
		elseif swValue == 14 then qi = false ; swValue = 13
		-- lap/sector times
			-- 36.current lap time [ 39.last lap time ]
		elseif swValue == 36 then qi = false ; swValue = 39
			-- 38.current lap time + best sector splits [ current sector time ]
		elseif swValue == 37 then qi = false ; swValue = 47
			-- 39.best lap time [ virtual best lap time ]
		elseif swValue == 38 then qi = false ; swValue = 52
		elseif swValue == 39 then qi = false ; swValue = 49
		elseif swValue == 40 then qi = false ; swValue = 49
		elseif swValue == 41 then qi = false ; swValue = 47
		elseif swValue == 45 then qi = false ; swValue = 49
		elseif swValue == 46 then qi = false ; swValue = 49
		elseif swValue == 47 then qi = false ; swValue = 49
		elseif swValue == 48 then qi = false ; swValue = 47
		end
	end
	local NotQI = qi == false

	-- 1.speed [ rpm/gear ]
	    if swValue == 1 then
		Output = GetString("speed", where)

	-- 2.rpm
	elseif swValue == 2 then
		Output = GetString("rpm", where)

	-- 3.rpm/gear
	elseif swValue == 3 then
		Output = GetString("rpm", where .. "l") .. ":" .. GetString("gear", where .. "r")

	-- 4.position/speed
	elseif swValue == 4 then
		Output = GetString("position", where .. "l") .. lr.. GetString("speed", where .. "r")

	-- 5.sector/speed
	elseif swValue == 5 then
		Output = GetString("sector", where .. "l") .. lr .. GetString("speed", where .. "r")

	-- 6.laps/sector
	elseif swValue == 6 then
		Output = GetString("laps", where .. "l") .. lr .. GetString("sector", where .. "r")

	-- 7.laps/position
	elseif swValue == 7 then
		Output = GetString("laps", where .. "l") .. lr .. GetString("position", where .. "r")

	-- 8.laps/total [ remaining laps / total ]
	elseif swValue == 8 then
		Output = GetString("laps", where .. "l") .. lr .. GetString("totallaps", where .. "r")

	-- 9.remaining laps/total [ laps / total ]
	elseif swValue == 9 then
		Output = GetString("remaininglaps", where .. "l") .. lr .. GetString("totallaps", where .. "r")

	-- 10.fuel
	elseif swValue == 10 then
		Output = GetString("fuel", where)

	-- 11.fuel/speed
	elseif swValue == 11 then
		Output = GetString("fuel", where .. "l") .. lr .. GetString("speed", where .. "r")

	-- 12.fuel/remaining laps with fuel
	elseif swValue == 12 then
		Output = GetString("fuel", where .. "l") .. lr .. GetString("remaininglapsintank", where .. "r")

	-- 13.water temp [ oil temp ]
	elseif swValue == 13 then
		Output = GetString("watertemp", where)

	-- 14.oil temp [ water temp ]
	elseif swValue == 14 then
		Output = GetString("oiltemp", where)

	-- 15.wheels temp FL [ RL ]
	elseif swValue == 15 then
		if NotQI then
			Output = GetString("wtfl", where)
		else
			Output = GetString("wtrl", where)
		end

	-- 16.wheels temp FR [ RR ]
	elseif swValue == 16 then
		if NotQI then
			Output = GetString("wtfr", where)
		else
			Output = GetString("wtrr", where)
		end

	-- 17.wheels temp L/R FRONT [ L/R REAR ]
	elseif swValue == 17 then
		if NotQI then
			Output = GetString("wtfl", where .. "l") .. lr .. GetString("wtfr", where .. "r")
		else
			Output = GetString("wtrl", where .. "l") .. lr .. GetString("wtrr", where .. "r")
		end

	-- 18.wheels temp L/R FRONT [ wheels press L/R FRONT ]
	elseif swValue == 18 then
		if NotQI then
			Output = GetString("wtfl", where .. "l") .. lr .. GetString("wtfr", where .. "r")
		else
			Output = GetString("wpfl", where .. "l") .. lr .. GetString("wpfr", where .. "r")
		end

	-- 19.wheels temp L/R REAR [ wheels press L/R REAR ]
	elseif swValue == 19 then
		if NotQI then
			Output = GetString("wtrl", where .. "l") .. lr .. GetString("wtrr", where .. "r")
		else
			Output = GetString("wprl", where .. "l") .. lr .. GetString("wprr", where .. "r")
		end

	-- 20.wheels/brake temp left FRONT [ REAR ]
	elseif swValue == 20 then
		if NotQI then
			Output = GetString("wtfl", where .. "l") .. lr .. GetString("btfl", where .. "r")
		else
			Output = GetString("wtrl", where .. "l") .. lr .. GetString("btrl", where .. "r")
		end

	-- 21.brake/wheels temp right FRONT [ REAR ]
	elseif swValue == 21 then
		if NotQI then
			Output = GetString("btfr", where .. "l") .. lr .. GetString("wtfr", where .. "r")
		else
			Output = GetString("btrr", where .. "l") .. lr .. GetString("wtrr", where .. "r")
		end

	-- 22.wheels temp FL/ press FL [ RL/RL ]
	elseif swValue == 22 then
		if NotQI then
			Output = GetString("wtfl", where .. "l") .. lr .. GetString("wpfl", where .. "r")
		else
			Output = GetString("wtrl", where .. "l") .. lr .. GetString("wprl", where .. "r")
		end

	-- 23.wheels press FR/ temp FR [ RR/RR ]
	elseif swValue == 23 then
		if NotQI then
			Output = GetString("wpfr", where .. "l") .. lr .. GetString("wtfr", where .. "r")
		else
			Output = GetString("wprr", where .. "l") .. lr .. GetString("wtrr", where .. "r")
		end

	-- 24.wheels press FL [ RL ]
	elseif swValue == 24 then
		if NotQI then
			Output = GetString("wpfl", where)
		else
			Output = GetString("wprl", where)
		end

	-- 25.wheels press FR [ RR ]
	elseif swValue == 25 then
		if NotQI then
			Output = GetString("wpfr", where)
		else
			Output = GetString("wprr", where)
		end

	-- 26.wheels press L/R FRONT [ L/R REAR ]
	elseif swValue == 26 then
		if NotQI then
			Output = GetString("wpfl", where .. "l") .. lr .. GetString("wpfr", where .. "r")
		else
			Output = GetString("wprl", where .. "l") .. lr .. GetString("wprr", where .. "r")
		end

	-- 27.brakes temp FL [ RL ]
	elseif swValue == 27 then
		if NotQI then
			Output = GetString("btfl", where)
		else
			Output = GetString("btrl", where)
		end

	-- 28.brakes temp FR [ RR ]
	elseif swValue == 28 then
		if NotQI then
			Output = GetString("btfr", where)
		else
			Output = GetString("btrr", where)
		end

	-- 29.brakes temp L/R FRONT [ L/R REAR ]
	elseif swValue == 29 then
		if NotQI then
			Output = GetString("btfl", where .. "l") .. lr .. GetString("btfr", where .. "r")
		else
			Output = GetString("btrl", where .. "l") .. lr .. GetString("btrr", where .. "r")
		end

	-- 30.track percent [ track size ]
	elseif swValue == 30 then
		if NotQI then
			Output = GetString("trackpercent", where)
		else
			Output = GetString("tracksize", where)
		end

	-- 31.total distance
	elseif swValue == 31 then
		Output = GetString("distance", where)

	-- 32.kers
	elseif swValue == 32 then

	-- 33.kers max
	elseif swValue == 33 then

	-- 34.kers percent
	elseif swValue == 34 then

	-- 35.drs
	elseif swValue == 35 then

	-- 36.current lap time [ last lap time ]
	elseif swValue == 36 then
		Output = GetTimeString("laptime", where)

	-- 37.current lap time + sector splits [ current sector time ]
	elseif swValue == 37 then
		if displaysectorsplit == false then
			Output = GetTimeString("laptime", where)
		else
			Output = GetTimeString("lastsectorsplitVSlast", where)
		end

	-- 38.current lap time + best sector splits [ current sector time ]
	elseif swValue == 38 then
		if displaysectorsplit == false then
			Output = GetTimeString("laptime", where)
		else
			Output = GetTimeString("lastsectorsplitVSbest", where)
		end

	-- 39.best lap time [ virtual best lap time ]
	elseif swValue == 39 then
		Output = GetTimeString("bestlaptime", where)

	-- 40.best lap time + best sector splits [ virtual best lap time ]
	elseif swValue == 40 then
		if displaysectorsplit == false then
			Output = GetTimeString("bestlaptime", where)
		else
			Output = GetTimeString("lastsectorsplitVSbest", where)
		end

	-- 41.last lap time [ last sector ]
	elseif swValue == 41 then

	-- 42.last lap time + sector splits [ last sector ]
	elseif swValue == 42 then

	-- 43.real time diff vs best [ bestlap time ]
	elseif swValue == 43 then

	-- 44.real time diff vs best + best sector split [ best sector time ]
	elseif swValue == 44 then

	-- 45.real time diff vs best + bestlap sector split [ bestlap sector time ]
	elseif swValue == 45 then

	-- 46.real time diff vs last [ last lap time ]
	elseif swValue == 46 then

	-- 47.real time diff vs last + sector split [ last sector time ]
	elseif swValue == 47 then

	-- 48.last sector time [ last sector best time ]
	elseif swValue == 48 then
		Output = GetTimeString("lastsector", where)

	-- 49.sector split [ last sector time ]
	elseif swValue == 49 then

	-- 50.last sector best time
	elseif swValue == 50 then
		Output = GetTimeString("lastsectorbest", where)

	-- 51.best sector split [ best sector time ]
	elseif swValue == 51 then
		Output = GetTimeString("lastsectorsplitVSbest", where)

	-- 52.virtual best lap time (best sectors) [ best lap time ]
	elseif swValue == 52 then
		Output = GetTimeString("virtualbestlap", where)

	-- 53.time remaining [ time elapsed ]
	elseif swValue == 53 then
		Output = GetTimeString("timeremaining", where)

	-- 54.time elapsed [ time remaining ]
	elseif swValue == 54 then
		Output = GetTimeString("timeelapsed", where)

	-- 55.system time
	elseif swValue == 55 then
		Output = GetTimeString("clock", where)

	-- 56.PIT
	elseif swValue == 56 then
		if GetContextInfo("inpits") then
			Output = " Pits "
		else
			Output = "      "
		end

	-- 57.Safety Car
	elseif swValue == 57 then
		if GetContextInfo("safetycar") then
			Output = "Safety"
		else
			Output = "      "
		end

	end

	return Output
end


print ( "gugus> + slipro digits" )