From 576a5367dbdabeeeb12103abaeac683fbf8e792b Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 21 Nov 2013 10:17:34 +0100 Subject: [gugus] scripts renaming --- scripts/gugus/enterExit.lua | 41 -- scripts/gugus/session.lua | 41 ++ scripts/gugus/slipro.lua | 856 +++++++++++++++++++++++++++++++++++++++++ scripts/gugus/sliproDigits.lua | 856 ----------------------------------------- scripts/slipro_gus.lua | 4 +- 5 files changed, 899 insertions(+), 899 deletions(-) delete mode 100644 scripts/gugus/enterExit.lua create mode 100644 scripts/gugus/session.lua create mode 100644 scripts/gugus/slipro.lua delete mode 100644 scripts/gugus/sliproDigits.lua diff --git a/scripts/gugus/enterExit.lua b/scripts/gugus/enterExit.lua deleted file mode 100644 index 1747c51..0000000 --- a/scripts/gugus/enterExit.lua +++ /dev/null @@ -1,41 +0,0 @@ - -function custom_enterSessionEvent(devType) - - m_lastSector3 = nil - m_bestSector3 = nil - - -- type your custom script on session start, here - print () - print ( "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv") - print (string.format("simu : %s",GetContextInfo("simulation"))) - print (string.format("car : %s",GetContextInfo("carname"))) - print (string.format("track : %s",GetContextInfo("trackname"))) - --print (string.format("session: %s",GetContextInfo("session"))) - print () - if GetContextInfo("ospcustom") then print ("has ospcustom") end - - print (string.format("shiftlightsmethod: %s",GetContextInfo("shiftlightsmethod"))) - print (string.format("ospmethod : %s",GetContextInfo("ospmethod"))) - print (string.format("speedlimitemethod: %s",GetContextInfo("speedlimitermethod"))) - return 2 -end - -function global_custom_exitSessionEvent(devType) - -- type your custom script on session ending, here - if GetContextInfo("ospcustom") then print ("has ospcustom") end - print () - print (string.format("shiftlightsmethod: %s",GetContextInfo("shiftlightsmethod"))) - print (string.format("ospmethod : %s",GetContextInfo("ospmethod"))) - print (string.format("speedlimitemethod: %s",GetContextInfo("speedlimitermethod"))) - print ( "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^") - print () - - --my_setups=io.open("gus_cars.cfg", "a") - --my_setups:write(GetContextInfo("carname"), " shiftligts ", GetContextInfo("shiftlightsmethod"), "\n") - --my_setups:write(GetContextInfo("carname"), " speedlimiter ", GetContextInfo("speedlimitermethod"), "\n") - --my_setups:close() - - return 2 -end - -print ( "gugus> + enter exit" ) diff --git a/scripts/gugus/session.lua b/scripts/gugus/session.lua new file mode 100644 index 0000000..1747c51 --- /dev/null +++ b/scripts/gugus/session.lua @@ -0,0 +1,41 @@ + +function custom_enterSessionEvent(devType) + + m_lastSector3 = nil + m_bestSector3 = nil + + -- type your custom script on session start, here + print () + print ( "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv") + print (string.format("simu : %s",GetContextInfo("simulation"))) + print (string.format("car : %s",GetContextInfo("carname"))) + print (string.format("track : %s",GetContextInfo("trackname"))) + --print (string.format("session: %s",GetContextInfo("session"))) + print () + if GetContextInfo("ospcustom") then print ("has ospcustom") end + + print (string.format("shiftlightsmethod: %s",GetContextInfo("shiftlightsmethod"))) + print (string.format("ospmethod : %s",GetContextInfo("ospmethod"))) + print (string.format("speedlimitemethod: %s",GetContextInfo("speedlimitermethod"))) + return 2 +end + +function global_custom_exitSessionEvent(devType) + -- type your custom script on session ending, here + if GetContextInfo("ospcustom") then print ("has ospcustom") end + print () + print (string.format("shiftlightsmethod: %s",GetContextInfo("shiftlightsmethod"))) + print (string.format("ospmethod : %s",GetContextInfo("ospmethod"))) + print (string.format("speedlimitemethod: %s",GetContextInfo("speedlimitermethod"))) + print ( "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^") + print () + + --my_setups=io.open("gus_cars.cfg", "a") + --my_setups:write(GetContextInfo("carname"), " shiftligts ", GetContextInfo("shiftlightsmethod"), "\n") + --my_setups:write(GetContextInfo("carname"), " speedlimiter ", GetContextInfo("speedlimitermethod"), "\n") + --my_setups:close() + + return 2 +end + +print ( "gugus> + enter exit" ) diff --git a/scripts/gugus/slipro.lua b/scripts/gugus/slipro.lua new file mode 100644 index 0000000..12c1347 --- /dev/null +++ b/scripts/gugus/slipro.lua @@ -0,0 +1,856 @@ +-- ============================================================ +-- Left and Right Panel functions +-- ============================================================ + +function leftDigitsEvent(swFunction) + swValue = swFunction + 1 + + local lPanel = "" + local inf = "" + local unit = false + local spd = 0.0 + -- get speed in kph or mph (use "rawspeed" to get value in meter/sec) + local spd = GetCarInfo("speed") + -- get current display unit metric or imperial + unit = GetContextInfo("speedmetric") + -- check if quick info button is down + local qi = false + qi = GetContextInfo("quickinfobutton") + if qi == nil or qi == 0 then qi = false end + if qi then + -- get index for left panel + local qiLeft = GetContextInfo("quickinfoleft") + if qiLeft == nil then qiLeft = 1 end + -- force position to match QI preference + swValue = qiLeft + end + + -- check if PIT Feedback ON + local pf = false + pf = GetContextInfo("pitfeedback") + if pf == nil or pf == 0 then pf = false end + if pf then + -- force position to PIT/SPEED function if car pits + local pit = GetCarInfo("inpits") + if pit > 0 then + swValue = 35 + end + end + + -- get current simulation name + local sim = GetContextInfo("simulation") + + --print ( "swValue: " .. swValue ) + + -- check postion and compute left panel string + if swValue == 1 then + -- speed only + lPanel = string.format(" %3.0f", spd ) + + elseif swValue == 2 then + -- fuel:speed + local fuel = GetCarInfo("fuel") + if fuel ~= nil then + fuel = GetFuel(fuel, unit) + if fuel >= 100 then + -- special case for Euro Truck :) + lPanel = string.format("%03d:%3.0f", round(fuel)%1000, spd) + elseif fuel >= 10 then + lPanel = string.format("F%02d:%3.0f", round(fuel), spd) + elseif fuel >= 1 then + lPanel = string.format("F%1.1f:%3.0f", fuel, spd) + else + lPanel = string.format("F.%02d:%3.0f", fuel * 100, spd ) + end + end + elseif swValue == 3 then + -- position:speed + inf = GetContextInfo("position") + if inf ~= nil then + if inf >= 100 then + lPanel = string.format("%03d:%3.0f", inf, spd) + else + lPanel = string.format("P%02d:%3.0f", inf, spd) + end + end + elseif swValue == 4 then + -- laps completed:speed + inf = GetContextInfo("laps") + if inf ~= nil then + -- if more than 99 laps + if inf >= 100 then + lPanel = string.format("%03d:%3.0f", inf, spd) + else + lPanel = string.format("L%02d:%3.0f", inf, spd) + end + end + elseif swValue == 5 then + -- sector:speed + inf = GetCarInfo("sector") + if inf ~= nil then + -- check if sector > 9 + if inf >9 then + lPanel = string.format("S.%02d:%3.0f", inf, spd) + else + lPanel = string.format(" S.%1d :%3.0f", inf, spd) + end + end + elseif swValue == 6 then + -- laps completed:total laps if available + inf = GetContextInfo("laps") + local tl = GetContextInfo("lapscount") + if tl == nil or tl < 0 or tl > 999 then tl = 0 end + if inf == nil then inf = 0 end + local laps = "L--" + local total = "t--" + + if tl == 0 then + -- if more than 99 laps + if inf >= 100 then + if inf > 999 then inf = 999 end + laps = string.format("%03d", inf ) + else + laps = string.format("L%02d", inf) + end + else + inf = tl - inf + -- display remaining laps + + if inf >= 100 then + if inf > 999 then inf = 999 end + laps = string.format("%03d", inf ) + else + laps = string.format("r%02d", inf) + end + end + + if tl >= 100 then + if tl > 999 then tl = 999 end + total = string.format("%03d", tl) + elseif tl ~= 0 then + total = string.format("t%02d", tl) + end + lPanel = laps .. ":" .. total + + elseif swValue == 7 then + -- water temp + inf = GetCarInfo("watertemp") + if inf ~= nil then + inf = GetTemp(inf, unit) + lPanel = string.format("H2o:%2.1f", inf) + end + elseif swValue == 8 then + -- oil temp + inf = GetCarInfo("oiltemp") + if inf ~= nil then + inf = GetTemp(inf, unit) + lPanel = string.format("OIL:%2.1f", inf) + end + + elseif swValue == 9 then + -- wheels temp if available + inf = GetCarInfo("wheeltempfrontleft") + if inf ~= nil then + -- if rFactor convert Kelvin to Celsius (see global.lua) + if isAppRFactor(sim) then inf = KtoC(inf) end + lPanel = string.format("tFL:%3.0f", inf) + end + elseif swValue == 10 then + inf = GetCarInfo("wheeltempfrontright") + if inf ~= nil then + if isAppRFactor(sim) then inf = KtoC(inf) end + lPanel = string.format("tFr:%3.0f", inf) + end + elseif swValue == 11 then + inf = GetCarInfo("wheeltemprearleft") + if inf ~= nil then + if isAppRFactor(sim) then inf = KtoC(inf) end + lPanel = string.format("trL:%3.0f", inf) + end + elseif swValue == 12 then + inf = GetCarInfo("wheeltemprearright") + if inf ~= nil then + if isAppRFactor(sim) then inf = KtoC(inf) end + lPanel = string.format("trr:%3.0f", inf) + end + + elseif swValue == 13 then + -- wheels pressure if available + inf = GetCarInfo("wheelpressfrontleft") + if inf ~= nil then + -- convert to psi + lPanel = string.format("PFL:%2.1f", inf / 6.88) + end + elseif swValue == 14 then + inf = GetCarInfo("wheelpressfrontright") + if inf ~= nil then + lPanel = string.format("PFr:%2.1f", inf / 6.88) + end + elseif swValue == 15 then + inf = GetCarInfo("wheelpressrearleft") + if inf ~= nil then + lPanel = string.format("PrL:%2.1f", inf / 6.88) + end + elseif swValue == 16 then + inf = GetCarInfo("wheelpressrearright") + if inf ~= nil then + lPanel = string.format("Prr:%2.1f", inf / 6.88) + end + + elseif swValue == 17 then + -- brakes temp if available + inf = GetCarInfo("braketempfrontleft") + if inf ~= nil then + if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end + lPanel = string.format("BFL:%3.0f", inf) + end + elseif swValue == 18 then + inf = GetCarInfo("braketempfrontright") + if inf ~= nil then + if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end + lPanel = string.format("BFr:%3.0f", inf) + end + elseif swValue == 19 then + inf = GetCarInfo("braketemprearleft") + if inf ~= nil then + if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end + lPanel = string.format("BrL:%3.0f", inf) + end + elseif swValue == 20 then + inf = GetCarInfo("braketemprearright") + if inf ~= nil then + if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end + lPanel = string.format("Brr:%3.0f", inf) + end + elseif swValue == 21 then + -- position + local pos = GetContextInfo("position") + lPanel = string.format(" P%02d ", pos ) + + elseif swValue == 22 then + -- get an average consumption of fuel per lap and gives the remaining laps + local remainlapsintank = GetCarInfo("remainlapsintank") + lPanel = string.format(" FL%3.0f", math.floor(remainlapsintank) ) + + elseif swValue == 23 then + -- rpm + local rpm = GetCarInfo("rpm") + lPanel = string.format(" %5d", rpm) + + elseif swValue == 24 then + -- track size + local trcksz = GetContextInfo("tracksize") + lPanel = string.format("%5d ", trcksz) + + elseif swValue == 25 then + -- 25.fuel:consumption + local fuel = GetCarInfo("fuel") + local remainlapsintank = GetCarInfo("remainlapsintank") + + local sFuel = " " + local sRemainLaps = " " + + if fuel ~= nil then + fuel = GetFuel(fuel, unit) + if fuel >= 100 then + -- specific for euro truck :) + sFuel = string.format("%03d", round(fuel) % 1000 ) + elseif fuel >= 10 then + sFuel = string.format("F%02d", round(fuel) ) + elseif fuel >= 1 then + sFuel = string.format("F%1.1f", fuel ) + else + sFuel = string.format("F.%02d", fuel * 100 ) + end + + if remainlapsintank == 0 then + sRemainLaps = "L--" + elseif remainlapsintank >= 100 then + sRemainLaps = "L99" + elseif remainlapsintank >= 10 then + sRemainLaps = string.format("L%02d", math.floor(remainlapsintank)) + else + sRemainLaps = string.format("L%1.1f", remainlapsintank) + end + + lPanel = sFuel .. ":" .. sRemainLaps + end + + elseif swValue == 26 then + -- 26.distance + local dist = GetContextInfo("lapdistance") + lPanel = string.format(" %5d", dist ) + + elseif swValue == 27 then + --27.laps completed:sector + local laps = GetContextInfo("laps") + local sLaps = " " + if laps >= 100 then + sLaps = string.format("%3d", laps ) + else + sLaps = string.format("L%02d", laps ) + end + + local sSector = " " + local sector = GetCarInfo("sector") + if sector ~= nil then + if sector > 9 then + sSector = string.format("S.%02d", sector) + else + sSector = string.format(" S.%1d", sector) + end + end + + lPanel = sLaps .. ":" .. sSector + + + elseif swValue == 28 then + --28.total laps + local lpcnt = GetContextInfo("lapscount") + lPanel = string.format(" t%3d", lpcnt ) + + elseif swValue == 29 then + --29.sector + local sect = GetCarInfo("sector") + -- check if sector > 9 + if sect >9 then + lPanel = string.format(" S.%02d ", sect) + else + lPanel = string.format(" S.%1d ", sect) + end + + elseif swValue == 30 then + --30.kers + local kers = GetCarInfo("kers") + lPanel = string.format(" E:%3d", round(kers/1000)) + + elseif swValue == 31 then + --31.kers max + local kmx = GetCarInfo("kersmax") + lPanel = string.format(" E:%03d", round(kmx/1000)) + + elseif swValue == 32 then + --32.drs + local drs = GetCarInfo("drs") + if drs == 1 then + lPanel = "DrS:ON " + else + lPanel = "DrS:OFF" + end + + elseif swValue == 33 then + --33.kers percent + local kers = GetCarInfo("kers") + lPanel = string.format(" E:%3d", round((kers/1000)/4)) + + elseif swValue == 34 then + --33.kers percent:speed + local kers = GetCarInfo("kers") + lPanel = string.format("%3d:%3.0f", round((kers/1000)/4), spd) + + elseif swValue == 35 then + -- PIT + lPanel = " PIt " + + elseif swValue == 36 then + -- sc + local sc = GetContextInfo("safetycar") + if sc == 1 then + lPanel = "SaFETy" + else + lPanel = " " + end + + else + lPanel = "-:--.---" + end + -- send string to sli manager + SetLeftDigits( lPanel ) + return 1 +end + + + + + + + + + + + +-- ============================================================ +-- Left and Right Panel functions +-- ============================================================ + +function rightDigitsEvent(swFunction) + swValue = swFunction + 1 + + local hr = 0 + local mn = 0 + local sc = 0 + local ms = 0 + local hd = 0 + local rPanel = "" + local lpt = nil + local diffTimeFlag = false + local unit = false + + -- is OSP Tracking ON + local ospt = false + ospt = GetContextInfo("osptracking") + if ospt == nil then ospt = false end + if ospt then + swValue = 23 + end + + -- lap finished, display lap time a few seconds + --local dlt = false + --dlt = GetContextInfo("displaylaptime") + --if dlt == nil then dlt = false end + --if dlt and swValue ~= 37 and swValue ~= 38 then + -- swValue = 3 + --end + + -- check if quick info button is down + local qi = false + qi = GetContextInfo("quickinfobutton") + if qi == nil or qi == 0 then qi = false end + if qi then + -- get index for right panel + local qiRight = GetContextInfo("quickinforight") + if qiRight == nil then qiRight = 1 end + swValue = qiRight + end + -- get current display unit metric or imperial + unit = GetContextInfo("speedmetric") + + -- check if PIT Feedback ON + local pf = false + pf = GetContextInfo("pitfeedback") + if pf == nil or pf == 0 then pf = false end + if pf then + -- force position to SPEED function + local pit = GetCarInfo("inpits") + if pit > 0 then + swValue = 20 + end + end + + --print ( "swValue: " .. swValue ) + + -- get sim name + local sim = GetContextInfo("simulation") + if sim ~= nil then + if swValue == 1 then + -- current lap time + lpt = GetTimeInfo("laptime") + + elseif swValue == 2 then + -- best lap time (PB) + lpt = GetTimeInfo("bestlaptime") + + elseif swValue == 3 then + -- last lap time + lpt = GetTimeInfo("lastlaptime") + + elseif swValue >= 4 and swValue <= 10 and isAppIRacing(sim) then + -- iRacing partials + local ts = GetContextInfo("partialcount") + local sector = GetCarInfo("sector") + if ts ~= nil and ts > 0 then + if swValue == 4 then + lpt = GetPartialTimeInfo("currentpartial", sector) + elseif swValue == 5 then + diffTimeFlag = true + lpt = GetPartialTimeInfo("vsbestlap", sector) + elseif swValue == 6 then + diffTimeFlag = true + lpt = GetPartialTimeInfo("vsoptimallap", sector) + elseif swValue == 7 then + diffTimeFlag = true + lpt = GetPartialTimeInfo("vsoptimalsector", sector) + elseif swValue == 8 then + diffTimeFlag = true + lpt = GetPartialTimeInfo("vssessionbestlap", sector) + elseif swValue == 9 then + diffTimeFlag = true + lpt = GetPartialTimeInfo("vssessionoptimallap", sector) + elseif swValue == 10 then + diffTimeFlag = true + lpt = GetPartialTimeInfo("vssessionoptimalsector", sector) + end + else + lpt = 0.0 + end + + elseif swValue == 11 then + -- real time diff vs your best + diffTimeFlag = true + lpt = GetTimeInfo("realdiffbest") + + elseif swValue == 12 then + -- real time diff vs your last + diffTimeFlag = true + lpt = GetTimeInfo("realdifflast") + + elseif swValue == 13 then + -- current sector time + local sector = GetCarInfo("sector") + lt = GetTimeInfo("laptime") + if sector == 1 then + lpt = lt + elseif sector == 2 then + lpt = lt - GetTimeInfo("sector1") + else + -- sector 3 + lpt = lt - GetTimeInfo("sector1") + GetTimeInfo("sector2") + end + elseif swValue == 14 then + -- best sector 1 + lpt = GetTimeInfo("bestsector1") + + elseif swValue == 15 then + -- best sector 2 + lpt = GetTimeInfo("bestsector2") + + elseif swValue == 16 then + -- last sector 1 + lpt = GetTimeInfo("lastsector1") + + elseif swValue == 17 then + -- last sector 2 + lpt = GetTimeInfo("lastsector2") + + elseif swValue == 18 then + -- position + local pos = GetContextInfo("position") + if pos >= 100 then + rPanel = string.format(" P%03d ", pos ) + else + rPanel = string.format(" P%02d ", pos ) + end + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 19 then + -- get an average consumption of fuel per lap and gives the remaining laps + local remainlapsintank = GetCarInfo("remainlapsintank") + rPanel = string.format(" FL%3.0f", math.floor(remainlapsintank) ) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 20 then + -- speed on right panel + local spd = GetCarInfo("speed") + rPanel = string.format(" %3d ", spd ) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 21 then + -- time remaining if available + lpt = GetTimeInfo("timeremaining") + + -- explod time + hr, mn, sc, hd, ms = timeDispatcher(lpt) + if hr == 0 then + if mn <= 10 then + rPanel = string.format( " -%1d.%02d.%1d", mn, sc, ms) + else + rPanel = string.format( "-%2d.%02d.%1d", mn, sc, ms) + end + elseif hr < 10 then + rPanel = string.format( "%1d:%02d.%02d.%1d", hr, mn, sc, ms) + else + rPanel = string.format( "-%02d.%02d.%1d", hr, mn, sc) + end + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 22 then + -- PC system time + lpt = GetTimeInfo("systemtime") + -- explod time + hr, mn, sc, hd, ms = timeDispatcher(lpt) + rPanel = string.format( "%02dh%02d ", hr, mn) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 23 then + -- rpm:gear + local rpm = GetCarInfo("rpm") + if rpm == nil then + return 1 + end + local gear = GetCarInfo("gear") + if gear ~= nil then + rPanel = string.format("%5d:%d", rpm, gear) + SetRightDigits( rPanel ) + end + return 1 + + elseif swValue == 24 then + -- time elapsed if available + lpt = GetTimeInfo("timetotalelapsed") + + -- explod time + hr, mn, sc, hd, ms = timeDispatcher(lpt) + if hr == 0 then + if mn <= 10 then + rPanel = string.format( " %1d.%02d.%1d", mn, sc, ms) + else + rPanel = string.format( " %2d.%02d.%1d", mn, sc, ms) + end + elseif hr < 10 then + rPanel = string.format( "%1d:%02d.%02d.%1d", hr, mn, sc, ms) + else + rPanel = string.format( " %02d.%02d.%1d", hr, mn, sc) + end + SetRightDigits( rPanel ) + return 1 + elseif swValue == 25 then + -- 25.fuel + local fuel = GetCarInfo("fuel") + if fuel ~= nil then + fuel = GetFuel(fuel, unit) + if fuel >= 100 then + rPanel = string.format(" F%03d ", round(fuel)) + elseif fuel >= 10 then + rPanel = string.format(" F%02d ", round(fuel)) + else + rPanel = string.format(" F%1.1f ", fuel) + end + + SetRightDigits( rPanel ) + return 1 + end + + elseif swValue == 26 then + -- 26.distance + local dist = GetContextInfo("lapdistance") + rPanel = string.format(" %5d", dist ) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 27 then + --27.lap completed + local laps = GetContextInfo("laps") + rPanel = string.format(" %3d ", laps ) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 28 then + --28.total laps + local lpcnt = GetContextInfo("lapscount") + rPanel = string.format(" %3d ", lpcnt ) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 29 then + --29.sector + local sect = GetCarInfo("sector") + -- check if sector > 9 + if sect >9 then + rPanel = string.format(" S%02d ", sect) + else + rPanel = string.format(" S%01d ", sect) + end + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 30 then + --30.kers + local kers = GetCarInfo("kers") + rPanel = string.format(" E%03d ", round(kers/1000) ) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 31 then + --31.kers max + local kmx = GetCarInfo("kersmax") + rPanel = string.format(" E%03d ", round(kmx/1000) ) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 32 then + --32.drs + rPanel = "DrS.OFF" + local drs = GetCarInfo("drs") + if drs >= 1 then + rPanel = "DrS. ON" + end + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 33 then + --33.kers percent + local kers = GetCarInfo("kers") + rPanel = string.format(" %3d ", round((kers/1000)/4)) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 34 then + --34 track size + local trcksz = GetContextInfo("tracksize") + rPanel = string.format("%5d ", trcksz) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 35 then + --35 last sector 1, 2 and 3 + local sector = GetCarInfo("sector") + if sector == 1 then + -- sector 3 + local ls3 = GetTimeInfo("lastsector3") + lpt = ls3 + + elseif sector == 2 then + local ls1 = GetTimeInfo("lastsector1") + lpt = ls1 + else + -- sector 3 + local ls2 = GetTimeInfo("lastsector2") + lpt = ls2 + end + + elseif swValue == 36 then + --36.rpm + local rpm = GetCarInfo("rpm") + rPanel = string.format("%5d ", rpm) + SetRightDigits( rPanel ) + return 1 + + elseif swValue == 37 then + -- real time delta vs last + last sector diff 1, 2 and 3 + diffTimeFlag = true + + lpt = GetDeltaLastTime(false) + + + elseif swValue == 38 then + -- real time delta vs best + last sector diff 1, 2 and 3 + diffTimeFlag = true + + lpt = GetDeltaBestTime(false) + + + elseif swValue == 39 then + -- last sector 3 + lpt = GetTimeInfo("lastsector3") + + elseif swValue == 40 then + -- last sector 3 + lpt = GetTimeInfo("bestsector3") + + elseif swValue == 41 then + -- current sector 1 (rFactor) + lpt = GetTimeInfo("sector1") + + elseif swValue == 42 then + -- current sector 2 (rFactor) + lpt = GetTimeInfo("sector2") + + elseif swValue == 43 then + -- current sector 3 (rFactor) + lpt = GetTimeInfo("sector3") + + elseif swValue == 44 then + -- rfactor real time delta vs last + last sector diff 1, 2 and 3 + diffTimeFlag = true + + lpt = GetDeltaLastTime(true) + + + elseif swValue == 45 then + -- rFactor real time delta vs best + last sector diff 1, 2 and 3 + diffTimeFlag = true + + lpt = GetDeltaBestTime(true) + + elseif swValue == 46 then + -- virtual best lap time + bs1 = GetTimeInfo("bestsector1") + ls1 = GetTimeInfo("lastsector1") + if ls1 < bs1 then s1 = ls1 else s1 = bs1 end + + bs2 = GetTimeInfo("bestsector2") + ls2 = GetTimeInfo("lastsector2") + if ls2 < bs2 then s2 = ls2 else s2 = bs2 end + + bs3 = GetTimeInfo("bestsector3") + ls3 = GetTimeInfo("lastsector3") + if ls3 < bs3 then s3 = ls3 else s3 = bs3 end + + --print ( ls1 , " + " , ls2, " + ", ls3 ) + --print ( bs1 , " + " , bs2, " + ", bs3 ) + lpt = s1 + s2 + s3 + + else + -- none + rPanel = "-:--.---" + SetRightDigits( rPanel ) + return 1 + end + end + + if lpt == nil then return 0 end + + local refreshRate = mRefreshLapTimeRate + if diffTimeFlag then + refreshRate = mDeltaTimeDelay + end + + -- check if diff time is ready + local diffOK = GetTimeInfo("realdifftimeready") + if diffTimeFlag and diffOK == false and dlt == false then + diffTimeFlag = false + rPanel = " -.---" + SetRightDigits( rPanel ) + return 1 + end + + local c = " " + if lpt < 0 then + c = "-" + end + -- explod time + hr, mn, sc, hd, ms = timeDispatcher(lpt) + + -- print("lpt: " .. lpt .. " m: " .. mn .. " - s: " .. sc .. " - ms: " .. ms .. ) + if GetTicks() > ( refreshRate + mDeltaTimeOldTicks ) then + mDeltaTimeOldTicks = GetTicks() + + if diffTimeFlag then + -- + if lpt == -1 or (mn + sc + ms) == 0.0000 then + mDeltaTimeBackup = " --.---" + elseif mn > 0 then + mDeltaTimeBackup = string.format( "%s%02d.%02d.%1d", c, mn, sc, ms) + else + mDeltaTimeBackup = string.format( "%s%02d.%03d", c, sc, ms) + end + + rPanel = mDeltaTimeBackup + + else + --if mTimeBackup == nil then mTimeBackup = 0.0000 end + if lpt == -1 or (mn + sc + ms) == 0.0000 then + mDeltaTimeBackup = "-:--.---" + elseif mn < 10 then + mDeltaTimeBackup = string.format( "%1d:%02d.%03d", mn, sc, ms) + elseif hr > 0 then + mDeltaTimeBackup = string.format( " %02d.%02d ", hr, mn) + else + mDeltaTimeBackup = string.format( " %02d.%02d.%01d", mn, sc, ms) + end + + + end + end + rPanel = mDeltaTimeBackup + -- send time to sli manager + SetRightDigits( rPanel ) + return 1 +end + +print ( "gugus> + slipro digits" ) diff --git a/scripts/gugus/sliproDigits.lua b/scripts/gugus/sliproDigits.lua deleted file mode 100644 index 12c1347..0000000 --- a/scripts/gugus/sliproDigits.lua +++ /dev/null @@ -1,856 +0,0 @@ --- ============================================================ --- Left and Right Panel functions --- ============================================================ - -function leftDigitsEvent(swFunction) - swValue = swFunction + 1 - - local lPanel = "" - local inf = "" - local unit = false - local spd = 0.0 - -- get speed in kph or mph (use "rawspeed" to get value in meter/sec) - local spd = GetCarInfo("speed") - -- get current display unit metric or imperial - unit = GetContextInfo("speedmetric") - -- check if quick info button is down - local qi = false - qi = GetContextInfo("quickinfobutton") - if qi == nil or qi == 0 then qi = false end - if qi then - -- get index for left panel - local qiLeft = GetContextInfo("quickinfoleft") - if qiLeft == nil then qiLeft = 1 end - -- force position to match QI preference - swValue = qiLeft - end - - -- check if PIT Feedback ON - local pf = false - pf = GetContextInfo("pitfeedback") - if pf == nil or pf == 0 then pf = false end - if pf then - -- force position to PIT/SPEED function if car pits - local pit = GetCarInfo("inpits") - if pit > 0 then - swValue = 35 - end - end - - -- get current simulation name - local sim = GetContextInfo("simulation") - - --print ( "swValue: " .. swValue ) - - -- check postion and compute left panel string - if swValue == 1 then - -- speed only - lPanel = string.format(" %3.0f", spd ) - - elseif swValue == 2 then - -- fuel:speed - local fuel = GetCarInfo("fuel") - if fuel ~= nil then - fuel = GetFuel(fuel, unit) - if fuel >= 100 then - -- special case for Euro Truck :) - lPanel = string.format("%03d:%3.0f", round(fuel)%1000, spd) - elseif fuel >= 10 then - lPanel = string.format("F%02d:%3.0f", round(fuel), spd) - elseif fuel >= 1 then - lPanel = string.format("F%1.1f:%3.0f", fuel, spd) - else - lPanel = string.format("F.%02d:%3.0f", fuel * 100, spd ) - end - end - elseif swValue == 3 then - -- position:speed - inf = GetContextInfo("position") - if inf ~= nil then - if inf >= 100 then - lPanel = string.format("%03d:%3.0f", inf, spd) - else - lPanel = string.format("P%02d:%3.0f", inf, spd) - end - end - elseif swValue == 4 then - -- laps completed:speed - inf = GetContextInfo("laps") - if inf ~= nil then - -- if more than 99 laps - if inf >= 100 then - lPanel = string.format("%03d:%3.0f", inf, spd) - else - lPanel = string.format("L%02d:%3.0f", inf, spd) - end - end - elseif swValue == 5 then - -- sector:speed - inf = GetCarInfo("sector") - if inf ~= nil then - -- check if sector > 9 - if inf >9 then - lPanel = string.format("S.%02d:%3.0f", inf, spd) - else - lPanel = string.format(" S.%1d :%3.0f", inf, spd) - end - end - elseif swValue == 6 then - -- laps completed:total laps if available - inf = GetContextInfo("laps") - local tl = GetContextInfo("lapscount") - if tl == nil or tl < 0 or tl > 999 then tl = 0 end - if inf == nil then inf = 0 end - local laps = "L--" - local total = "t--" - - if tl == 0 then - -- if more than 99 laps - if inf >= 100 then - if inf > 999 then inf = 999 end - laps = string.format("%03d", inf ) - else - laps = string.format("L%02d", inf) - end - else - inf = tl - inf - -- display remaining laps - - if inf >= 100 then - if inf > 999 then inf = 999 end - laps = string.format("%03d", inf ) - else - laps = string.format("r%02d", inf) - end - end - - if tl >= 100 then - if tl > 999 then tl = 999 end - total = string.format("%03d", tl) - elseif tl ~= 0 then - total = string.format("t%02d", tl) - end - lPanel = laps .. ":" .. total - - elseif swValue == 7 then - -- water temp - inf = GetCarInfo("watertemp") - if inf ~= nil then - inf = GetTemp(inf, unit) - lPanel = string.format("H2o:%2.1f", inf) - end - elseif swValue == 8 then - -- oil temp - inf = GetCarInfo("oiltemp") - if inf ~= nil then - inf = GetTemp(inf, unit) - lPanel = string.format("OIL:%2.1f", inf) - end - - elseif swValue == 9 then - -- wheels temp if available - inf = GetCarInfo("wheeltempfrontleft") - if inf ~= nil then - -- if rFactor convert Kelvin to Celsius (see global.lua) - if isAppRFactor(sim) then inf = KtoC(inf) end - lPanel = string.format("tFL:%3.0f", inf) - end - elseif swValue == 10 then - inf = GetCarInfo("wheeltempfrontright") - if inf ~= nil then - if isAppRFactor(sim) then inf = KtoC(inf) end - lPanel = string.format("tFr:%3.0f", inf) - end - elseif swValue == 11 then - inf = GetCarInfo("wheeltemprearleft") - if inf ~= nil then - if isAppRFactor(sim) then inf = KtoC(inf) end - lPanel = string.format("trL:%3.0f", inf) - end - elseif swValue == 12 then - inf = GetCarInfo("wheeltemprearright") - if inf ~= nil then - if isAppRFactor(sim) then inf = KtoC(inf) end - lPanel = string.format("trr:%3.0f", inf) - end - - elseif swValue == 13 then - -- wheels pressure if available - inf = GetCarInfo("wheelpressfrontleft") - if inf ~= nil then - -- convert to psi - lPanel = string.format("PFL:%2.1f", inf / 6.88) - end - elseif swValue == 14 then - inf = GetCarInfo("wheelpressfrontright") - if inf ~= nil then - lPanel = string.format("PFr:%2.1f", inf / 6.88) - end - elseif swValue == 15 then - inf = GetCarInfo("wheelpressrearleft") - if inf ~= nil then - lPanel = string.format("PrL:%2.1f", inf / 6.88) - end - elseif swValue == 16 then - inf = GetCarInfo("wheelpressrearright") - if inf ~= nil then - lPanel = string.format("Prr:%2.1f", inf / 6.88) - end - - elseif swValue == 17 then - -- brakes temp if available - inf = GetCarInfo("braketempfrontleft") - if inf ~= nil then - if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end - lPanel = string.format("BFL:%3.0f", inf) - end - elseif swValue == 18 then - inf = GetCarInfo("braketempfrontright") - if inf ~= nil then - if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end - lPanel = string.format("BFr:%3.0f", inf) - end - elseif swValue == 19 then - inf = GetCarInfo("braketemprearleft") - if inf ~= nil then - if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end - lPanel = string.format("BrL:%3.0f", inf) - end - elseif swValue == 20 then - inf = GetCarInfo("braketemprearright") - if inf ~= nil then - if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end - lPanel = string.format("Brr:%3.0f", inf) - end - elseif swValue == 21 then - -- position - local pos = GetContextInfo("position") - lPanel = string.format(" P%02d ", pos ) - - elseif swValue == 22 then - -- get an average consumption of fuel per lap and gives the remaining laps - local remainlapsintank = GetCarInfo("remainlapsintank") - lPanel = string.format(" FL%3.0f", math.floor(remainlapsintank) ) - - elseif swValue == 23 then - -- rpm - local rpm = GetCarInfo("rpm") - lPanel = string.format(" %5d", rpm) - - elseif swValue == 24 then - -- track size - local trcksz = GetContextInfo("tracksize") - lPanel = string.format("%5d ", trcksz) - - elseif swValue == 25 then - -- 25.fuel:consumption - local fuel = GetCarInfo("fuel") - local remainlapsintank = GetCarInfo("remainlapsintank") - - local sFuel = " " - local sRemainLaps = " " - - if fuel ~= nil then - fuel = GetFuel(fuel, unit) - if fuel >= 100 then - -- specific for euro truck :) - sFuel = string.format("%03d", round(fuel) % 1000 ) - elseif fuel >= 10 then - sFuel = string.format("F%02d", round(fuel) ) - elseif fuel >= 1 then - sFuel = string.format("F%1.1f", fuel ) - else - sFuel = string.format("F.%02d", fuel * 100 ) - end - - if remainlapsintank == 0 then - sRemainLaps = "L--" - elseif remainlapsintank >= 100 then - sRemainLaps = "L99" - elseif remainlapsintank >= 10 then - sRemainLaps = string.format("L%02d", math.floor(remainlapsintank)) - else - sRemainLaps = string.format("L%1.1f", remainlapsintank) - end - - lPanel = sFuel .. ":" .. sRemainLaps - end - - elseif swValue == 26 then - -- 26.distance - local dist = GetContextInfo("lapdistance") - lPanel = string.format(" %5d", dist ) - - elseif swValue == 27 then - --27.laps completed:sector - local laps = GetContextInfo("laps") - local sLaps = " " - if laps >= 100 then - sLaps = string.format("%3d", laps ) - else - sLaps = string.format("L%02d", laps ) - end - - local sSector = " " - local sector = GetCarInfo("sector") - if sector ~= nil then - if sector > 9 then - sSector = string.format("S.%02d", sector) - else - sSector = string.format(" S.%1d", sector) - end - end - - lPanel = sLaps .. ":" .. sSector - - - elseif swValue == 28 then - --28.total laps - local lpcnt = GetContextInfo("lapscount") - lPanel = string.format(" t%3d", lpcnt ) - - elseif swValue == 29 then - --29.sector - local sect = GetCarInfo("sector") - -- check if sector > 9 - if sect >9 then - lPanel = string.format(" S.%02d ", sect) - else - lPanel = string.format(" S.%1d ", sect) - end - - elseif swValue == 30 then - --30.kers - local kers = GetCarInfo("kers") - lPanel = string.format(" E:%3d", round(kers/1000)) - - elseif swValue == 31 then - --31.kers max - local kmx = GetCarInfo("kersmax") - lPanel = string.format(" E:%03d", round(kmx/1000)) - - elseif swValue == 32 then - --32.drs - local drs = GetCarInfo("drs") - if drs == 1 then - lPanel = "DrS:ON " - else - lPanel = "DrS:OFF" - end - - elseif swValue == 33 then - --33.kers percent - local kers = GetCarInfo("kers") - lPanel = string.format(" E:%3d", round((kers/1000)/4)) - - elseif swValue == 34 then - --33.kers percent:speed - local kers = GetCarInfo("kers") - lPanel = string.format("%3d:%3.0f", round((kers/1000)/4), spd) - - elseif swValue == 35 then - -- PIT - lPanel = " PIt " - - elseif swValue == 36 then - -- sc - local sc = GetContextInfo("safetycar") - if sc == 1 then - lPanel = "SaFETy" - else - lPanel = " " - end - - else - lPanel = "-:--.---" - end - -- send string to sli manager - SetLeftDigits( lPanel ) - return 1 -end - - - - - - - - - - - --- ============================================================ --- Left and Right Panel functions --- ============================================================ - -function rightDigitsEvent(swFunction) - swValue = swFunction + 1 - - local hr = 0 - local mn = 0 - local sc = 0 - local ms = 0 - local hd = 0 - local rPanel = "" - local lpt = nil - local diffTimeFlag = false - local unit = false - - -- is OSP Tracking ON - local ospt = false - ospt = GetContextInfo("osptracking") - if ospt == nil then ospt = false end - if ospt then - swValue = 23 - end - - -- lap finished, display lap time a few seconds - --local dlt = false - --dlt = GetContextInfo("displaylaptime") - --if dlt == nil then dlt = false end - --if dlt and swValue ~= 37 and swValue ~= 38 then - -- swValue = 3 - --end - - -- check if quick info button is down - local qi = false - qi = GetContextInfo("quickinfobutton") - if qi == nil or qi == 0 then qi = false end - if qi then - -- get index for right panel - local qiRight = GetContextInfo("quickinforight") - if qiRight == nil then qiRight = 1 end - swValue = qiRight - end - -- get current display unit metric or imperial - unit = GetContextInfo("speedmetric") - - -- check if PIT Feedback ON - local pf = false - pf = GetContextInfo("pitfeedback") - if pf == nil or pf == 0 then pf = false end - if pf then - -- force position to SPEED function - local pit = GetCarInfo("inpits") - if pit > 0 then - swValue = 20 - end - end - - --print ( "swValue: " .. swValue ) - - -- get sim name - local sim = GetContextInfo("simulation") - if sim ~= nil then - if swValue == 1 then - -- current lap time - lpt = GetTimeInfo("laptime") - - elseif swValue == 2 then - -- best lap time (PB) - lpt = GetTimeInfo("bestlaptime") - - elseif swValue == 3 then - -- last lap time - lpt = GetTimeInfo("lastlaptime") - - elseif swValue >= 4 and swValue <= 10 and isAppIRacing(sim) then - -- iRacing partials - local ts = GetContextInfo("partialcount") - local sector = GetCarInfo("sector") - if ts ~= nil and ts > 0 then - if swValue == 4 then - lpt = GetPartialTimeInfo("currentpartial", sector) - elseif swValue == 5 then - diffTimeFlag = true - lpt = GetPartialTimeInfo("vsbestlap", sector) - elseif swValue == 6 then - diffTimeFlag = true - lpt = GetPartialTimeInfo("vsoptimallap", sector) - elseif swValue == 7 then - diffTimeFlag = true - lpt = GetPartialTimeInfo("vsoptimalsector", sector) - elseif swValue == 8 then - diffTimeFlag = true - lpt = GetPartialTimeInfo("vssessionbestlap", sector) - elseif swValue == 9 then - diffTimeFlag = true - lpt = GetPartialTimeInfo("vssessionoptimallap", sector) - elseif swValue == 10 then - diffTimeFlag = true - lpt = GetPartialTimeInfo("vssessionoptimalsector", sector) - end - else - lpt = 0.0 - end - - elseif swValue == 11 then - -- real time diff vs your best - diffTimeFlag = true - lpt = GetTimeInfo("realdiffbest") - - elseif swValue == 12 then - -- real time diff vs your last - diffTimeFlag = true - lpt = GetTimeInfo("realdifflast") - - elseif swValue == 13 then - -- current sector time - local sector = GetCarInfo("sector") - lt = GetTimeInfo("laptime") - if sector == 1 then - lpt = lt - elseif sector == 2 then - lpt = lt - GetTimeInfo("sector1") - else - -- sector 3 - lpt = lt - GetTimeInfo("sector1") + GetTimeInfo("sector2") - end - elseif swValue == 14 then - -- best sector 1 - lpt = GetTimeInfo("bestsector1") - - elseif swValue == 15 then - -- best sector 2 - lpt = GetTimeInfo("bestsector2") - - elseif swValue == 16 then - -- last sector 1 - lpt = GetTimeInfo("lastsector1") - - elseif swValue == 17 then - -- last sector 2 - lpt = GetTimeInfo("lastsector2") - - elseif swValue == 18 then - -- position - local pos = GetContextInfo("position") - if pos >= 100 then - rPanel = string.format(" P%03d ", pos ) - else - rPanel = string.format(" P%02d ", pos ) - end - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 19 then - -- get an average consumption of fuel per lap and gives the remaining laps - local remainlapsintank = GetCarInfo("remainlapsintank") - rPanel = string.format(" FL%3.0f", math.floor(remainlapsintank) ) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 20 then - -- speed on right panel - local spd = GetCarInfo("speed") - rPanel = string.format(" %3d ", spd ) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 21 then - -- time remaining if available - lpt = GetTimeInfo("timeremaining") - - -- explod time - hr, mn, sc, hd, ms = timeDispatcher(lpt) - if hr == 0 then - if mn <= 10 then - rPanel = string.format( " -%1d.%02d.%1d", mn, sc, ms) - else - rPanel = string.format( "-%2d.%02d.%1d", mn, sc, ms) - end - elseif hr < 10 then - rPanel = string.format( "%1d:%02d.%02d.%1d", hr, mn, sc, ms) - else - rPanel = string.format( "-%02d.%02d.%1d", hr, mn, sc) - end - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 22 then - -- PC system time - lpt = GetTimeInfo("systemtime") - -- explod time - hr, mn, sc, hd, ms = timeDispatcher(lpt) - rPanel = string.format( "%02dh%02d ", hr, mn) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 23 then - -- rpm:gear - local rpm = GetCarInfo("rpm") - if rpm == nil then - return 1 - end - local gear = GetCarInfo("gear") - if gear ~= nil then - rPanel = string.format("%5d:%d", rpm, gear) - SetRightDigits( rPanel ) - end - return 1 - - elseif swValue == 24 then - -- time elapsed if available - lpt = GetTimeInfo("timetotalelapsed") - - -- explod time - hr, mn, sc, hd, ms = timeDispatcher(lpt) - if hr == 0 then - if mn <= 10 then - rPanel = string.format( " %1d.%02d.%1d", mn, sc, ms) - else - rPanel = string.format( " %2d.%02d.%1d", mn, sc, ms) - end - elseif hr < 10 then - rPanel = string.format( "%1d:%02d.%02d.%1d", hr, mn, sc, ms) - else - rPanel = string.format( " %02d.%02d.%1d", hr, mn, sc) - end - SetRightDigits( rPanel ) - return 1 - elseif swValue == 25 then - -- 25.fuel - local fuel = GetCarInfo("fuel") - if fuel ~= nil then - fuel = GetFuel(fuel, unit) - if fuel >= 100 then - rPanel = string.format(" F%03d ", round(fuel)) - elseif fuel >= 10 then - rPanel = string.format(" F%02d ", round(fuel)) - else - rPanel = string.format(" F%1.1f ", fuel) - end - - SetRightDigits( rPanel ) - return 1 - end - - elseif swValue == 26 then - -- 26.distance - local dist = GetContextInfo("lapdistance") - rPanel = string.format(" %5d", dist ) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 27 then - --27.lap completed - local laps = GetContextInfo("laps") - rPanel = string.format(" %3d ", laps ) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 28 then - --28.total laps - local lpcnt = GetContextInfo("lapscount") - rPanel = string.format(" %3d ", lpcnt ) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 29 then - --29.sector - local sect = GetCarInfo("sector") - -- check if sector > 9 - if sect >9 then - rPanel = string.format(" S%02d ", sect) - else - rPanel = string.format(" S%01d ", sect) - end - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 30 then - --30.kers - local kers = GetCarInfo("kers") - rPanel = string.format(" E%03d ", round(kers/1000) ) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 31 then - --31.kers max - local kmx = GetCarInfo("kersmax") - rPanel = string.format(" E%03d ", round(kmx/1000) ) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 32 then - --32.drs - rPanel = "DrS.OFF" - local drs = GetCarInfo("drs") - if drs >= 1 then - rPanel = "DrS. ON" - end - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 33 then - --33.kers percent - local kers = GetCarInfo("kers") - rPanel = string.format(" %3d ", round((kers/1000)/4)) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 34 then - --34 track size - local trcksz = GetContextInfo("tracksize") - rPanel = string.format("%5d ", trcksz) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 35 then - --35 last sector 1, 2 and 3 - local sector = GetCarInfo("sector") - if sector == 1 then - -- sector 3 - local ls3 = GetTimeInfo("lastsector3") - lpt = ls3 - - elseif sector == 2 then - local ls1 = GetTimeInfo("lastsector1") - lpt = ls1 - else - -- sector 3 - local ls2 = GetTimeInfo("lastsector2") - lpt = ls2 - end - - elseif swValue == 36 then - --36.rpm - local rpm = GetCarInfo("rpm") - rPanel = string.format("%5d ", rpm) - SetRightDigits( rPanel ) - return 1 - - elseif swValue == 37 then - -- real time delta vs last + last sector diff 1, 2 and 3 - diffTimeFlag = true - - lpt = GetDeltaLastTime(false) - - - elseif swValue == 38 then - -- real time delta vs best + last sector diff 1, 2 and 3 - diffTimeFlag = true - - lpt = GetDeltaBestTime(false) - - - elseif swValue == 39 then - -- last sector 3 - lpt = GetTimeInfo("lastsector3") - - elseif swValue == 40 then - -- last sector 3 - lpt = GetTimeInfo("bestsector3") - - elseif swValue == 41 then - -- current sector 1 (rFactor) - lpt = GetTimeInfo("sector1") - - elseif swValue == 42 then - -- current sector 2 (rFactor) - lpt = GetTimeInfo("sector2") - - elseif swValue == 43 then - -- current sector 3 (rFactor) - lpt = GetTimeInfo("sector3") - - elseif swValue == 44 then - -- rfactor real time delta vs last + last sector diff 1, 2 and 3 - diffTimeFlag = true - - lpt = GetDeltaLastTime(true) - - - elseif swValue == 45 then - -- rFactor real time delta vs best + last sector diff 1, 2 and 3 - diffTimeFlag = true - - lpt = GetDeltaBestTime(true) - - elseif swValue == 46 then - -- virtual best lap time - bs1 = GetTimeInfo("bestsector1") - ls1 = GetTimeInfo("lastsector1") - if ls1 < bs1 then s1 = ls1 else s1 = bs1 end - - bs2 = GetTimeInfo("bestsector2") - ls2 = GetTimeInfo("lastsector2") - if ls2 < bs2 then s2 = ls2 else s2 = bs2 end - - bs3 = GetTimeInfo("bestsector3") - ls3 = GetTimeInfo("lastsector3") - if ls3 < bs3 then s3 = ls3 else s3 = bs3 end - - --print ( ls1 , " + " , ls2, " + ", ls3 ) - --print ( bs1 , " + " , bs2, " + ", bs3 ) - lpt = s1 + s2 + s3 - - else - -- none - rPanel = "-:--.---" - SetRightDigits( rPanel ) - return 1 - end - end - - if lpt == nil then return 0 end - - local refreshRate = mRefreshLapTimeRate - if diffTimeFlag then - refreshRate = mDeltaTimeDelay - end - - -- check if diff time is ready - local diffOK = GetTimeInfo("realdifftimeready") - if diffTimeFlag and diffOK == false and dlt == false then - diffTimeFlag = false - rPanel = " -.---" - SetRightDigits( rPanel ) - return 1 - end - - local c = " " - if lpt < 0 then - c = "-" - end - -- explod time - hr, mn, sc, hd, ms = timeDispatcher(lpt) - - -- print("lpt: " .. lpt .. " m: " .. mn .. " - s: " .. sc .. " - ms: " .. ms .. ) - if GetTicks() > ( refreshRate + mDeltaTimeOldTicks ) then - mDeltaTimeOldTicks = GetTicks() - - if diffTimeFlag then - -- - if lpt == -1 or (mn + sc + ms) == 0.0000 then - mDeltaTimeBackup = " --.---" - elseif mn > 0 then - mDeltaTimeBackup = string.format( "%s%02d.%02d.%1d", c, mn, sc, ms) - else - mDeltaTimeBackup = string.format( "%s%02d.%03d", c, sc, ms) - end - - rPanel = mDeltaTimeBackup - - else - --if mTimeBackup == nil then mTimeBackup = 0.0000 end - if lpt == -1 or (mn + sc + ms) == 0.0000 then - mDeltaTimeBackup = "-:--.---" - elseif mn < 10 then - mDeltaTimeBackup = string.format( "%1d:%02d.%03d", mn, sc, ms) - elseif hr > 0 then - mDeltaTimeBackup = string.format( " %02d.%02d ", hr, mn) - else - mDeltaTimeBackup = string.format( " %02d.%02d.%01d", mn, sc, ms) - end - - - end - end - rPanel = mDeltaTimeBackup - -- send time to sli manager - SetRightDigits( rPanel ) - return 1 -end - -print ( "gugus> + slipro digits" ) diff --git a/scripts/slipro_gus.lua b/scripts/slipro_gus.lua index 573194e..135b846 100644 --- a/scripts/slipro_gus.lua +++ b/scripts/slipro_gus.lua @@ -1,8 +1,8 @@ print ( "gugus> Loading specific scripts" ) -require "scripts/gugus/enterExit" +require "scripts/gugus/session" require "scripts/gugus/controls" -require "scripts/gugus/sliproDigits" +require "scripts/gugus/slipro" require "scripts/gugus/speedlimiter" require "scripts/gugus/gear" -- cgit v1.2.3