summaryrefslogtreecommitdiff
path: root/scripts/zdoc_scripts/iracing_stuff.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/zdoc_scripts/iracing_stuff.lua')
-rw-r--r--scripts/zdoc_scripts/iracing_stuff.lua1068
1 files changed, 534 insertions, 534 deletions
diff --git a/scripts/zdoc_scripts/iracing_stuff.lua b/scripts/zdoc_scripts/iracing_stuff.lua
index ee942d6..d0df9db 100644
--- a/scripts/zdoc_scripts/iracing_stuff.lua
+++ b/scripts/zdoc_scripts/iracing_stuff.lua
@@ -1,535 +1,535 @@
--- Custom SLIMax Manager Scripts for iRacing v3.2.1
--- Copyright ©2012-2013 by Zappadoc
--- _last change by Zappadoc - 2013-10
-
--- =====================================
--- iRacing Stuff script
--- define car setup function and all pit limiter and shiftlights methods for each car you drive
-function iRacing_DebugCarInfo(deviceType)
- -- see debug console window
- -- get car name
- local dev = GetDeviceType(deviceType)
- local cNm = GetContextInfo("carname")
- local mxG = GetCarInfo("maxgear")
- local rdz = GetCarInfo("redzone")
- local ospf = GetContextInfo("ospfactor")
- print("\n----------\nDevice:"..dev.."\nSetup car:" .. cNm .. "(" .. rdz .. ")" .. "\nMaxGear:" .. mxG .. "\nOSP Factor:" .. ospf .. "\n");
-end
-
-function iRacing_InitGearEvent(gear)
- -- get current simulation name
- -- custom script to overwrite OSP value and OSP limit for each gear of each iRacing car
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- if gOldGear == nil then gOldGear = -2 end
- -- setup iRacing car OSP, RedZone, Max gear, ...
- iRacing_CarSetup(gear)
- if gear ~= gOldGear then
- gOldGear = gear
- end
- end
-end
-
-function iRacing_CarSetup(cGear)
- -- get car name
- local cNm = ""
- cNm = GetContextInfo("carname")
- local mxG = 4
- local ospf = 140
-
- if cNm == "cadillacctsvr" then
- mxG = 6
- ospf = 148
-
- elseif cNm == "mclarenmp4" then
- mxG = 6
- ospf = 150
-
- elseif cNm == "kiaoptima" then
- mxG = 5
- ospf = 150
-
- elseif cNm == "formulamazda" then
- mxG = 6
- ospf = 60
-
- elseif cNm == "williamsfw31" then
- mxG = 7
- ospf = 90
-
- elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
- mxG = 6
- ospf = 140
-
- elseif cNm == "hpdarx01c" then
- mxG = 6
- if cGear <= 2 then
- ospf = 10
- gOSPLimit = 9900
- gRedZone = 9920
- elseif cGear ==3 then
- ospf = 100
- gOSPLimit = 9530
- gRedZone = 9545
- elseif cGear == 4 then
- ospf = 90
- gOSPLimit = 9500
- gRedZone = 9510
- else
- ospf = 150
- gOSPLimit = 9420
- gRedZone = 9425
- end
-
-
- elseif cNm == "fordgt" then
- mxG = 6
- ospf = 128
-
- elseif cNm == "fr500s" then
- mxG = 6
- ospf = 150
-
- elseif cNm == "fordv8sc" then
- mxG = 6
- ospf = 100
-
- elseif cNm == "dallara" then
- mxG = 6
- ospf = 95
-
- elseif cNm == "latemodel" then
- mxG = 5
-
- elseif cNm == "legends ford34c" then
- mxG = 5
- ospf = 150
-
- elseif cNm == "skmodified" then
- mxG = 6
-
- elseif cNm == "silvercrown" then
- mxG = 6
-
- elseif cNm == "trucks silverado" then
- mxG = 4
-
- elseif cNm == "stockcars impala" then
- mxG = 4
- ospf = 140
-
- elseif cNm == "lotus79" then
- mxG = 5
- ospf = 100
-
- elseif cNm == "stockcars2 chevy" then
- mxG = 4
- ospf = 130
-
- elseif cNm == "stockcars2 chevy cot" then
- mxG = 4
- ospf = 150
-
- elseif cNm == "c6r" then
- mxG = 6
- ospf = 145
-
- elseif cNm == "solstice" then
- mxG = 5
- ospf = 150
-
- elseif cNm == "jettatdi" then
- mxG = 5
-
- elseif cNm == "radical sr8" then
- mxG = 6
- ospf = 115
-
- elseif cNm == "rt2000" then
- mxG = 5
- ospf = 140
-
- elseif cNm == "specracer" then
- mxG = 5
- ospf = 140
-
- elseif cNm == "rileydp" then
- mxG = 5
- ospf = 85
-
- elseif cNm == "streetstock" then
- mxG = 4
- ospf = 150
-
- elseif cNm == "sprint" then
- mxG = 6
-
- else
- -- default
- mxG = 4
- ospf = 150
- end
- -- set max gear and OSP factor for this car
- SetMaxGear(mxG)
- SetOSPFactor(ospf)
-end
-
-function FixRPMSpeedlimiter()
- local led = ""
- -- init table
- initLedTable(mRPMLedTable, 0)
- SetRPMLed("mRPMLedTable")
- for i = 0,14 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- SetRPMLed("mRPMLedTable")
-
-end
-
-function iRacing_spdLmtMethodEvent(idx, deviceType)
- local led = ""
-
- -- get car name
- local cNm = GetContextInfo("carname")
-
- -- speedlimiter stuff
- if cNm == "formulamazda" then
- mSpdLimitMethod = 2
-
- elseif cNm == "mclarenmp4" then
- mSpdLimitMethod = 2
-
- elseif cNm == "williamsfw31" then
- -- speedlimiter led fixed + digits blinking, method 6
- mSpdLimitMethod = 5
-
- elseif cNm == "fordv8sc" then
- mSpdLimitMethod = 2
-
- elseif cNm == "dallara" then
- mSpdLimitMethod = 2
-
- elseif cNm == "fordgt" then
- mSpdLimitMethod = 2
-
- elseif cNm == "hpdarx01c" then
- FixRPMSpeedlimiter()
- return 1
-
- elseif cNm == "rileydp" then
- mSpdLimitMethod = 2
-
- elseif cNm == "c6r" then
- FixRPMSpeedlimiter()
- return 1
-
- elseif cNm == "radical sr8" then
- mSpdLimitMethod = 0
-
- elseif cNm == "jettatdi" then
- mSpdLimitMethod = 2
-
- elseif cNm == "cadillacctsvr" then
- FixRPMSpeedlimiter()
- return 1
-
- -- cars with without dashboardleds
- -- elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
- -- elseif cNm == "fr500s" then
- -- elseif cNm == "latemodel" then
- -- elseif cNm == "legends ford34c" then
- -- elseif cNm == "legends ford34c rookie" then
- -- elseif cNm == "skmodified" then
- -- elseif cNm == "silvercrown" then
- -- elseif cNm == "trucks silverado" then
- -- elseif cNm == "stockcars impala" then
- -- elseif cNm == "lotus79" then
- -- elseif cNm == "stockcars2 chevy" then
- -- elseif cNm == "solstice" then
- -- elseif cNm == "solstice rookie" then
- -- elseif cNm == "rt2000" then
- -- elseif cNm == "specracer" then
- -- elseif cNm == "streetstock" then
- -- elseif cNm == "sprint" then
-
- else
- -- default
- mSpdLimitMethod = 0
-
- end
- return 2
-end
-
-function iRacing_shiftLightsMethodEvent(idx, dev)
- -- rpm table name
- local tName = "mRPMLedTable"
- -- get rpm
- local rpm = 0
- rpm = GetCarInfo("rpm")
- if rpm == nil then rpm = 0 end
-
- -- check redzone value
- if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
-
- -- get car name
- local cNm = GetContextInfo("carname")
-
- local isPit = GetCarInfo("inpits")
- local carspd = GetCarInfo("rawspeed")
-
- -- init leds (see global.lua)
- initLedTable(mRPMLedTable, 0)
-
- -- Pits Stuff
- if isPit == 1 and carspd == 0 then
- -- pit stop
-
- elseif isPit >= 1 and carspd > 21 then
- -- car Approaching pits (or in pit lane) and exceed 45 mph
- -- set the red zone to the current engine rpm (This sets the shiftlights to the max and warns the driver)
- local spdLmt = GetCarInfo("speedlimiter")
- if spdLmt == 0 then
- -- if speedlimiter is OFF
- gRedZone = rpm
- end
- end
-
- -- get device type
- if dev == nil then dev = "none" end
-
- -- shiftlights stuff
- if cNm == "formulamazda" then
- -- start Mazda shiftlights
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 95, 96, 97 ,98 ,99 ,99.5)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 94, 94.5, 95, 96, 97 ,98 ,99 ,99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5)
- end
- elseif cNm == "mclarenmp4" then
- local gear = GetCarInfo("gear")
- if gear == 6 then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 6300, 6350, 6400, 6490, 6580, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
- else
- ProgressiveFixedSLI(rpm, 6300, 6490, 6580, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
- end
- else
- if dev == "FANATEC" then
- RpmFanatec(rpm, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 6200, 6250, 6300, 6390, 6480, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
- else
- ProgressiveFixedSLI(rpm, 6200, 6390, 6480, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
- end
- end
-
- elseif cNm == "williamsfw31" then
- if dev == "FANATEC" then
- AlternateFanatec(rpm, gRedZone, 7.0, 8.0, 8.9)
- elseif dev == "SRDLX" then
- AlternateSRDlx(rpm, gRedZone, 8.0, 9.0, 9.9)
- elseif dev == "SRF1" then
- AlternateSRF1(rpm, gRedZone, 12.0, 13.0, 14.9)
- else
- AlternateSLI(rpm, gRedZone, 11.0, 12.0, 12.9)
- end
-
- elseif cNm == "kiaoptima" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 90, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99)
- end
-
- elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 90, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99)
- end
-
- elseif cNm == "fr500s" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 86, 88 ,90 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 84, 86, 88 ,90 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
- end
-
- elseif cNm == "fordv8sc" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 92, 94 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 90, 92, 94 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 87, 90, 92, 94 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 87, 90, 92, 94 ,97 ,98 ,99)
- end
-
- elseif cNm == "dallara" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 90, 94 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 82, 90, 94 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 78, 82, 90, 94 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 78, 82, 90, 94 ,97 ,98 ,99)
- end
-
- elseif cNm == "fordgt" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 94, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 93, 94, 95, 96 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 93, 94, 95, 96 ,97 ,98 ,99)
- end
-
- elseif cNm == "hpdarx01c" then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 7800, 7840, 7890, 7900, 8100, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
- else
- ProgressiveFixedSLI(rpm, 7800, 7900, 8100, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
- end
-
- elseif cNm == "rileydp" then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 10000, 10000, 6700, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000, 10000, 10000)
- else
- ProgressiveFixedSLI(rpm, 10000, 6700, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000, 10000)
- end
-
- elseif cNm == "c6r" then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 5000, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 4700, 4800, 4900, 5000, 5040, 5190, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
- else
- ProgressiveFixedSLI(rpm, 4700, 4800, 4900, 5000, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
- end
-
- elseif cNm == "radical sr8" then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 4350, 4800, 5100, 5300, 5500, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
- else
- ProgressiveFixedSLI(rpm, 4350, 4800, 5100, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
- end
-
- elseif cNm == "jettatdi" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 86, 88 ,90 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 84, 86, 88 ,90 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
- end
-
- elseif cNm == "cadillacctsvr" then
- --ProgressiveFixedSLI(rpm, 6500, 6580, 6600, 6700, 6800 , 6900 , 7000 , 7100, 7200, 7300, 7400, 7500, 7600)
- if dev == "FANATEC" then
- ProgressiveFanatec(rpm, gRedZone, 7.9, 8.15, 8.2, 8.25, 8.3, 8.35, 8.5, 8.8, 8.98 )
- elseif dev == "SRDLX" then
- ProgressiveSRDlx(rpm, gRedZone, 8.5, 8.9, 9.15, 9.2, 9.25, 9.3, 9.35, 9.5, 9.8, 9.98 )
- elseif dev == "SRF1" then
- ProgressiveSRF1(rpm, gRedZone, 13.8, 13.85, 13.9, 13.95, 13.98, 14, 14.1, 14.15, 14.2, 14.25, 14.3, 14.35, 14.5, 14.8, 14.98 )
- else
- ProgressiveSLI(rpm, gRedZone, 11.9, 11.95, 11.98, 12, 12.1, 12.15, 12.2, 12.25, 12.3, 12.35, 12.5, 12.8, 12.98 )
- end
-
- -- progressive default method for all cars with dashboard without leds
- -- elseif cNm == "latemodel" then
- -- elseif cNm == "legends ford34c" then
- -- elseif cNm == "legends ford34c rookie" then
- -- elseif cNm == "skmodified" then
- -- elseif cNm == "silvercrown" then
- -- elseif cNm == "trucks silverado" then
- -- elseif cNm == "stockcars impala" then
- -- elseif cNm == "lotus79" then
- -- elseif cNm == "stockcars2 chevy" then
- -- elseif cNm == "solstice" then
- -- elseif cNm == "solstice rookie" then
- -- elseif cNm == "rt2000" then
- -- elseif cNm == "specracer" then
- -- elseif cNm == "streetstock" then
- -- elseif cNm == "sprint" then
-
- else
- -- default
- if dev == "FANATEC" then
- ProgressiveFanatec(rpm, gRedZone, 4.5, 5, 6.5, 7, 7.5, 8, 8.5, 8.8, 8.98 )
- elseif dev == "SRDLX" then
- ProgressiveSRDlx(rpm, gRedZone, 5.0, 5.5, 6, 7.5, 8, 8.5, 9, 9.5, 9.8, 9.98 )
- elseif dev == "SRF1" then
- ProgressiveSRF1(rpm, gRedZone, 9.0, 9.5, 9.8, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 14.8, 14.98 )
- else
- ProgressiveSLI(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 12.8, 12.98 )
- end
- end
-
- -- set leds
- SetRPMLed(tName)
-end
-
-function iRacing_ospMethodEvent(idx, deviceType)
- -- get car name
- local cNm = GetContextInfo("carname")
- -- OSP Method stuff
- if mOSPMethod ~= nil then
- if cNm == "mclarenmp4" or cNm == "williamsfw31" then
- if deviceType == "FANATEC" then
- mOSPMethod = 1
- else
- mOSPMethod = 3
- end
-
- -- else
- -- -- default
- -- if deviceType == "FANATEC" then
- -- mOSPMethod = 1
- -- end
- end
- end
- return 2
+-- Custom SLIMax Manager Scripts for iRacing v3.2.1
+-- Copyright ©2012-2013 by Zappadoc
+-- _last change by Zappadoc - 2013-10
+
+-- =====================================
+-- iRacing Stuff script
+-- define car setup function and all pit limiter and shiftlights methods for each car you drive
+function iRacing_DebugCarInfo(deviceType)
+ -- see debug console window
+ -- get car name
+ local dev = GetDeviceType(deviceType)
+ local cNm = GetContextInfo("carname")
+ local mxG = GetCarInfo("maxgear")
+ local rdz = GetCarInfo("redzone")
+ local ospf = GetContextInfo("ospfactor")
+ print("\n----------\nDevice:"..dev.."\nSetup car:" .. cNm .. "(" .. rdz .. ")" .. "\nMaxGear:" .. mxG .. "\nOSP Factor:" .. ospf .. "\n");
+end
+
+function iRacing_InitGearEvent(gear)
+ -- get current simulation name
+ -- custom script to overwrite OSP value and OSP limit for each gear of each iRacing car
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim) then
+ if gOldGear == nil then gOldGear = -2 end
+ -- setup iRacing car OSP, RedZone, Max gear, ...
+ iRacing_CarSetup(gear)
+ if gear ~= gOldGear then
+ gOldGear = gear
+ end
+ end
+end
+
+function iRacing_CarSetup(cGear)
+ -- get car name
+ local cNm = ""
+ cNm = GetContextInfo("carname")
+ local mxG = 4
+ local ospf = 140
+
+ if cNm == "cadillacctsvr" then
+ mxG = 6
+ ospf = 148
+
+ elseif cNm == "mclarenmp4" then
+ mxG = 6
+ ospf = 150
+
+ elseif cNm == "kiaoptima" then
+ mxG = 5
+ ospf = 150
+
+ elseif cNm == "formulamazda" then
+ mxG = 6
+ ospf = 60
+
+ elseif cNm == "williamsfw31" then
+ mxG = 7
+ ospf = 90
+
+ elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
+ mxG = 6
+ ospf = 140
+
+ elseif cNm == "hpdarx01c" then
+ mxG = 6
+ if cGear <= 2 then
+ ospf = 10
+ gOSPLimit = 9900
+ gRedZone = 9920
+ elseif cGear ==3 then
+ ospf = 100
+ gOSPLimit = 9530
+ gRedZone = 9545
+ elseif cGear == 4 then
+ ospf = 90
+ gOSPLimit = 9500
+ gRedZone = 9510
+ else
+ ospf = 150
+ gOSPLimit = 9420
+ gRedZone = 9425
+ end
+
+
+ elseif cNm == "fordgt" then
+ mxG = 6
+ ospf = 128
+
+ elseif cNm == "fr500s" then
+ mxG = 6
+ ospf = 150
+
+ elseif cNm == "fordv8sc" then
+ mxG = 6
+ ospf = 100
+
+ elseif cNm == "dallara" then
+ mxG = 6
+ ospf = 95
+
+ elseif cNm == "latemodel" then
+ mxG = 5
+
+ elseif cNm == "legends ford34c" then
+ mxG = 5
+ ospf = 150
+
+ elseif cNm == "skmodified" then
+ mxG = 6
+
+ elseif cNm == "silvercrown" then
+ mxG = 6
+
+ elseif cNm == "trucks silverado" then
+ mxG = 4
+
+ elseif cNm == "stockcars impala" then
+ mxG = 4
+ ospf = 140
+
+ elseif cNm == "lotus79" then
+ mxG = 5
+ ospf = 100
+
+ elseif cNm == "stockcars2 chevy" then
+ mxG = 4
+ ospf = 130
+
+ elseif cNm == "stockcars2 chevy cot" then
+ mxG = 4
+ ospf = 150
+
+ elseif cNm == "c6r" then
+ mxG = 6
+ ospf = 145
+
+ elseif cNm == "solstice" then
+ mxG = 5
+ ospf = 150
+
+ elseif cNm == "jettatdi" then
+ mxG = 5
+
+ elseif cNm == "radical sr8" then
+ mxG = 6
+ ospf = 115
+
+ elseif cNm == "rt2000" then
+ mxG = 5
+ ospf = 140
+
+ elseif cNm == "specracer" then
+ mxG = 5
+ ospf = 140
+
+ elseif cNm == "rileydp" then
+ mxG = 5
+ ospf = 85
+
+ elseif cNm == "streetstock" then
+ mxG = 4
+ ospf = 150
+
+ elseif cNm == "sprint" then
+ mxG = 6
+
+ else
+ -- default
+ mxG = 4
+ ospf = 150
+ end
+ -- set max gear and OSP factor for this car
+ SetMaxGear(mxG)
+ SetOSPFactor(ospf)
+end
+
+function FixRPMSpeedlimiter()
+ local led = ""
+ -- init table
+ initLedTable(mRPMLedTable, 0)
+ SetRPMLed("mRPMLedTable")
+ for i = 0,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+
+end
+
+function iRacing_spdLmtMethodEvent(idx, deviceType)
+ local led = ""
+
+ -- get car name
+ local cNm = GetContextInfo("carname")
+
+ -- speedlimiter stuff
+ if cNm == "formulamazda" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "mclarenmp4" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "williamsfw31" then
+ -- speedlimiter led fixed + digits blinking, method 6
+ mSpdLimitMethod = 5
+
+ elseif cNm == "fordv8sc" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "dallara" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "fordgt" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "hpdarx01c" then
+ FixRPMSpeedlimiter()
+ return 1
+
+ elseif cNm == "rileydp" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "c6r" then
+ FixRPMSpeedlimiter()
+ return 1
+
+ elseif cNm == "radical sr8" then
+ mSpdLimitMethod = 0
+
+ elseif cNm == "jettatdi" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "cadillacctsvr" then
+ FixRPMSpeedlimiter()
+ return 1
+
+ -- cars with without dashboardleds
+ -- elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
+ -- elseif cNm == "fr500s" then
+ -- elseif cNm == "latemodel" then
+ -- elseif cNm == "legends ford34c" then
+ -- elseif cNm == "legends ford34c rookie" then
+ -- elseif cNm == "skmodified" then
+ -- elseif cNm == "silvercrown" then
+ -- elseif cNm == "trucks silverado" then
+ -- elseif cNm == "stockcars impala" then
+ -- elseif cNm == "lotus79" then
+ -- elseif cNm == "stockcars2 chevy" then
+ -- elseif cNm == "solstice" then
+ -- elseif cNm == "solstice rookie" then
+ -- elseif cNm == "rt2000" then
+ -- elseif cNm == "specracer" then
+ -- elseif cNm == "streetstock" then
+ -- elseif cNm == "sprint" then
+
+ else
+ -- default
+ mSpdLimitMethod = 0
+
+ end
+ return 2
+end
+
+function iRacing_shiftLightsMethodEvent(idx, dev)
+ -- rpm table name
+ local tName = "mRPMLedTable"
+ -- get rpm
+ local rpm = 0
+ rpm = GetCarInfo("rpm")
+ if rpm == nil then rpm = 0 end
+
+ -- check redzone value
+ if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
+
+ -- get car name
+ local cNm = GetContextInfo("carname")
+
+ local isPit = GetCarInfo("inpits")
+ local carspd = GetCarInfo("rawspeed")
+
+ -- init leds (see global.lua)
+ initLedTable(mRPMLedTable, 0)
+
+ -- Pits Stuff
+ if isPit == 1 and carspd == 0 then
+ -- pit stop
+
+ elseif isPit >= 1 and carspd > 21 then
+ -- car Approaching pits (or in pit lane) and exceed 45 mph
+ -- set the red zone to the current engine rpm (This sets the shiftlights to the max and warns the driver)
+ local spdLmt = GetCarInfo("speedlimiter")
+ if spdLmt == 0 then
+ -- if speedlimiter is OFF
+ gRedZone = rpm
+ end
+ end
+
+ -- get device type
+ if dev == nil then dev = "none" end
+
+ -- shiftlights stuff
+ if cNm == "formulamazda" then
+ -- start Mazda shiftlights
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 95, 96, 97 ,98 ,99 ,99.5)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 94, 94.5, 95, 96, 97 ,98 ,99 ,99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5)
+ end
+ elseif cNm == "mclarenmp4" then
+ local gear = GetCarInfo("gear")
+ if gear == 6 then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 6300, 6350, 6400, 6490, 6580, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
+ else
+ ProgressiveFixedSLI(rpm, 6300, 6490, 6580, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
+ end
+ else
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 6200, 6250, 6300, 6390, 6480, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
+ else
+ ProgressiveFixedSLI(rpm, 6200, 6390, 6480, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
+ end
+ end
+
+ elseif cNm == "williamsfw31" then
+ if dev == "FANATEC" then
+ AlternateFanatec(rpm, gRedZone, 7.0, 8.0, 8.9)
+ elseif dev == "SRDLX" then
+ AlternateSRDlx(rpm, gRedZone, 8.0, 9.0, 9.9)
+ elseif dev == "SRF1" then
+ AlternateSRF1(rpm, gRedZone, 12.0, 13.0, 14.9)
+ else
+ AlternateSLI(rpm, gRedZone, 11.0, 12.0, 12.9)
+ end
+
+ elseif cNm == "kiaoptima" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 90, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 90, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "fr500s" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 86, 88 ,90 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 84, 86, 88 ,90 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
+ end
+
+ elseif cNm == "fordv8sc" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 92, 94 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 90, 92, 94 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 87, 90, 92, 94 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 87, 90, 92, 94 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "dallara" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 90, 94 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 82, 90, 94 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 78, 82, 90, 94 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 78, 82, 90, 94 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "fordgt" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 94, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 93, 94, 95, 96 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 93, 94, 95, 96 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "hpdarx01c" then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 7800, 7840, 7890, 7900, 8100, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
+ else
+ ProgressiveFixedSLI(rpm, 7800, 7900, 8100, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
+ end
+
+ elseif cNm == "rileydp" then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 10000, 10000, 6700, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000, 10000, 10000)
+ else
+ ProgressiveFixedSLI(rpm, 10000, 6700, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000, 10000)
+ end
+
+ elseif cNm == "c6r" then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 5000, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 4700, 4800, 4900, 5000, 5040, 5190, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
+ else
+ ProgressiveFixedSLI(rpm, 4700, 4800, 4900, 5000, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
+ end
+
+ elseif cNm == "radical sr8" then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 4350, 4800, 5100, 5300, 5500, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
+ else
+ ProgressiveFixedSLI(rpm, 4350, 4800, 5100, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
+ end
+
+ elseif cNm == "jettatdi" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 86, 88 ,90 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 84, 86, 88 ,90 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
+ end
+
+ elseif cNm == "cadillacctsvr" then
+ --ProgressiveFixedSLI(rpm, 6500, 6580, 6600, 6700, 6800 , 6900 , 7000 , 7100, 7200, 7300, 7400, 7500, 7600)
+ if dev == "FANATEC" then
+ ProgressiveFanatec(rpm, gRedZone, 7.9, 8.15, 8.2, 8.25, 8.3, 8.35, 8.5, 8.8, 8.98 )
+ elseif dev == "SRDLX" then
+ ProgressiveSRDlx(rpm, gRedZone, 8.5, 8.9, 9.15, 9.2, 9.25, 9.3, 9.35, 9.5, 9.8, 9.98 )
+ elseif dev == "SRF1" then
+ ProgressiveSRF1(rpm, gRedZone, 13.8, 13.85, 13.9, 13.95, 13.98, 14, 14.1, 14.15, 14.2, 14.25, 14.3, 14.35, 14.5, 14.8, 14.98 )
+ else
+ ProgressiveSLI(rpm, gRedZone, 11.9, 11.95, 11.98, 12, 12.1, 12.15, 12.2, 12.25, 12.3, 12.35, 12.5, 12.8, 12.98 )
+ end
+
+ -- progressive default method for all cars with dashboard without leds
+ -- elseif cNm == "latemodel" then
+ -- elseif cNm == "legends ford34c" then
+ -- elseif cNm == "legends ford34c rookie" then
+ -- elseif cNm == "skmodified" then
+ -- elseif cNm == "silvercrown" then
+ -- elseif cNm == "trucks silverado" then
+ -- elseif cNm == "stockcars impala" then
+ -- elseif cNm == "lotus79" then
+ -- elseif cNm == "stockcars2 chevy" then
+ -- elseif cNm == "solstice" then
+ -- elseif cNm == "solstice rookie" then
+ -- elseif cNm == "rt2000" then
+ -- elseif cNm == "specracer" then
+ -- elseif cNm == "streetstock" then
+ -- elseif cNm == "sprint" then
+
+ else
+ -- default
+ if dev == "FANATEC" then
+ ProgressiveFanatec(rpm, gRedZone, 4.5, 5, 6.5, 7, 7.5, 8, 8.5, 8.8, 8.98 )
+ elseif dev == "SRDLX" then
+ ProgressiveSRDlx(rpm, gRedZone, 5.0, 5.5, 6, 7.5, 8, 8.5, 9, 9.5, 9.8, 9.98 )
+ elseif dev == "SRF1" then
+ ProgressiveSRF1(rpm, gRedZone, 9.0, 9.5, 9.8, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 14.8, 14.98 )
+ else
+ ProgressiveSLI(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 12.8, 12.98 )
+ end
+ end
+
+ -- set leds
+ SetRPMLed(tName)
+end
+
+function iRacing_ospMethodEvent(idx, deviceType)
+ -- get car name
+ local cNm = GetContextInfo("carname")
+ -- OSP Method stuff
+ if mOSPMethod ~= nil then
+ if cNm == "mclarenmp4" or cNm == "williamsfw31" then
+ if deviceType == "FANATEC" then
+ mOSPMethod = 1
+ else
+ mOSPMethod = 3
+ end
+
+ -- else
+ -- -- default
+ -- if deviceType == "FANATEC" then
+ -- mOSPMethod = 1
+ -- end
+ end
+ end
+ return 2
end \ No newline at end of file