summaryrefslogtreecommitdiff
path: root/scripts/zdoc_scripts/iracing_common_scripts.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/zdoc_scripts/iracing_common_scripts.lua')
-rw-r--r--[-rwxr-xr-x]scripts/zdoc_scripts/iracing_common_scripts.lua194
1 files changed, 119 insertions, 75 deletions
diff --git a/scripts/zdoc_scripts/iracing_common_scripts.lua b/scripts/zdoc_scripts/iracing_common_scripts.lua
index 3b19bb2..1da0e2d 100755..100644
--- a/scripts/zdoc_scripts/iracing_common_scripts.lua
+++ b/scripts/zdoc_scripts/iracing_common_scripts.lua
@@ -1,6 +1,6 @@
--- iRacing SLI-PRO Custom SLIMax Manager Scripts v3
+-- iRacing SLI-PRO Custom SLIMax Manager Scripts v3.2.2
-- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2013-02
+-- last change by Zappadoc - 2013-10
-- ================================
-- CONSTANTS
@@ -26,91 +26,120 @@ require "scripts/zdoc_scripts/iracing_stuff"
function custom_initEvent(scriptfile)
-- type your custom script initialization here
+ -- if iRacingZDocComboInitialized == nil then
+ -- iRacingZDocComboInitialized = true
+ -- local devStr = GetDeviceType(GetContextInfo("devicetype"))
+ -- if devStr == nil then devStr = "Unknown" end
+ -- local str = string.format("iRacing Combo Setup (settings + scripts)\n©2012-2013 By zappadoc, All Rights Reserved.\n\nInitialized for device: %s\n\nReminder: A COMBO SETUP automatically chooses for you the best corresponding settings in the car you are currently driving. Change to a simple setup if you want to set up the car by yourself using Basic or Advanced Options panel.", devStr )
+ -- SMXMessageBox(str)
+ -- end
+end
+
+-- function custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex)
+ -- -- type your custom controls script here (manage buttons, switches and encoders)
+ -- return 2
+-- end
+
+-- function custom_deviceReport(deviceType)
+ -- -- type your script here (just before sending report to the device )
+ -- return 2
+-- end
+
+function UnifyOSPMethod(idx, device)
+ -- custom OSP for each iRacing car
+ local result = 2
+ -- get current simulation name
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim) then
+ result = iRacing_ospMethodEvent(idx, device)
+ end
+ return result
end
-function custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
- -- type your custom controls script here (manage buttons, switches and encoders)
- return 2
+function custom_ospMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+
+ return UnifyOSPMethod(idx, "SLI")
end
-function custom_deviceReport(devType)
- -- type your script here (just before sending report to the device )
- return 2
+function custom_ospFanatecMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+ -- custom speedlimiter for each iRacing car
+ return UnifyOSPMethod(idx, "FANATEC")
end
-function custom_ospMethodEvent(idx)
+function custom_ospSRDlxMethodEvent(idx)
-- type your custom Optimal Shift Points (OSP) method here
-- custom speedlimiter for each iRacing car
- local result = 2
- -- get current simulation name
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- result = iRacing_ospMethodEvent(idx, "SLI")
- end
- return result
+ return UnifyOSPMethod(idx, "SRDLX")
end
-function custom_ospFanatecMethodEvent(idx)
+function custom_ospSRF1MethodEvent(idx)
-- type your custom Optimal Shift Points (OSP) method here
-- custom speedlimiter for each iRacing car
- local result = 2
- -- get current simulation name
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- result = iRacing_ospMethodEvent(idx, "FANATEC")
- end
- return result
+ return UnifyOSPMethod(idx, "SRF1")
end
-function custom_shiftLightsMethodEvent(idx)
- -- type your custom shiftlights method here
-
+--==================================================
+
+function UnifyShiftlightsMethod(idx, device)
-- custom shiftlights for each iRacing car
-- get current simulation name
local sim = GetContextInfo("simulation")
if isAppIRacing(sim) then
- iRacing_shiftLightsMethodEvent(idx, "SLI")
+ iRacing_shiftLightsMethodEvent(idx, device)
-- skip std methods
return 1
end
-
return 2
end
-function custom_shiftLightsFanatecMethodEvent(idx)
+
+function custom_shiftLightsSRDlxMethodEvent(idx)
-- type your custom shiftlights method here
- -- custom shiftlights for each iRacing car
- -- get current simulation name
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- iRacing_shiftLightsMethodEvent(idx, "FANATEC")
- -- skip std methods
- return 1
- end
-
- return 2
+ return UnifyShiftlightsMethod(idx, "SRDLX")
end
-function custom_shiftLightsBU0710Event(idx)
- -- type your custom shiftlights method for BU0710 device only here
- return 2
+function custom_shiftLightsMethodEvent(idx)
+ -- type your custom shiftlights method here
+
+ return UnifyShiftlightsMethod(idx, "SLI")
end
-function custom_leftDigitsEvent(swPosition)
- -- type your custom script related to left SLI-PRO digits panel here
- return 2
+function custom_shiftLightsFanatecMethodEvent(idx)
+ -- type your custom shiftlights method here
+
+ return UnifyShiftlightsMethod(idx, "FANATEC")
end
-function custom_rightDigitsEvent(swPosition)
- -- type your custom script related to right SLI-PRO digits panel here
- return 2
+function custom_shiftLightsSRF1MethodEvent(idx)
+ -- type your custom shiftlights method here
+
+ return UnifyShiftlightsMethod(idx, "SRF1")
end
-function custom_fanatecDigitsEvent(swPosition)
- -- type your custom script related to Fanatec digits panel here
- return 2
-end
+-- function custom_shiftLightsBU0710Event(idx)
+ -- -- type your custom shiftlights method for BU0710 device only here
+ -- return 2
+-- end
-function custom_spdLmtMethodEvent(idx)
+-- function custom_leftDigitsEvent(swPosition)
+ -- -- type your custom script related to left SLI-PRO digits panel here
+ -- return 2
+-- end
+
+-- function custom_rightDigitsEvent(swPosition)
+ -- -- type your custom script related to right SLI-PRO digits panel here
+ -- return 2
+-- end
+
+-- function custom_fanatecDigitsEvent(swPosition)
+ -- -- type your custom script related to Fanatec digits panel here
+ -- return 2
+-- end
+
+--==================================================
+
+function UnifySpeedlimiterMethod(idx, device)
-- type your custom speedlimiter method here
-- custom speedlimiter for each iRacing car
@@ -118,45 +147,60 @@ function custom_spdLmtMethodEvent(idx)
-- get current simulation name
local sim = GetContextInfo("simulation")
if isAppIRacing(sim) then
- result = iRacing_spdLmtMethodEvent(idx, "SLI")
+ result = iRacing_spdLmtMethodEvent(idx, device)
end
return result
end
+function custom_spdLmtMethodEvent(idx)
+ -- type your custom speedlimiter method here
+
+ return UnifySpeedlimiterMethod(idx, "SLI")
+end
+
function custom_spdLmtFanatecMethodEvent(idx)
-- type your custom Optimal Shift Points (OSP) method here
- -- custom speedlimiter for each iRacing car
- local result = 2
- -- get current simulation name
+ return UnifySpeedlimiterMethod(idx, "FANATEC")
+end
+
+function custom_spdLmtSRDlxMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+
+ return UnifySpeedlimiterMethod(idx, "SRDLX")
+end
+
+function custom_spdLmtSRF1MethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+
+ return UnifySpeedlimiterMethod(idx, "SRF1")
+end
+--==================================================
+
+function UnifyGearEvent(gear)
local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- result = iRacing_spdLmtMethodEvent(idx, "FANATEC")
+ if isAppIRacing(sim) then
+ iRacing_InitGearEvent(gear)
end
- return result
end
function custom_gearFanatecEvent(gear)
-- type your custom gear event script here
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- iRacing_InitGearEvent(gear)
- end
+ UnifyGearEvent(gear)
return 2
end
function custom_gearEvent(gear)
-- type your custom gear event script here
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- iRacing_InitGearEvent(gear)
- end
+ UnifyGearEvent(gear)
return 2
end
-function custom_enterSessionEvent(devType)
+--==================================================
+
+function custom_enterSessionEvent(deviceType)
-- type your custom script on session start, here
-- custom script to get the max gear of each iRacing car
@@ -164,12 +208,12 @@ function custom_enterSessionEvent(devType)
local sim = GetContextInfo("simulation")
if isAppIRacing(sim ) then
iRacing_CarSetup(0)
- iRacing_DebugCarInfo(devType)
+ iRacing_DebugCarInfo(deviceType)
end
return 2
end
-function custom_exitSessionEvent(devType)
- -- type your custom script on session ending, here
- return 2
-end \ No newline at end of file
+-- function custom_exitSessionEvent(deviceType)
+ -- -- type your custom script on session ending, here
+ -- return 2
+-- end \ No newline at end of file