From bd4acb769e46f52c03098e4cd97aae897073002c Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 27 Nov 2013 09:59:26 +0100 Subject: [gugus] new slipro digits managment --- scripts/gugus/digits.lua | 376 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 376 insertions(+) create mode 100644 scripts/gugus/digits.lua (limited to 'scripts/gugus/digits.lua') diff --git a/scripts/gugus/digits.lua b/scripts/gugus/digits.lua new file mode 100644 index 0000000..27bde1d --- /dev/null +++ b/scripts/gugus/digits.lua @@ -0,0 +1,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" ) -- cgit v1.2.3