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
|
-- Custom Scripts Template SLIMax Manager Scripts v2.0
-- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
-- last change by Zappadoc - 2012-12-03
-- villota77's script for F1 2012 - v1.3.2
-- This script tries to imitate the way KERS and delta time info is shown in real F1 steering wheel displays
-- (1) KERS is shown in the left display as a pure number (in percentage)
-- (2) Delta time ("qualy time") with respect to best (or last) lap is shown in the right display
-- in X.XX format (if it is positive - note there is not a "+" sign in SLIPro)
-- or -X.XX format (if it is negative)
-- (3) Delta-time info is refreshed every 1 second so you don't have digits flickering
-- (4) At the end of the lap, the right display will freeze and show deltatime (to best lap) during a number of seconds chosen in SLIMaxMng
--- (General Options - LAPTIMEDISPLAYDELAY). Then it will resume showing real-time data.
function ev_ShowTime(lptime, T, Ndig, deltaflag)
local ticks = GetTicks()
-- show time every T milliseconds with Ndig decimal digits
if ev_old_time == nil or (ticks - ev_old_time) > T then
-- global to backup ticks (ms)
ev_old_time = ticks
local hr = 0
local mn = 0
local sc = 0
local ms = 0
local hd = 0
local rpanel = ""
local prefix = " "
if lptime < 0 then
prefix = "-"
end
-- explod time
hr, mn, sc, hd, ms = timeDispatcher(lptime)
if deltaflag == 1 then
--display delta time
if lptime == -1 or (mn + sc + ms) == 0.0 then
rPanel = " -.-- "
elseif mn > 0 then
rPanel = string.format( " %s%1d.%02d ", prefix, mn, sc)
else
if Ndig == 2 then
rPanel = string.format( " %s%1d.%02d ", prefix, sc, hd)
else
rPanel = string.format( " %s%1d.%03d", prefix, sc, ms)
end
end
elseif deltaflag == 0 then
--display laptime
if lptime == -1 or (mn + sc + ms) == 0.0 then
rPanel = "-:--.---"
elseif mn < 10 then
rPanel = string.format( "%1d:%02d.%03d", mn, sc, ms)
elseif hr > 0 then
rPanel = string.format( " %02d.%02d ", hr, mn)
else
rPanel = string.format( " %02d.%02d.%01d", mn, sc, ms)
end
end
end
SetRightDigits( rPanel )
-- return 1 to bypass std behavior
return 1
end
function villota_custom_leftDigitsEvent(swFunction)
-- get current simulation name
local sim = GetContextInfo("simulation")
if sim == "f1_2012.exe" then
local lPanel = ""
-- is OSP Tracking ON
local ospt = GetContextInfo("osptracking")
if ospt then return 2 end
-- check if quick info button is down
local qi = GetContextInfo("quickinfobutton")
if qi then return 2 end
if swFunction == 33 then
-- 33: KERSpercentage, wothout prefix
local kersp = GetCarInfo("kers")
lPanel = string.format(" %3d ", round((kersp/1000)/4))
SetLeftDigits( lPanel )
return 1
end
end
return 2
end
function villota_custom_rightDigitsEvent(swFunction)
-- get current simulation name
local sim = GetContextInfo("simulation")
if sim == "f1_2012.exe" or sim == "rFactor.exe" or sim == "rFactor2.exe" or sim == "LFS.exe" or sim == "GTR2.exe" then
local delta = 0.0
-- is OSP Tracking ON
local ospt = GetContextInfo("osptracking")
if ospt then return 2 end
-- check if quick info button is down
local qi = GetContextInfo("quickinfobutton")
if qi then return 2 end
local dltime = GetContextInfo( "displaylaptime" )
if dltime == true then
--freeze last delta time in display
local lpt_last = GetTimeInfo("lastlaptime")
local lpt_best = GetTimeInfo("bestlaptime")
if ev_old_bestLapTime == nil then ev_old_bestLapTime = lpt_best end
ev_final_delta_best = lpt_last - ev_old_bestLapTime
if ev_final_delta_best == 0 then
return 2
else
return ev_ShowTime(ev_final_delta_best, 50, 3, 1)
end
else
--update best time if last laptime was better
if ev_final_delta_best ~= nil and ev_final_delta_best < 0 then
ev_old_bestLapTime = lpt_last
end
end
if swFunction == 11 then
-- 11: real time best laptime difference DELTA time
-- real time diff vs your best
delta = GetTimeInfo("realdiffbest")
return ev_ShowTime(delta, 1000, 2, 1)
elseif swFunction == 12 then
-- 12: real time last laptime difference DELTA time
-- real time diff vs your last
delta = GetTimeInfo("realdifflast")
return ev_ShowTime(delta, 1000, 2, 1)
end
end
return 2
end
|