summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2013-11-15 10:09:12 +0100
committerHugues Hiegel <hugues@hiegel.fr>2013-11-15 10:09:12 +0100
commit17ef33a3fc62a31565193320f1f5583077403b19 (patch)
tree949d91ff75bf247c7bd258901dd31c3cb6a212f7
parent7041ec4378bbc034dd9d80f7fe06f8020ee3779d (diff)
SliMax Manager 3.++
-rw-r--r--[-rwxr-xr-x]scripts/controls.lua95
-rw-r--r--scripts/custom_events.lua39
-rw-r--r--[-rwxr-xr-x]scripts/devhook.lua8
-rw-r--r--[-rwxr-xr-x]scripts/enter_exit_session.lua14
-rw-r--r--[-rwxr-xr-x]scripts/fanatec.lua176
-rw-r--r--[-rwxr-xr-x]scripts/fanatec_iracing.lua0
-rw-r--r--scripts/functions_tools.lua234
-rw-r--r--[-rwxr-xr-x]scripts/gear.lua86
-rw-r--r--[-rwxr-xr-x]scripts/global.lua348
-rw-r--r--[-rwxr-xr-x]scripts/global_custom_scripts.lua103
-rw-r--r--[-rwxr-xr-x]scripts/led.lua4
-rw-r--r--[-rwxr-xr-x]scripts/osp.lua337
-rw-r--r--[-rwxr-xr-x]scripts/shiftlights.lua543
-rw-r--r--scripts/simracedlx.lua537
-rw-r--r--scripts/simracedlx_iracing.lua11
-rw-r--r--scripts/simracef1.lua694
-rw-r--r--scripts/simracef1_iracing.lua11
-rw-r--r--[-rwxr-xr-x]scripts/slidevice.lua14
-rw-r--r--[-rwxr-xr-x]scripts/sliemu_iracing.lua0
-rwxr-xr-xscripts/sliemu_iracing_basic.lua11
-rw-r--r--[-rwxr-xr-x]scripts/slim_iracing.lua0
-rwxr-xr-xscripts/slim_iracing_basic.lua11
-rw-r--r--[-rwxr-xr-x]scripts/slimax_script_readme.txt188
-rw-r--r--[-rwxr-xr-x]scripts/slipro.lua258
-rwxr-xr-xscripts/slipro_f1_2012_villota.lua102
-rwxr-xr-xscripts/slipro_gtr2_villota.lua102
-rw-r--r--[-rwxr-xr-x]scripts/slipro_iracing.lua0
-rwxr-xr-xscripts/slipro_iracing_basic.lua11
-rwxr-xr-xscripts/slipro_lfs_villota.lua102
-rwxr-xr-xscripts/slipro_rfactor2_villota.lua102
-rwxr-xr-xscripts/slipro_rfactor_villota.lua102
-rw-r--r--[-rwxr-xr-x]scripts/speedlimiter.lua621
-rw-r--r--scripts/srf1emu_iracing.lua11
-rwxr-xr-xscripts/villota_scripts/villota_custom_functions.lua158
-rw-r--r--[-rwxr-xr-x]scripts/zdoc_scripts/iracing_common_scripts.lua194
-rw-r--r--[-rwxr-xr-x]scripts/zdoc_scripts/iracing_stuff.lua110
36 files changed, 4036 insertions, 1301 deletions
diff --git a/scripts/controls.lua b/scripts/controls.lua
index e0ce14d..c687c11 100755..100644
--- a/scripts/controls.lua
+++ b/scripts/controls.lua
@@ -1,22 +1,26 @@
--- SLIMax Mgr Lua Script v3
+-- SLIMax Mgr Lua Script v3.1.4
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
+-- last change by Zappadoc - 2013-10
--- param deviceIdx = (see GetDeviceType() )
+-- param deviceType = (see GetDeviceType() to get device name )
-- param ctrlType = type of ctrl, switch (0) or button (1)
-- param ctrlPos = ctrl index, switch from 1 to 6 and button from 1 to n
-- param value = ctrl value, button down (>0) or up (==0) and switch from 1 to 12
+-- param funcIndex = mapped to internal function or -1
+-- param targetDevice = the device targeted, should be equal to deviceType above or different
+-- if mapped to other device (see GetDeviceType() to get device name )
-- return 0 to give the control to SLIMax Mgr
-- return 1 to force the update of device
-function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
+function controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice)
-- call custom script
- local result = custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
+ local result = custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
+ result = global_custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
@@ -24,8 +28,13 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
local loopFlag = false
local dev = ""
- dev = GetDeviceType(deviceIdx)
+ dev = GetDeviceType(deviceType)
if dev == nil then dev = "none" end
+
+ local targetdev = ""
+ targetdev = GetDeviceType(targetDevice)
+ if targetdev == nil then targetdev = "none" end
+
-- switches and buttons
-- ctrl change event
local state = 0
@@ -43,11 +52,11 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
local mxgear = 0
mxgear = GetCarInfo("maxgear")
- leftStr = " GEAR "
- rightStr = rightStr.format( "MAX %1d", mxgear)
+ leftStr = "GEAR "
+ rightStr = rightStr.format( "MAX%1d ", mxgear)
-- set digits
- UpdateSLIProDigits(leftStr, rightStr)
+ UpdateDigits(leftStr, rightStr)
SLISendReport(0)
state = 1
@@ -56,7 +65,7 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
elseif IsSLIFunction("brightness", funcIndex) and mBrightnessFeedbackAllowed then
-- brightness feedback (switch or buttons)
- BrightnessFeedBack(dev)
+ BrightnessFeedBack(targetdev)
leftStr = "888888"
rightStr = "888888"
@@ -69,13 +78,13 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
elseif IsSLIFunction("ospfactor", funcIndex) and mOSPFeedbackAllowed then
-- OSP Factor feedback
- leftStr = "OSP: "
+ leftStr = "OSP "
local ospf = GetContextInfo("ospfactor")
rightStr = rightStr.format(" %03d ", ospf)
-- set digits
- UpdateSLIProDigits(leftStr, rightStr)
+ UpdateDigits(leftStr, rightStr)
SLISendReport(0)
state = 1
@@ -87,12 +96,12 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
local spdm = false
spdm = GetContextInfo("speedmetric")
- leftStr = "SPD: "
+ leftStr = "SPD "
rightStr = " KPH "
if spdm then rightStr = " MPH " end
-- set digits
- UpdateSLIProDigits(leftStr, rightStr)
+ UpdateDigits(leftStr, rightStr)
SLISendReport(0)
state = 1
@@ -151,13 +160,17 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
elseif IsSLIFunction("rightdigits", funcIndex) and mRightDigitsFeedbackAllowed then
-- rightdigits feedback
- local info = false
- info = GetContextInfo("rightdigits")
- leftStr = leftStr.format("Btn: %02d", ctrlPos)
- rightStr = rightStr.format(" %02d ", info)
+ local info = GetContextInfo("rightdigits")
+
+ if ctrlType == 1 then
+ leftStr = leftStr.format("B%02d ", ctrlPos)
+ else
+ leftStr = leftStr.format("S%1d ", ctrlPos)
+ end
+ rightStr = rightStr.format("P%02d ", info+1)
-- set digits
- UpdateSLIProDigits(leftStr, rightStr)
+ UpdateDigits(leftStr, rightStr)
SLISendReport(0)
state = 1
@@ -166,13 +179,17 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
elseif IsSLIFunction("leftdigits", funcIndex) and mLeftDigitsFeedbackAllowed then
-- leftdigits feedback
- local info = false
- info = GetContextInfo("leftdigits")
- leftStr = leftStr.format("Btn: %02d", ctrlPos)
- rightStr = rightStr.format(" %02d ", info)
+ local info = GetContextInfo("leftdigits")
+ rightStr = leftStr.format("P%02d ", info+1)
+
+ if ctrlType == 1 then
+ leftStr = rightStr.format("B%02d ", ctrlPos)
+ else
+ leftStr = rightStr.format("S%1d ", ctrlPos)
+ end
-- set digits
- UpdateSLIProDigits(leftStr, rightStr)
+ UpdateDigits(leftStr, rightStr)
SLISendReport(0)
state = 1
@@ -182,14 +199,13 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
elseif IsSLIFunction("lowfuel", funcIndex) and mLowFuelFeedbackAllowed then
-- lowfuel feedback
-- get the option
- local info = false
- info = GetContextInfo("lowfuel")
+ local info = GetContextInfo("lowfuel")
-- set digits
- leftStr = leftStr.format(" FUEL ", ctrlPos)
- rightStr = rightStr.format("LPS %02d", info)
+ leftStr = leftStr.format("FUEL ", ctrlPos)
+ rightStr = rightStr.format("L %02d ", info)
- UpdateSLIProDigits(leftStr, rightStr)
+ UpdateDigits(leftStr, rightStr)
SLISendReport(0)
state = 1
@@ -217,11 +233,11 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
if mSwitchFeedbackAllowed then
-- general switch feedback (see global.lua to activate)
- leftStr = leftStr.format("S%1d : ", ctrlPos)
- rightStr = rightStr.format(" %02d ", value)
+ leftStr = leftStr.format("S%1d ", ctrlPos)
+ rightStr = rightStr.format("P%02d ", value)
-- set digits
- UpdateSLIProDigits(leftStr, rightStr)
+ UpdateDigits(leftStr, rightStr)
SLISendReport(0)
state = 1
@@ -240,11 +256,11 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
-- set digits
leftStr = "tELENN"
if flag then
- rightStr = " SAVE "
+ rightStr = "SAVE "
else
- rightStr = " FALSE"
+ rightStr = "FALSE "
end
- UpdateSLIProDigits(leftStr, rightStr)
+ UpdateDigits(leftStr, rightStr)
SLISendReport(0)
state = 1
@@ -270,7 +286,7 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
oldTcks = 0
state = 0
toggleAllLed(0)
- UpdateSLIProDigits(" ", " ")
+ UpdateDigits(" ", " ")
SLISendReport(0)
-- allow Mgr to display info on digits
@@ -282,13 +298,16 @@ function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
end
-- set leds, digits, parts to cleanup and timeout
-function UpdateSLIProDigits(leftInfo, rightInfo)
+function UpdateDigits(leftInfo, rightInfo)
-- do not refresh digits until timeout
SetDigitsAllowed(false)
+ mF1LeftSpdLmtText = string.sub(leftInfo,4)
+ mF1RightSpdLmtText = string.sub(rightInfo,4)
-- set digits string
SetLeftDigits(leftInfo)
SetRightDigits(rightInfo)
+
end
-- brightness feedback function
@@ -299,6 +318,6 @@ function BrightnessFeedBack(device)
if device == "SLI-PRO" then
-- SLI-PRO Device
-- set digits
- UpdateSLIProDigits("888888", "888888")
+ UpdateDigits("888888", "888888")
end
end
diff --git a/scripts/custom_events.lua b/scripts/custom_events.lua
new file mode 100644
index 0000000..9b6513a
--- /dev/null
+++ b/scripts/custom_events.lua
@@ -0,0 +1,39 @@
+-- Custom Events SLIMax Manager Scripts v1.2
+-- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
+-- last change by Zappadoc - 2013-09
+
+-- ================================
+-- IMPORTANT:
+-- local custom events PLACEHOLDERS
+-- DO NOT CHANGE THE SCRIPT BELOW
+-- ================================
+function custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) return 2 end
+function custom_deviceReport(deviceType) return 2 end
+function custom_ospMethodEvent(idx) return 2 end
+function custom_ospG27MethodEvent(idx) return 2 end
+function custom_ospFanatecMethodEvent(idx) return 2 end
+function custom_ospSRDlxMethodEvent(idx) return 2 end
+function custom_ospSRF1MethodEvent(idx) return 2 end
+function custom_shiftLightsMethodEvent(idx) return 2 end
+function custom_shiftLightsBU0710Event(idx) return 2 end
+function custom_shiftLightsG27LedsMethodEvent(idx) return 2 end
+function custom_shiftLightsFanatecMethodEvent(idx) return 2 end
+function custom_shiftLightsSRDlxMethodEvent(idx) return 2 end
+function custom_srdlxLeftDigitsEvent(swPosition) return 2 end
+function custom_srdlxRightDigitsEvent(swPosition) return 2 end
+function custom_shiftLightsSRF1MethodEvent(idx) return 2 end
+function custom_srf1LeftDigitsEvent(swPosition) return 2 end
+function custom_srf1RightDigitsEvent(swPosition) return 2 end
+function custom_leftDigitsEvent(swPosition) return 2 end
+function custom_rightDigitsEvent(swPosition) return 2 end
+function custom_fanatecDigitsEvent(swPosition) return 2 end
+function custom_spdLmtMethodEvent(idx) return 2 end
+function custom_spdLmtG27MethodEvent(idx) return 2 end
+function custom_spdLmtFanatecMethodEvent(idx) return 2 end
+function custom_spdLmtSRDlxMethodEvent(idx) return 2 end
+function custom_spdLmtSRF1MethodEvent(idx) return 2 end
+function custom_gearEvent(gear) return 2 end
+function custom_gearFanatecEvent(gear) return 2 end
+function custom_enterSessionEvent(deviceType) return 2 end
+function custom_exitSessionEvent(deviceType) return 2 end
+function custom_ledEvent(idx, ledFunction, state) return 2 end \ No newline at end of file
diff --git a/scripts/devhook.lua b/scripts/devhook.lua
index 28c40e1..944fa05 100755..100644
--- a/scripts/devhook.lua
+++ b/scripts/devhook.lua
@@ -1,20 +1,20 @@
--- SLIMax Mgr Lua Script v3
+-- SLIMax Mgr Lua Script v3.1
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- param = device type (integer - see GetDeviceType() )
-- return 1 to send processed data to the device and bypass Mgr
-- return 0 to skip and give the control to Mgr
-function deviceReport(devType)
+function deviceReport(deviceType)
-- call custom script
- local result = custom_deviceReport(devType)
+ local result = custom_deviceReport(deviceType)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_deviceReport(devType)
+ result = global_custom_deviceReport(deviceType)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
diff --git a/scripts/enter_exit_session.lua b/scripts/enter_exit_session.lua
index b9b761b..6d42ff2 100755..100644
--- a/scripts/enter_exit_session.lua
+++ b/scripts/enter_exit_session.lua
@@ -1,17 +1,17 @@
--- SLIMax Mgr Lua Script v3
+-- SLIMax Mgr Lua Script v3.1
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- Event received when the car enter and exit the session.
-- param = device type (integer - see GetDeviceType() )
-- enter session
-function enterSessionEvent(devType)
+function enterSessionEvent(deviceType)
-- call custom script
- local result = custom_enterSessionEvent(devType)
+ local result = custom_enterSessionEvent(deviceType)
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_enterSessionEvent(devType)
+ result = global_custom_enterSessionEvent(deviceType)
if result <= 1 then return result end
-- if result >= 2 continue
@@ -21,14 +21,14 @@ end
-- param = device type (integer - see GetDeviceType() )
-- exit session
-function exitSessionEvent(devType)
+function exitSessionEvent(deviceType)
-- call custom script
- local result = custom_exitSessionEvent(devType)
+ local result = custom_exitSessionEvent(deviceType)
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_exitSessionEvent(devType)
+ result = global_custom_exitSessionEvent(deviceType)
if result <= 1 then return result end
-- if result >= 2 continue
diff --git a/scripts/fanatec.lua b/scripts/fanatec.lua
index 90e44f1..46d944c 100755..100644
--- a/scripts/fanatec.lua
+++ b/scripts/fanatec.lua
@@ -1,8 +1,8 @@
--- Fanatec Lua Script v1.0
+-- Fanatec Lua Script v1.4
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all functions associated with
-- digits panels of Fanatec device
--- last change by Zappadoc - 2013-02
+-- last change by Zappadoc - 2013-09
-- ============================================================
-- Digits Panel functions
@@ -78,12 +78,24 @@ function fanatecDigitsEvent(swFunction)
swValue = 11
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 function if car pits
+ local pit = GetCarInfo("inpits")
+ if pit > 0 then
+ swValue = 41
+ end
+ end
+
-- check postion and compute panel string
if swValue == 1 then
-- oldGear is intialized in gearEvent (see gear.lua)
if oldGear ~= nil then
-- gear
- local g = GetCarInfo("gear")
+ --local g = GetCarInfo("gear")
-- get neutral
local n = string.char(GetContextInfo("neutral"))
@@ -94,11 +106,11 @@ function fanatecDigitsEvent(swFunction)
-- set neutral, reverse or current gear
- if g == 0 then
+ if oldGear == 0 then
-- if neutral and using custom OSP record then add a dot to gear digit
SetFanatecGear(n, ospcustom_on)
- elseif g < 0 then
+ elseif oldGear < 0 then
-- reverse
SetFanatecGear(r, false)
@@ -108,9 +120,10 @@ function fanatecDigitsEvent(swFunction)
-- return 0
-- end
- SetFanatecGear(string.char(g), false)
+ SetFanatecGear(string.char(oldGear), false)
end
+
return 1
end
@@ -198,19 +211,27 @@ function fanatecDigitsEvent(swFunction)
elseif swValue == 10 then
-- best lap time
- timeFlag = true
+ --timeFlag = true
+ --dlt = true
lpt = GetTimeInfo("bestlaptime")
-
+ mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
+
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue == 11 then
-- last lap time
- timeFlag = true
+ --timeFlag = true
+ --dlt = true
lpt = GetTimeInfo("lastlaptime")
-
+ mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue >= 12 and swValue <= 18 and isAppIRacing(sim) then
- timeFlag = true
+ --timeFlag = true
-- iRacing partials
local ts = GetContextInfo("partialcount")
local sector = GetCarInfo("sector")
+ if sector == nil then sector = 0 end
if ts ~= nil and ts > 0 then
if swValue == 12 then
lpt = GetPartialTimeInfo("currentpartial", sector)
@@ -230,21 +251,33 @@ function fanatecDigitsEvent(swFunction)
else
lpt = 0.0
end
-
+ mFanatecText = DisplayFormatTime(lpt,mDeltaTimeDelay,2,1,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue == 19 then
-- real time diff vs your best
- timeFlag = true
+ --timeFlag = true
lpt = GetTimeInfo("realdiffbest")
-
+ mFanatecText = DisplayFormatTime(lpt,mDeltaTimeDelay,2,1,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue == 20 then
-- real time diff vs your last
- timeFlag = true
+ --timeFlag = true
lpt = GetTimeInfo("realdifflast")
+ mFanatecText = DisplayFormatTime(lpt,mDeltaTimeDelay,2,1,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue == 21 then
- -- logo
- fPanel = "SMX"
-
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ if remainintank >= 100 then
+ fPanel = string.format("%3.0f", math.floor (remainintank))
+ else
+ fPanel = string.format("L%2.0f", math.floor(remainintank))
+ end
+
elseif swValue == 22 then
-- rpm
isSlowUpdate = true
@@ -382,78 +415,83 @@ function fanatecDigitsEvent(swFunction)
if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
fPanel = string.format("%3.0f", inf)
end
-
+
+ elseif swValue == 41 then
+ -- PIT
+ fPanel = "PIt"
+
+ elseif swValue == 42 then
+ -- sc
+ local sc = GetContextInfo("safetycare")
+ if sc == 1 then
+ fPanel = " SC"
+ else
+ fPanel = " "
+ end
+
else
fPanel = " "
end
- if timeFlag and lpt ~= nil then
+ -- the function below has been replaced with generic time display function in global.lua
- -- set char of negative number
- local c = ""
- if lpt < 0 then c = "-" end
+ -- if timeFlag and lpt ~= nil then
- -- explod time
- hr, mn, sc, hd, ms = timeDispatcher(lpt)
+ -- -- explod time
+ -- hr, mn, sc, hd, ms = timeDispatcher(lpt)
- --print("lpt: " .. lpt .. " m: " .. mn .. " - s: " .. sc .. " - ms: " .. ms .."\n" )
+
+ -- print("lpt:" .. lpt .. " mn:" .. mn .. " sc:" .. sc .. " hd:" .. hd .. " ms:" .. ms .."\n" )
- -- update display every mDeltaTimeDelay time
- if GetTicks() > (mDeltaTimeDelay + mDeltaTimeOldTicks ) then
- mDeltaTimeOldTicks = GetTicks()
+ -- -- update display every mDeltaTimeDelay time
+ -- -- current ticks > old backuped value
+ -- if GetTicks() > mDeltaTimeOldTicks then
+ -- -- store ticks + delay
+ -- mDeltaTimeOldTicks = GetTicks() + ( 2 * mDeltaTimeDelay)
- if lpt == -1 or (mn + sc + ms) == 0.0000 then
- mDeltaTimeBackup = "-.--"
+ -- if lpt == -1 or (mn + sc + ms) == 0.00 then
+ -- mDeltaTimeBackup = "-.--"
- -- > 9mn
- elseif mn > 9 then
- if c == "" then
- mDeltaTimeBackup = string.format( "%2d.%1d", mn, sc)
- else
- mDeltaTimeBackup = string.format( "%s%2d", c, mn)
- end
+ -- elseif mn > 0 or sc >= 10 then
- -- < 10mn
- elseif mn > 0 and mn < 10 then
- if c == "" then
- mDeltaTimeBackup = string.format( "%1d.%02d", mn, sc)
- else
- mDeltaTimeBackup = string.format( "%s %1d", c, mn)
- end
+ -- if dlt and mn <100 then
+ -- -- display time and mn < 100
+ -- if mn >=10 then
+ -- -- mn > 10
+ -- mDeltaTimeBackup = string.format( "%2d.%01d", mn, sc)
+ -- else
+ -- mDeltaTimeBackup = string.format( "%1d.%02d", mn, sc)
+ -- end
+ -- else
+ -- -- delta > 9.99s or lap time > 100mn
+ -- mDeltaTimeBackup = " . "
+ -- end
- else
- -- mn == 0 ; sc > 9
- if sc > 9 then
- if c == "" then
- mDeltaTimeBackup = string.format( "%2d.%1d", sc, ms)
- else
- mDeltaTimeBackup = string.format( "%s%2d.", c, sc)
- end
- else
- -- sc < 10
- if c == "" then
- mDeltaTimeBackup = string.format( "%1d.%02d", sc, ms)
- else
- mDeltaTimeBackup = string.format( "%s%1d.%1d", c, sc, ms)
- end
- end
- end
- end
+ -- else
+ -- -- delta
+ -- if lpt < 0 then
+ -- -- negative value
+ -- mDeltaTimeBackup = string.format( "-%01d.%01d ", sc, round(hd))
+ -- else
+ -- mDeltaTimeBackup = string.format( "%01d.%02d", sc, round(hd))
+ -- end
+ -- end
+ -- end
- --print(fPanel,mDeltaTimeBackup)
- fPanel = mDeltaTimeBackup
- end
+ -- fPanel = mDeltaTimeBackup
+ -- end
- if isSlowUpdate then
-
+ if isSlowUpdate then
+ -- request slow display update
if GetTicks() > ( mDeltaTimeDelay + mDeltaTimeOldTicks ) then
mDeltaTimeOldTicks = GetTicks()
mFanatecText = fPanel
- -- print(GetTicks() .. mFanatecText .."\n")
end
else
+ -- normal display update
mFanatecText = fPanel
end
+
-- send string to sli manager
SetFanatecDigits( mFanatecText )
return 1
diff --git a/scripts/fanatec_iracing.lua b/scripts/fanatec_iracing.lua
index a84c983..a84c983 100755..100644
--- a/scripts/fanatec_iracing.lua
+++ b/scripts/fanatec_iracing.lua
diff --git a/scripts/functions_tools.lua b/scripts/functions_tools.lua
new file mode 100644
index 0000000..50a7883
--- /dev/null
+++ b/scripts/functions_tools.lua
@@ -0,0 +1,234 @@
+-- SLIMax Mgr Lua Script v1.4
+-- PART OF SLIMAX Manager pkg
+-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
+-- CREDITS: first release - Zappadoc
+-- updated - Desty 2013-04-26
+
+-- ===============================
+-- left and right functions tools
+-- ===============================
+
+-- add a function name to left and right functions list
+
+-- Returns Index if success
+-- Returns Index if FunctionName allready exists
+-- Returns -1 if Error Reading File
+-- Returns -2 if Error writing File
+
+-- Usage AddFuncName(FilePath, FunctionName):
+
+-- on left list:
+-- local err = AddFuncName("cfg/sli_left_functions.ecfg", "DSII KERS")
+-- or right list:
+-- local err = AddFuncName("cfg/sli_right_functions.ecfg", "DSII KERS")
+
+function AddFuncName(path, func)
+
+ idx = 0
+ idx = GetFuncIndex(path, func)
+ if idx < 0 then
+ print("BAD ERROR occurred!")
+ return idx --returns errorcode -1 or -2
+ elseif idx > 0 then
+ return idx -- OK, return index
+ end
+
+ idx = GetNewFuncIndex(path)
+ if idx < 1 then
+ print("BAD ERROR occurred!")
+ return -1
+ end
+
+ file,err = io.open(path,"r")
+ if err then return -1 end
+
+ funcStr = idx.."."..func
+ isOK = false
+ local t1 = {} --IndexTable
+ local t2 = {} --functionsTable
+ i= 1
+ for line in file:lines() do
+ if line == nil then break end
+ -- Seperate Index from function name
+ a = string.find(line, '.', 1, true)
+ if a then
+ b = string.sub(line, a+1)
+ c = string.sub(line, 1, a-1)
+ d=(c + 0)
+ -- check for EXACT MATCH of the function name
+ if b == func then isOK = true end
+ table.insert(t1, d)
+ t2[d]= line
+ end
+ end
+ table.insert(t1, idx)
+ t2[idx]= funcStr
+
+ file:close()
+
+ if not isOK then
+ -- write mode
+ file, err = io.open(path,"w+")
+ if err then return -2 end
+
+ --sort IndexTable
+ table.sort(t1)
+
+ -- Write All functions in order of IndexTable
+ for i = 1, #t1, 1 do
+ a = t1[i]
+ b = t2[a]
+ --print(" a: "..a.." b: "..b)
+ file:write(b)
+ file:write("\n")
+ end
+ file:close()
+ end
+
+ return idx
+
+end
+
+
+ -- Remove a FunctionName
+
+-- Returns 1 if success
+-- Returns -1 if Error Reading File
+-- Returns -2 if Error writing File
+
+ --Usage: RemoveFuncName(FunctionName)
+
+-- on left list:
+-- local err = RemoveFuncName("cfg/sli_left_functions.ecfg", "DSII KERS")
+-- or right list:
+-- local err = RemoveFuncName("cfg/sli_right_functions.ecfg", "DSII KERS")
+
+function RemoveFuncName(path, func)
+
+ file,err = io.open(path,"r")
+ if err then return -1 end
+
+ t = { }
+ i=1
+ for line in file:lines() do
+ if line == nil then break end
+
+ -- Seperate Index from function name
+ a = string.find(line, '.', 1, true)
+ -- Empty Lines will be deleted
+ if a then
+ b = string.sub(line, a+1)
+ c = string.sub(line, 1, a-1)
+ d = (c + 0)
+ -- check for an EXACT MATCH of the function name
+ if b ~= func or d < 100 then
+ t[i] = line
+ i= i + 1
+ end
+ end
+ end
+ file:close()
+
+ -- write mode, delete previous data
+ file, err = io.open(path,"w+")
+ if err then return -2 end
+
+ for k, v in pairs(t) do
+ file:write(v)
+ file:write("\n")
+ end
+
+ file:close()
+ return 1
+end
+
+
+-- Returns Index
+-- returns 0 if Function not exists
+-- returns -1 if error reading file
+
+-- Usage: GetFuncIndex(FilePath, FunctionName)
+-- on left list:
+-- local idx = GetFuncIndex("cfg/sli_left_functions.ecfg", "DSII KERS")
+-- or right list:
+-- localidx = GetFuncIndex("cfg/sli_right_functions.ecfg", "DSII KERS")
+
+function GetFuncIndex(path, func)
+
+ file,err = io.open(path,"r")
+ if err then return -1 end
+
+ for line in file:lines() do
+ if line == nil then break end
+ -- Seperate Index from function name
+ a = string.find(line, '.', 1, true)
+ if a then
+ b = string.sub( line, a+1)
+ -- check for an EXACT MATCH of the function name
+ if b == func then
+ c = string.sub( line,1, a-1)
+ d = (c + 0)
+ return d
+ end
+ end
+ end
+
+ return 0
+
+end
+
+
+-- Returns lowest function index available (above 100)
+-- Returns -1 if Error Reading File
+
+-- typical usage GetNewFuncIndex(FilePath):
+-- on left list:
+-- local num_available = GetNewFuncIndex("cfg/sli_left_functions.ecfg")
+-- or right list:
+-- local num_available = GetNewFuncIndex("cfg/sli_right_functions.ecfg")
+
+function GetNewFuncIndex(path)
+
+ local t = { 99,}
+ local idx = 99
+
+ file,err = io.open(path,"r")
+ if err then return -1 end
+
+ for line in file:lines() do
+ if line == nil then break end
+ -- Seperate Index from function name
+ a = string.find(line, '.', 1, true)
+ if a then
+ b = string.sub( line,1, a-1)
+ -- string to num conversion
+ c = (b + 0)
+ -- store if it's greater
+ if c > idx then
+ table.insert(t, c)
+ end
+ end
+ end
+ file:close()
+
+ table.sort(t)
+ --s = table.concat(t, ", ")
+ --print(s)
+
+ idx = 0
+ local n = #t-1
+ for i = 1, n, 1 do
+ if t[i] < (t[i+1]-1) then
+ if idx == 0 then --added this Iteration
+ idx = t[i]+1 --to start at the lowest gap
+ end
+ end
+ end
+ if idx == 0 then
+ idx = t[n+1]+1
+ end
+
+ return idx
+
+end
+
diff --git a/scripts/gear.lua b/scripts/gear.lua
index 88dad9f..54649d6 100755..100644
--- a/scripts/gear.lua
+++ b/scripts/gear.lua
@@ -1,9 +1,72 @@
--- SLIMax Mgr Lua Script v3
+-- SLIMax Mgr Lua Script v3.2.1
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- gear event
--- last change by Zappadoc - 2013-02-15
+-- last change by Zappadoc - 2013-09
--- SLI-M, SLI-PRO Gear Event
+function Ignition(gear, isFanatec)
+ -- ========================================================================================
+ -- IGNITION
+ -- patch led function damage for ignition
+ -- check if sim is rFactor2
+ if GetContextInfo("simulation") == "rFactor2.exe" then
+ if GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then
+ if GetCarInfo("ignition") == 0 then
+ -- engine has been stopped
+ -- engine has been stopped
+ -- do nothing
+
+
+ elseif GetCarInfo("ignition") == 1 then
+ -- ignition ON after engine stop
+ -- engine has been stopped, ignition ON
+
+ SetDigitsAllowed(false)
+ if isFanatec == true then
+ SetFanatecDigits(" ")
+ else
+ SetLeftDigits (" ")
+ SetRightDigits (" ")
+ end
+
+ SetGearDigit("_")
+
+ -- init led
+ toggleAllLed(0)
+
+ -- blink damage led
+ if mOLDIgnitionticks == nil or GetTicks() > mOLDIgnitionticks then
+ mOLDIgnitionticks = GetTicks() + 1000
+ initLedTable(mRPMLedTable, 1)
+
+ SetWarnLed(GetLedIndex("damage"), 1)
+
+ else
+ initLedTable(mRPMLedTable, 0)
+ SetWarnLed(GetLedIndex("damage"), 0)
+ end
+ SetRPMLed("mRPMLedTable")
+ SLISendReport()
+ return 1
+
+ elseif GetCarInfo("ignition") == 2 and GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then
+ -- ignition ON and starter ON
+ -- engine has been stopped, ignition ON + Starter ON
+
+ SetGearDigit("-")
+ SetDigitsAllowed(true)
+ -- stop blinking
+ initLedTable(mRPMLedTable, 1)
+ SetWarnLed(GetLedIndex("damage"), 1)
+ SetRPMLed("mRPMLedTable")
+ SLISendReport()
+ return 1
+ end
+ end
+ end
+ return 2
+end
+
+-- SIM RACE Deluxe, SIM RACE F1, SLI-M, SLI-PRO Gear Event
function gearEvent(gear)
-- get the rpm limit already computed by my OSP method
-- using OSP Factor parameter
@@ -26,6 +89,9 @@ function gearEvent(gear)
result = global_custom_gearEvent(gear)
if result <= 1 then return result end
+ -- ignition
+ if Ignition(gear, false) <= 1 then return 1 end
+
local g = gear
if oldGear == nil then oldGear = -1 end
@@ -52,7 +118,6 @@ function gearEvent(gear)
if g == 69 then
return 0
end
-
SetGearDigit(string.char(g))
end
end
@@ -77,16 +142,19 @@ function gearFanatecEvent(gear)
if gRedZone == nil then gRedZone = 18000 end
-- call custom script
- local result = custom_gearEvent(gear)
+ local result = custom_gearFanatecEvent(gear)
if result <= 1 then return result end
-- call global custom script
- result = global_custom_gearEvent(gear)
+ result = global_custom_gearFanatecEvent(gear)
if result <= 1 then return result end
+ -- ignition
+ if Ignition(gear, true) <= 1 then return 1 end
+
local g = gear
if oldGear == nil then oldGear = -1 end
-
+
if oldGear ~= g then
local rumbbleGear = GetContextInfo("gearshock")
local rumbbleGearDelay = GetContextInfo("gearshockdelay")
@@ -104,5 +172,5 @@ function gearFanatecEvent(gear)
oldGear = g
end
- return 1
-end
+ return 2
+end \ No newline at end of file
diff --git a/scripts/global.lua b/scripts/global.lua
index 39bde4a..13c3c1d 100755..100644
--- a/scripts/global.lua
+++ b/scripts/global.lua
@@ -1,13 +1,48 @@
--- SLIMax Mgr Lua Script v2.4
+-- SLIMax Mgr Lua Script v3.8.1
-- PART OF SLIMAX Manager pkg
--- Copyright (c)2011-2013 by EK and Zappadoc - All Rights Reserved.
--- changed by Zappadoc - 2012-11-08
+-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
+-- last change by Zappadoc - 2013-10
+
+mSMX_VERSION = 3.8
-- see slimax_script_readme.txt for implementation
+-- load left and right functions tools
+require "scripts/functions_tools"
+
-- ============================================================
-- GLOBAL VAR
-- ============================================================
+-- SMXMessageBox Styles
+MB_OK = 0x00000000
+MB_OKCANCEL = 0x00000001
+MB_ABORTRETRYIGNORE = 0x00000002
+MB_YESNOCANCEL = 0x00000003
+MB_YESNO = 0x00000004
+MB_RETRYCANCEL = 0x00000005
+MB_CANCELTRYCONTINUE = 0x00000006
+
+MB_ICONHAND = 0x00000010
+MB_ICONQUESTION = 0x00000020
+MB_ICONEXCLAMATION = 0x00000030
+MB_ICONASTERISK = 0x00000040
+
+MB_USERICON = 0x00000080
+MB_ICONWARNING = MB_ICONEXCLAMATION
+MB_ICONERROR = MB_ICONHAND
+
+MB_ICONINFORMATION = MB_ICONASTERISK
+MB_ICONSTOP = MB_ICONHAND
+
+-- MB result
+mIDOK = 1
+mIDCANCEL = 2
+mIDABORT = 3
+mIDRETRY = 4
+mIDIGNORE = 5
+mIDYES = 6
+mIDNO = 7
+
-- scripts settings
mCustomScriptsFileName = ""
@@ -15,28 +50,50 @@ mCustomScriptsFileName = ""
-- init left and right digits panel text
mLeftSpdLmtText = " "
mRightSpdLmtText = " "
+-- 4 digits F1 panel
+mF1LeftSpdLmtText = " "
+mF1RightSpdLmtText = " "
-- new: 2.1
-- RPM threshold values in percentage used with Shiftlights method 2
-- and configured with SLIMax Manager II Advanced Options Panel
-- default values:
-RPM_PERCENT_VALUES = {50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 97, 98, 99 }
-RPM_ABSOLUTE_VALUES = {15452, 15545, 15823, 16354, 16410, 16675, 17252, 17545, 17823, 18354, 18510, 18655, 18675 }
-
+RPM_PERCENT_VALUES = {50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 97, 98, 98, 99, 99 }
+RPM_ABSOLUTE_VALUES = {15452, 15545, 15823, 16354, 16410, 16675, 17252, 17545, 17823, 18354, 18510, 18655, 18670, 18675, 18677 }
+
+-- Fanatec text using for slowdown update
+mFanatecText = ""
+-- SIMRACE DLX text using for slowdown update
+mSRDlxLeftText = ""
+mSRDlxRightText = ""
+-- SIMRACE DLX text using for slowdown update
+mSRF1LeftText = ""
+mSRF1RightText = ""
+
+-- get feedback on display when you turn encoder or press button assigned to internal functions, see control.lua
-- true if you want to display switch pos and value
-mSwitchFeedbackAllowed = false
+mSwitchFeedbackAllowed = true
-- mapping to keystroke demo script
-- see the support forum for more info on key mapping
mDemoMapToKeyAllowed = false
mDemoMapToKeySwitch = 5
+-- Fanatec Digits Status
+mFanatecDigitsFeedbackAllowed = true
+-- Fanatec speedlimiter method seleted
+mFanatecSpeedLimiterFeedbackAllowed = true
+-- Fanatec osp method seleted
+mFanatecOSPFeedbackAllowed = true
+-- Fanatec shiftlights method seleted
+mFanatecShiftlightsFeedbackAllowed = true
+
-- Low Fuel status
mLowFuelFeedbackAllowed = true
-- Left and Right Digits status
-mLeftDigitsFeedbackAllowed = false
-mRightDigitsFeedbackAllowed = false
+mLeftDigitsFeedbackAllowed = true
+mRightDigitsFeedbackAllowed = true
-- display KPH or KMH
mUnitFeedbackAllowed = true
@@ -58,14 +115,17 @@ mDumpLapButton = 9
-- delta time delay
mDeltaTimeBackup = 0
mDeltaTimeOldTicks = 0
-mDeltaTimeDelay = 700
+mDeltaTimeDelay = 100
+mRefreshLapTimeRate = 50
+-- dump telemetry
+TelemetryTools("dumplastlap", false);
-- ============================================================
-- init globals flag
isGlobalInitialized = 0
--- 13 RPM leds
+-- 15 RPM leds
mRPMLedTable = {
RPM0=0,
RPM1=0,
@@ -79,131 +139,31 @@ mRPMLedTable = {
RPM9=0,
RPM10=0,
RPM11=0,
- RPM12=0
+ RPM12=0,
+ RPM13=0,
+ RPM14=0
}
-- SLI device type
-mDeviceType = {
- "BU0386Otus",
- "BU0386",
- "BU0386a",
- "BU0386lc",
- "BU0386x",
- "SLI-M",
- "SLI-PRO",
- "SPARE1",
- "BU0710",
- "SLIEMU",
- "SLIF1"
-}
-
--- ========================
--- Utilities functions
--- ========================
-
--- add a function name to left and right functions list
--- typical usage AddFuncName(path, func):
--- on left list:
--- local err = AddFuncName("cfg/sli_left_functions.ecfg", "100.DSII KERS")
--- or right list:
--- local err = AddFuncName("cfg/sli_right_functions.ecfg", "100.DSII KERS")
-function AddFuncName(path, func)
- file,err = io.open(path,"r")
- if err then return 0 end
-
- isOK = false
- t = {}
- i= 1
- for line in file:lines() do
- if line == nil then break end
- -- check if the function name exist
- if string.find(line, func)then isOK = true end
- t[i]= line
- i= i + 1
- end
- file:close()
-
- if not isOK then
- -- write mode
- file, err = io.open(path,"w+")
- if err then return 0 end
- -- add the function name at the end of file
- for k, v in pairs(t) do
- -- add line
- file:write(v)
- file:write("\n")
- end
- -- add the function name
- file:write(func)
- file:write("\n")
- file:close()
- end
- return 1
-end
+-- mDeviceType no longer avaialable use GetDeviceType(devID) see 2.3 API
-
- -- same as above for removing the function name
-function RemoveFuncName(path, func)
- file,err = io.open(path,"r")
- if err then return 0 end
-
- t = { }
- i=1
- for line in file:lines() do
- if line == nil then break end
- -- check if the function name exist
- if not string.find(line, func)then
- t[i] = line
- i= i + 1
- end
- end
- file:close()
-
- -- write mode, delete previous data
- file, err = io.open(path,"w+")
- if err then return 0 end
-
- for k, v in pairs(t) do
- -- print(k .. " - " .. v .. "\n")
- -- add line
- file:write(v)
- file:write("\n")
- end
-
- file:close()
- return 1
-end
+-- --------------------------------------------
+-- KERS functions
+-- --------------------------------------------
--- get next function index available
--- typical usage GetNewFuncIndex(path):
--- on left list:
--- local num_available = GetNewFuncIndex("cfg/sli_left_functions.ecfg")
--- or right list:
--- local num_available = GetNewFuncIndex("cfg/sli_right_functions.ecfg")
-function GetNewFuncIndex(path)
- file,err = io.open(path,"r")
- if err then return 0 end
-
- idx = 0
- for line in file:lines() do
- if line == nil then break end
- -- get the prefix
- a = string.find(line, '.', 1, true)
- b = string.sub( line,1, a-1)
- -- print ( b .. "\n")
-
- -- string to num conversion
- c = (b + 0)
- -- store if it's greater
- if c > idx then idx = c end
- end
- file:close()
-
- return idx+1
+function GetKersPercent()
+ -- get kers value
+ local kers_level = GetCarInfo("kers")
+ local k_percent = 0
+ if kers_level ~= nil and kers_level > 0 then
+ k_percent = round((kers_level/1000) / 4 )
+ end
+ return k_percent
end
+
-- Init all globals
function InitGlobals()
-- default blink time delay
@@ -219,11 +179,14 @@ function InitGlobals()
gRedZone = 0
gOSPLimit = 0
mBU0710Leds = 0
+ mG27Leds = 0
+ mOSPMethod = 0
+ mFanatecLeds = 0
end
-- set RPM threshold value in percentage ( SLIMax Manager 2.1 )
function SetRPMPercentValue(index, value)
- if index <1 or index>13 then
+ if index <1 or index>15 then
return
end
if value <0 or value >100 then
@@ -235,7 +198,7 @@ end
-- set RPM threshold value ( SLIMax Manager 2.1 )
function SetRPMAbsoluteValue(index, value)
- if index <1 or index>13 then
+ if index <1 or index>15 then
return
end
if value <0 or value >20000 then
@@ -309,7 +272,8 @@ end
function toggleAllLed(val)
initLedTable(mRPMLedTable, val)
for i = 1, 6 do SetWarnLed(i, val) end
- for i = 1, 5 do SetExtLed(i, val) end
+ -- 7 external leds is the max value used in SIM RACE F1 and Emulator
+ for i = 1, 7 do SetExtLed(i, val) end
SetRPMLed("mRPMLedTable")
end
@@ -406,9 +370,15 @@ function GetTemp(tmp, selector)
end
end
+-- set refresh lap time rate in ms
+function SetRefreshLapTimeRate(delay)
+ if delay == nil or delay < 0 or delay > 5000 then delay = 50 end
+ mRefreshLapTimeRate = delay
+end
+
-- set delta time delay in ms
function SetDeltaTimeDelay(delay)
- if delay == nil or delay < 0 or delay > 5000 then delay = 700 end
+ if delay == nil or delay < 0 or delay > 5000 then delay = 200 end
mDeltatimeDelay = delay
end
@@ -416,16 +386,19 @@ end
function GetCurrentGear()
local g = GetCarInfo("gear")
-- get neutral
- local n = string.char(GetContextInfo("neutral"))
+ local n = GetContextInfo("neutral")
-- get reverse char and convert to string
local r = string.char(GetContextInfo("reverse"))
+ -- get state of custom Optimal Shift Point (OSP) records
+ local ospcustom_on = GetContextInfo("ospcustom")
-- set neutral, reverse or current gear
local result = g
if g == 0 then
- -- neutral
- result = n
+ -- if neutral and using custom OSP record then add a dot to gear digit
+ if ospcustom_on then n = n + 128 end
+ result = string.char(n)
elseif g < 0 then
-- reverse
result = r
@@ -434,6 +407,113 @@ function GetCurrentGear()
return result
end
+function isAppIRacing(sim)
+ if sim == "iRacingSim.exe" or sim == "iRacingSim64.exe" then
+ return true
+ end
+ return false
+end
+function isAppRFactor(sim)
+ if sim == "rFactor.exe" or sim == "rFactor2.exe" then
+ return true
+ end
+ return false
+end
+function DisplayFormatTime(lptime, delay, dec, deltaflag, numDigits)
+ local ticks = GetTicks()
+
+ if dft_old_time == nil or (ticks - dft_old_time) > delay then
+ -- global to backup ticks (ms)
+ dft_old_time = ticks
+
+ local hr = 0
+ local mn = 0
+ local sc = 0
+ local ms = 0
+ local hd = 0
+ local panel = ""
+ local prefix = " "
+
+ if lptime < 0 then
+ prefix = "-"
+ end
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lptime)
+
+ if deltaflag == 1 then
+ --display delta time
+ if lptime == -1 or (mn + sc + ms) == 0.0 then
+ if numDigits == 3 then
+ Panel = "-.--"
+ else
+ Panel = " -.-- "
+ end
+ elseif mn > 0 then
+ if numDigits == 3 then
+ if mn < 100 then
+ Panel = string.format( "%s%02d.", prefix, mn)
+ else
+ Panel = " ."
+ end
+
+ else
+ Panel = string.format( " %s%1d.%02d ", prefix, mn, sc)
+ end
+ else
+
+ if numDigits == 3 then
+ if sc < 10 then
+ if prefix == "-" then
+ Panel = string.format( "%s%1d.%01d ", prefix, sc, hd)
+ else
+ Panel = string.format( "%1d.%02d ", sc, hd)
+ end
+ else
+ Panel = " . "
+ end
+ else
+ if Ndig == 2 then
+ Panel = string.format( " %s%1d.%02d ", prefix, sc, hd)
+ else
+ Panel = string.format( " %s%1d.%03d", prefix, sc, ms)
+ end
+ end
+
+ end
+
+ elseif deltaflag == 0 then
+ --display laptime
+ if lptime == -1 or (mn + sc + ms) == 0.0 then
+ if numDigits == 3 then
+ Panel = "-.--"
+ else
+ Panel = "-:--.---"
+ end
+
+ elseif mn < 10 then
+ if numDigits == 3 then
+ Panel = string.format( "%1d.%02d", mn, sc)
+ else
+ Panel = string.format( "%1d:%02d.%03d", mn, sc, ms)
+ end
+ elseif hr > 0 then
+ if numDigits == 3 then
+ Panel = " . "
+ else
+ Panel = string.format( " %02d.%02d ", hr, mn)
+ end
+ else
+ if numDigits == 3 then
+ Panel = string.format( " %02d.", mn)
+ else
+ Panel = string.format( " %02d.%02d.%01d", mn, sc, ms)
+ end
+ end
+ end
+ end
+
+ return Panel
+end
--==============================================
require "scripts/slidevice"
diff --git a/scripts/global_custom_scripts.lua b/scripts/global_custom_scripts.lua
index 752dce5..bbf5e8b 100755..100644
--- a/scripts/global_custom_scripts.lua
+++ b/scripts/global_custom_scripts.lua
@@ -1,6 +1,6 @@
--- Global Custom SLIMax Manager Scripts v3
+-- Global Custom SLIMax Manager Scripts v3.6
-- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2013-02
+-- last change by Zappadoc - 2013-09
-- add you global custom functions and globals variables here
-- patch the std SLIMax Events with your global custom scripts if needed
@@ -25,26 +25,36 @@
-- ================================
-- custom functions
-
+function _DebugCarInfo(deviceType)
+ -- see debug console window
+ -- get car name
+ local dev = GetDeviceType(deviceType)
+ local cNm = "NA" --GetContextInfo("carname")
+ local mxG = GetCarInfo("maxgear")
+ local rdz = GetCarInfo("redzone")
+ local ospf = GetContextInfo("ospfactor")
+ print("\n----------\nDevice:"..dev.."\nMax RPM (Red Zone):" .. rdz .. "\nMaxGear:" .. mxG .. "\nOSP Factor:" .. ospf .. "\n");
+end
-- ================================
-- custom events
-function global_custom_controlsEvent(devType, ctrlType, ctrlPos, value, funcIndex)
+function global_custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice)
-- type your custom controls script here (manage buttons, switches and encoders)
return 2
end
-function global_custom_deviceReport(devType)
+function global_custom_deviceReport(deviceType)
-- type your script here (just before sending report to the device )
return 2
end
-function global_custom_enterSessionEvent(devType)
+function global_custom_enterSessionEvent(deviceType)
-- type your custom script on session start, here
+ _DebugCarInfo(deviceType)
return 2
end
-function global_custom_exitSessionEvent(devType)
+function global_custom_exitSessionEvent(deviceType)
-- type your custom script on session ending, here
return 2
end
@@ -83,6 +93,9 @@ function global_custom_spdLmtMethodEvent(idx)
return 2
end
+-- ================================
+-- SIM RACE Deluxe, SLI-PRO, SLI-M, BU0710 SUPPORT
+
function global_custom_gearEvent(gear)
-- type your custom gear event script here
return 2
@@ -139,27 +152,59 @@ function global_custom_gearFanatecEvent(gear)
return 2
end
+
-- ================================
--- local custom events PLACEHOLDERS
--- DO NOT CHANGE THE SCRIPT BELOW
+-- SIM RACE DELUXE SUPPORT
+
+function global_custom_shiftLightsSRDlxMethodEvent(idx)
+ -- type your custom script related to right SLI-PRO digits panel here
+ return 2
+end
+
+function global_custom_srdlxLeftDigitsEvent(swPosition)
+ -- type your custom script related to left SLI-PRO digits panel here
+ return 2
+end
+
+function global_custom_srdlxRightDigitsEvent(swPosition)
+ -- type your custom script related to right SLI-PRO digits panel here
+ return 2
+end
+
+function global_custom_ospSRDlxMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+ return 2
+end
+
+function global_custom_spdLmtSRDlxMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+ return 2
+end
+
-- ================================
-function custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex) return 2 end
-function custom_deviceReport(devType) return 2 end
-function custom_ospMethodEvent(idx) return 2 end
-function custom_ospG27MethodEvent(idx) return 2 end
-function custom_ospFanatecMethodEvent(idx) return 2 end
-function custom_shiftLightsMethodEvent(idx) return 2 end
-function custom_shiftLightsBU0710Event(idx) return 2 end
-function custom_shiftLightsG27LedsMethodEvent(idx) return 2 end
-function custom_shiftLightsFanatecMethodEvent(idx) return 2 end
-function custom_leftDigitsEvent(swPosition) return 2 end
-function custom_rightDigitsEvent(swPosition) return 2 end
-function custom_fanatecDigitsEvent(swPosition) return 2 end
-function custom_spdLmtMethodEvent(idx) return 2 end
-function custom_spdLmtG27MethodEvent(idx) return 2 end
-function custom_spdLmtFanatecMethodEvent(idx) return 2 end
-function custom_gearEvent(gear) return 2 end
-function custom_gearFanatecEvent(gear) return 2 end
-function custom_enterSessionEvent(devType) return 2 end
-function custom_exitSessionEvent(devType) return 2 end
-function custom_ledEvent(idx, ledFunction, state) return 2 end
+-- SIM RACE F1 SUPPORT
+
+function global_custom_shiftLightsSRF1MethodEvent(idx)
+ -- type your custom script related to right SLI-PRO digits panel here
+ return 2
+end
+
+function global_custom_srf1LeftDigitsEvent(swPosition)
+ -- type your custom script related to left SLI-PRO digits panel here
+ return 2
+end
+
+function global_custom_srf1RightDigitsEvent(swPosition)
+ -- type your custom script related to right SLI-PRO digits panel here
+ return 2
+end
+
+function global_custom_ospSRF1MethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+ return 2
+end
+
+function global_custom_spdLmtSRF1MethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+ return 2
+end \ No newline at end of file
diff --git a/scripts/led.lua b/scripts/led.lua
index 0e5cd1b..3f53380 100755..100644
--- a/scripts/led.lua
+++ b/scripts/led.lua
@@ -1,9 +1,9 @@
--- Part of SLIMax Mgr II - Lua Script v2.2
+-- Part of SLIMax Mgr II - Lua Script v2.2.1
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- Use this script to patch std led behaviors (i.e lowfuel, flags, damage, rev limit, ...)
-- created by Zappadoc - 2012-11-10
--- SLI-M, SLI-PRO, SLI-F1 led event
+-- Display led event
-- params:
-- idx = led index (assigned in settings)
-- state = the std state of the led; activated if > 0
diff --git a/scripts/osp.lua b/scripts/osp.lua
index b5ff08c..63e5f9f 100755..100644
--- a/scripts/osp.lua
+++ b/scripts/osp.lua
@@ -1,7 +1,7 @@
--- SLIMax Mgr Lua Script v3
+-- SLIMax Mgr Lua Script v3.3
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all Optimal ShiftPoints methods (OSP)
--- last change by Zappadoc - 2013-02
+-- last change by Zappadoc - 2013-10
function SetOSPFeedback(state)
if mOSPLED1 > 6 then
@@ -161,19 +161,19 @@ end
-- G27 Methods Event
function ospG27MethodEvent(idx)
- mOSPMethod = idx
+ mOSPG27Method = idx
-- OSP Limit default value is set in gear.lua
if gOSPLimit == nil or gOSPLimit == 0 then gOSPLimit = GetContextInfo("osplimitrpm") end
-- call custom script (this is a good place to overwrite gOSPLimit value)
- local result = custom_ospG27MethodEvent(mOSPMethod)
+ local result = custom_ospG27MethodEvent(mOSPG27Method)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script (this is a good place to overwrite gOSPLimit value)
- result = global_custom_ospG27MethodEvent(mOSPMethod)
+ result = global_custom_ospG27MethodEvent(mOSPG27Method)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
@@ -214,7 +214,7 @@ function ospG27MethodEvent(idx)
return 1
end
- -- print("MAXGear: " .. gear.."/"..maxGear.." OSP: " .. mOSPMethod .. " rpm: " .. rpm .. " - " .. gOSPLimit .. "\n")
+ -- print("MAXGear: " .. gear.."/"..maxGear.." OSP: " .. mOSPG27Method .. " rpm: " .. rpm .. " - " .. gOSPLimit .. "\n")
-- skip if first gear not allowed
@@ -239,7 +239,7 @@ function ospG27MethodEvent(idx)
mOSPBlink = mOSPBlink + 1
end
- if mOSPMethod <= 1 or mOSPMethod > 3 then
+ if mOSPG27Method <= 1 or mOSPG27Method > 3 then
-- methods 1 all blinking
if mOSPBlink >= mOSPBlinkTime then
mOSPBlink = 0
@@ -252,7 +252,7 @@ function ospG27MethodEvent(idx)
if mOSPBlink > (mOSPBlinkTime / 2) then
mG27Leds = 0;
end
- elseif mOSPMethod == 2 then
+ elseif mOSPG27Method == 2 then
-- methods side blinking
if mOSPBlink >= mOSPBlinkTime then
mOSPBlink = 0
@@ -266,7 +266,7 @@ function ospG27MethodEvent(idx)
mG27Leds = 0;
end
- elseif mOSPMethod == 3 then
+ elseif mOSPG27Method == 3 then
-- methods 3 center blinking
if mOSPBlink >= mOSPBlinkTime then
mOSPBlink = 0
@@ -296,19 +296,19 @@ end
-- Fanatec OSP Methods Event
function ospFanatecMethodEvent(idx)
- mOSPMethod = idx
+ mOSPFanatecMethod = idx
-- OSP Limit default value is set in gear.lua
if gOSPLimit == nil or gOSPLimit == 0 then gOSPLimit = GetContextInfo("osplimitrpm") end
-- call custom script (this is a good place to overwrite gOSPLimit value)
- local result = custom_ospFanatecMethodEvent(mOSPMethod)
+ local result = custom_ospFanatecMethodEvent(mOSPFanatecMethod)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script (this is a good place to overwrite gOSPLimit value)
- result = global_custom_ospFanatecMethodEvent(mOSPMethod)
+ result = global_custom_ospFanatecMethodEvent(mOSPFanatecMethod)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
@@ -373,21 +373,21 @@ function ospFanatecMethodEvent(idx)
end
if mOSPBlink <= (mOSPBlinkTime / 2) then
- if (mOSPMethod <= 0) or mOSPMethod > 4 then
+ if (mOSPFanatecMethod <= 0) or mOSPFanatecMethod > 4 then
-- blue leds blinking if method 0, ON
for i = 6,8 do
led = led.format("RPM%d",i)
mRPMLedTable[led] = 1
end
- elseif mOSPMethod == 1 then
+ elseif mOSPFanatecMethod == 1 then
-- all leds blinking if method 1, ON
for i = 0,8 do
led = led.format("RPM%d",i)
mRPMLedTable[led] = 1
end
- elseif mOSPMethod == 2 then
+ elseif mOSPFanatecMethod == 2 then
initLedTable(mRPMLedTable, 0)
-- side leds blinking if method 2, ON
mRPMLedTable["RPM0"] = 1
@@ -395,14 +395,14 @@ function ospFanatecMethodEvent(idx)
mRPMLedTable["RPM7"] = 1
mRPMLedTable["RPM8"] = 1
- elseif mOSPMethod == 3 then
+ elseif mOSPFanatecMethod == 3 then
initLedTable(mRPMLedTable, 0)
-- center leds blinking if method 3, ON
mRPMLedTable["RPM3"] = 1
mRPMLedTable["RPM4"] = 1
mRPMLedTable["RPM5"] = 1
- elseif mOSPMethod == 4 then
+ elseif mOSPFanatecMethod == 4 then
initLedTable(mRPMLedTable, 0)
-- side fixed if method 4, ON
mRPMLedTable["RPM0"] = 1
@@ -410,25 +410,25 @@ function ospFanatecMethodEvent(idx)
mRPMLedTable["RPM7"] = 1
mRPMLedTable["RPM8"] = 1
end
- SetFanatecLed("mRPMLedTable")
+ SetRPMLed("mRPMLedTable")
end
if mOSPBlink > (mOSPBlinkTime / 2) then
- if (mOSPMethod <= 0) or mOSPMethod > 4 then
+ if (mOSPFanatecMethod <= 0) or mOSPFanatecMethod > 4 then
-- blue leds blinking if method 0 , OFF
for i = 6,8 do
led = led.format("RPM%d",i)
mRPMLedTable[led] = 0
end
- elseif mOSPMethod == 1 then
+ elseif mOSPFanatecMethod == 1 then
-- all leds blinking if method 1, OFF
for i = 0,8 do
led = led.format("RPM%d",i)
mRPMLedTable[led] = 0
end
- elseif mOSPMethod == 2 then
+ elseif mOSPFanatecMethod == 2 then
initLedTable(mRPMLedTable, 0)
-- side leds blinking if method 2, OFF
mRPMLedTable["RPM0"] = 0
@@ -436,14 +436,14 @@ function ospFanatecMethodEvent(idx)
mRPMLedTable["RPM7"] = 0
mRPMLedTable["RPM8"] = 0
- elseif mOSPMethod == 3 then
+ elseif mOSPFanatecMethod == 3 then
initLedTable(mRPMLedTable, 0)
-- center leds blinking if method 3, OFF
mRPMLedTable["RPM3"] = 0
mRPMLedTable["RPM4"] = 0
mRPMLedTable["RPM5"] = 0
- elseif mOSPMethod == 4 then
+ elseif mOSPFanatecMethod == 4 then
initLedTable(mRPMLedTable, 0)
-- side fixed if method 4, ON
mRPMLedTable["RPM0"] = 1
@@ -451,7 +451,7 @@ function ospFanatecMethodEvent(idx)
mRPMLedTable["RPM7"] = 1
mRPMLedTable["RPM8"] = 1
end
- SetFanatecLed("mRPMLedTable")
+ SetRPMLed("mRPMLedTable")
end
end
@@ -465,4 +465,293 @@ function ospFanatecMethodEvent(idx)
end
return 1
+end
+
+-- ==================================================
+-- SIM RACE Deluxe OSP Methods Event
+
+function ospSRDlxMethodEvent(idx)
+ mOSPSRDlxMethod = idx
+ -- OSP Limit default value is set in gear.lua
+ if gOSPLimit == nil or gOSPLimit == 0 then gOSPLimit = GetContextInfo("osplimitrpm") end
+
+ -- call custom script (this is a good place to overwrite gOSPLimit value)
+ local result = custom_ospSRDlxMethodEvent(mOSPSRDlxMethod)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script (this is a good place to overwrite gOSPLimit value)
+ result = global_custom_ospSRDlxMethodEvent(mOSPSRDlxMethod)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- check if globals initialized
+ if isGlobalInitialized == 0 then
+ isGlobalInitialized = 1
+ -- init
+ InitGlobals()
+ end
+ -- get global prefs
+ GetSLIMaxInfo()
+
+ local led = ""
+
+ -- get rpm
+ local rpm = 0
+ rpm = GetCarInfo("rpm")
+ if rpm == nil then rpm = 0 end
+
+ -- get red zone value
+ --local redZone = GetCarInfo("redzone")
+ --if redZone == nil then redZone = 18000 end
+
+ -- get current osp factor
+ --local ospFactor = GetContextInfo("ospfactor")
+ --if ospFactor == nil then ospFactor = 80 end
+
+ -- get current gear
+ local gear = 0
+ gear = GetCarInfo("gear")
+ if gear == nil then gear = 0 end
+
+ -- get max gear of current car
+ -- Alternate way to calc max gear if not available in API
+ -- Use a global mMaxGear and do the following
+ -- if gear > mMaxGear then mMaxGear = gear end local maxGear = 4
+
+ maxGear = GetCarInfo("maxgear")
+ if maxGear == nil then maxGear = 4 end
+
+ -- skip if neutral or ==maxgear
+ if gear <=0 or gear>=maxGear then
+ -- do nothing
+ return 1
+ end
+
+ -- skip if first gear not allowed
+ if not mOSPWithFirstGear and gear == 1 then
+ -- do nothing
+ return 1
+ end
+
+ -- print("OSP1: " .. mOSPLED1 .. " OSP2: " .. mOSPLED2 .."\n")
+ -- print(rpm .. " - " .. gOSPLimit)
+
+ -- rpm > osplimit so activate shiftpoints leds
+ if rpm > gOSPLimit then
+
+ -- no blinking allowed
+ if mNoBlink then
+ -- set both leds
+ SetOSPFeedback(1)
+
+ else
+
+ if GetTicks() > mOldOSPTickCount then
+ mOSPBlink = mOSPBlink + 1
+ end
+
+ if mOSPSRDlxMethod <= 3 then
+ -- methods 1 to 3
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ if mOSPSRDlxMethod ~= 3 then
+ -- if not method 3
+ SetOSPFeedback(1)
+ end
+ if (mOSPSRDlxMethod == 1) or (mOSPSRDlxMethod == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 7,9 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ SetOSPFeedback(0)
+
+ if (mOSPSRDlxMethod == 1) or (mOSPSRDlxMethod == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 7,9 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ end
+
+ if mOSPSRDlxMethod == 2 then
+ -- add blue leds not blinking if method 2
+ for i = 7,9 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ else
+ -- bypass (give control to manager)
+ return 1
+ end
+ -- timebase
+ if GetTicks() > mOldOSPTickCount then
+ mOldOSPTickCount = GetTicks() + 10
+ end
+
+ return 1
+end
+
+
+-- ==================================================
+-- SIM RACE F1 OSP Methods Event
+
+function ospSRF1MethodEvent(idx)
+ mOSPSRF1Method = idx
+ -- OSP Limit default value is set in gear.lua
+ if gOSPLimit == nil or gOSPLimit == 0 then gOSPLimit = GetContextInfo("osplimitrpm") end
+
+ -- call custom script (this is a good place to overwrite gOSPLimit value)
+ local result = custom_ospSRF1MethodEvent(mOSPSRF1Method)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script (this is a good place to overwrite gOSPLimit value)
+ result = global_custom_ospSRF1MethodEvent(mOSPSRF1Method)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- check if globals initialized
+ if isGlobalInitialized == 0 then
+ isGlobalInitialized = 1
+ -- init
+ InitGlobals()
+ end
+ -- get global prefs
+ GetSLIMaxInfo()
+
+ local led = ""
+
+ -- get rpm
+ local rpm = 0
+ rpm = GetCarInfo("rpm")
+ if rpm == nil then rpm = 0 end
+
+ -- get red zone value
+ --local redZone = GetCarInfo("redzone")
+ --if redZone == nil then redZone = 18000 end
+
+ -- get current osp factor
+ --local ospFactor = GetContextInfo("ospfactor")
+ --if ospFactor == nil then ospFactor = 80 end
+
+ -- get current gear
+ local gear = 0
+ gear = GetCarInfo("gear")
+ if gear == nil then gear = 0 end
+
+ -- get max gear of current car
+ -- Alternate way to calc max gear if not available in API
+ -- Use a global mMaxGear and do the following
+ -- if gear > mMaxGear then mMaxGear = gear end local maxGear = 4
+
+ maxGear = GetCarInfo("maxgear")
+ if maxGear == nil then maxGear = 4 end
+
+ -- skip if neutral or ==maxgear
+ if gear <=0 or gear>=maxGear then
+ -- do nothing
+ return 1
+ end
+
+ -- skip if first gear not allowed
+ if not mOSPWithFirstGear and gear == 1 then
+ -- do nothing
+ return 1
+ end
+
+ -- print("OSP1: " .. mOSPLED1 .. " OSP2: " .. mOSPLED2 .."\n")
+ -- print(rpm .. " - " .. gOSPLimit)
+
+ -- rpm > osplimit so activate shiftpoints leds
+ if rpm > gOSPLimit then
+
+ -- no blinking allowed
+ if mNoBlink then
+ -- set both leds
+ SetOSPFeedback(1)
+
+ else
+
+ if GetTicks() > mOldOSPTickCount then
+ mOSPBlink = mOSPBlink + 1
+ end
+
+ if mOSPSRF1Method <= 3 then
+ -- methods 1 to 3
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ if mOSPSRF1Method ~= 3 then
+ -- if not method 3
+ SetOSPFeedback(1)
+ end
+ if (mOSPSRF1Method == 1) or (mOSPSRF1Method == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ SetOSPFeedback(0)
+
+ if (mOSPSRF1Method == 1) or (mOSPSRF1Method == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ end
+
+ if mOSPSRF1Method == 2 then
+ -- add blue leds not blinking if method 2
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ else
+ -- bypass (give control to manager)
+ return 1
+ end
+ -- timebase
+ if GetTicks() > mOldOSPTickCount then
+ mOldOSPTickCount = GetTicks() + 10
+ end
+
+ return 1
end \ No newline at end of file
diff --git a/scripts/shiftlights.lua b/scripts/shiftlights.lua
index 5e7f907..81e7f66 100755..100644
--- a/scripts/shiftlights.lua
+++ b/scripts/shiftlights.lua
@@ -1,7 +1,7 @@
--- SLIMax Mgr Lua Script v3
+-- SLIMax Mgr Lua Script v3.3.1
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all shiftlights methods
--- last change by Zappadoc - 2013-02
+-- last change by Zappadoc - 2013-10
-- ==============================================================================
-- utilities functions and methods
@@ -309,23 +309,267 @@ function SideToCenterFanatec(rpm, redzone, p1, p2, p3, p4 ,p5 )
if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end -- R
end
+-- --------------------------------------------
+-- --------------------------------------------
+-- SIM RACE Deluxe functions
+
+-- progressive method for SIM RACE Deluxe
+function ProgressiveSRDlx(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
+ local rz = redzone / 10.0
+ if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
+ if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
+ if rpm > (rz*p3) then mRPMLedTable.RPM2 = 1 end
+ if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
+ if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
+ if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
+ if rpm > (rz*p7) then mRPMLedTable.RPM6 = 1 end
+ if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
+ if rpm > (rz*p9) then mRPMLedTable.RPM8 = 1 end
+ if rpm > (rz*p9) then mRPMLedTable.RPM9 = 1 end
+end
+
+-- percentage method for SIM RACE Deluxe
+function PercentageSRDlx(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
+ local onePercent = redzone / 100
+ if p1>0 and rpm >= (p1*onePercent) then mRPMLedTable.RPM0 = 1 end -- y
+ if p2>0 and rpm >= (p2*onePercent) then mRPMLedTable.RPM1 = 1 end -- y
+ if p3>0 and rpm >= (p3*onePercent) then mRPMLedTable.RPM2 = 1 end -- y
+ if p4>0 and rpm >= (p4*onePercent) then mRPMLedTable.RPM3 = 1 end -- r
+ if p5>0 and rpm >= (p5*onePercent) then mRPMLedTable.RPM4 = 1 end -- r
+ if p6>0 and rpm >= (p6*onePercent) then mRPMLedTable.RPM5 = 1 end -- r
+ if p7>0 and rpm >= (p7*onePercent) then mRPMLedTable.RPM6 = 1 end -- r
+ if p8>0 and rpm >= (p8*onePercent) then mRPMLedTable.RPM7 = 1 end -- b
+ if p9>0 and rpm >= (p9*onePercent) then mRPMLedTable.RPM8 = 1 end -- b
+ if p9>0 and rpm >= (p9*onePercent) then mRPMLedTable.RPM9 = 1 end -- b
+end
+
+-- fixed rpm method for SIM RACE Deluxe (NOT RECOMMENDED)
+function RpmSRDlx(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 )
+ if rpm > p1 then mRPMLedTable.RPM0 = 1 end
+ if rpm > p2 then mRPMLedTable.RPM1 = 1 end
+ if rpm > p3 then mRPMLedTable.RPM2 = 1 end
+
+ if rpm > p4 then mRPMLedTable.RPM3 = 1 end
+ if rpm > p5 then mRPMLedTable.RPM4 = 1 end
+ if rpm > p6 then mRPMLedTable.RPM5 = 1 end
+ if rpm > p7 then mRPMLedTable.RPM6 = 1 end
+
+ if rpm > p8 then mRPMLedTable.RPM7 = 1 end
+ if rpm > p9 then mRPMLedTable.RPM8 = 1 end
+ if rpm > p10 then mRPMLedTable.RPM9 = 1 end
+
+end
+
+-- alternate yellow, red and blue method for SIM RACE Deluxe
+function AlternateSRDlx(rpm, redzone, step1, step2, step3)
+
+ local rz = redzone / 10.0
+ if rpm > (rz*step1) then
+ mRPMLedTable.RPM0 = 1 -- y
+ mRPMLedTable.RPM1 = 1 -- y
+ mRPMLedTable.RPM2 = 1 -- y
+ end
+ if rpm > (rz*step2) then
+ mRPMLedTable.RPM3 = 1 -- r
+ mRPMLedTable.RPM4 = 1 -- r
+ mRPMLedTable.RPM5 = 1 -- r
+ mRPMLedTable.RPM6 = 1 -- r
+ end
+ if rpm > (rz*step3) then
+ mRPMLedTable.RPM7 = 1 -- b
+ mRPMLedTable.RPM8 = 1 -- b
+ mRPMLedTable.RPM9 = 1 -- b
+ end
+end
+
+-- shiftlights method from side to center for SIM RACE Deluxe
+function SideToCenterSRDlx(rpm, redzone, p1, p2, p3, p4 ,p5 )
+
+ local rz = redzone / 100
+
+ -- side to center custom
+ if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end -- y
+ if rpm > (rz*p1) then mRPMLedTable.RPM9 = 1 end -- B
+
+ if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end -- y
+ if rpm > (rz*p2) then mRPMLedTable.RPM8 = 1 end -- B
+
+ if rpm > (rz*p3) then mRPMLedTable.RPM2 = 1 end -- y
+ if rpm > (rz*p3) then mRPMLedTable.RPM7 = 1 end -- B
+
+ if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end -- R
+ if rpm > (rz*p4) then mRPMLedTable.RPM6 = 1 end -- R
+
+ if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end -- R
+ if rpm > (rz*p5) then mRPMLedTable.RPM5 = 1 end -- R
+end
+
+-- --------------------------------------------
+-- --------------------------------------------
+-- SIM RACE F1 functions
+
+
+-- shiftlights method from side to center
+function SideToCenterSRF1(rpm, redzone, p1, p2, p3, p4 ,p5 ,p6 ,p7, p8)
+
+ local rz = redzone / 100
+
+ -- side to center custom
+ if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end -- G
+ if rpm > (rz*p1) then mRPMLedTable.RPM14 = 1 end -- B
+
+ if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end -- G
+ if rpm > (rz*p2) then mRPMLedTable.RPM13 = 1 end -- B
+
+ if rpm > (rz*p3) then mRPMLedTable.RPM2 = 1 end -- G
+ if rpm > (rz*p3) then mRPMLedTable.RPM12 = 1 end -- B
+ if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end -- G
+ if rpm > (rz*p4) then mRPMLedTable.RPM11 = 1 end -- B
+
+ if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end -- R
+ if rpm > (rz*p5) then mRPMLedTable.RPM10 = 1 end -- R
+
+ if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end -- R
+ if rpm > (rz*p6) then mRPMLedTable.RPM9 = 1 end -- R
+
+ if rpm > (rz*p7) then mRPMLedTable.RPM6 = 1 end -- R
+ if rpm > (rz*p7) then mRPMLedTable.RPM8 = 1 end -- R
+
+ if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end -- R
+
+end
+
+-- progressive method
+function ProgressiveSRF1(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 )
+ local rz = redzone / 15
+ -- print("progessive")
+ if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
+ if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
+ if rpm > (rz*p3) then mRPMLedTable.RPM2 = 1 end
+ if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
+ if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
+
+ if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
+ if rpm > (rz*p7) then mRPMLedTable.RPM6 = 1 end
+ if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
+ if rpm > (rz*p9) then mRPMLedTable.RPM8 = 1 end
+ if rpm > (rz*p10) then mRPMLedTable.RPM9 = 1 end
+
+ if rpm > (rz*p11) then mRPMLedTable.RPM10 = 1 end
+ if rpm > (rz*p12) then mRPMLedTable.RPM11 = 1 end
+ if rpm > (rz*p13) then mRPMLedTable.RPM12 = 1 end
+ if rpm > (rz*p14) then mRPMLedTable.RPM13 = 1 end
+ if rpm > (rz*p15) then mRPMLedTable.RPM14 = 1 end
+
+end
+
+-- alternate green, red and blue method
+function AlternateSRF1(rpm, redzone, step1, step2, step3)
+
+ local rz = redzone / 15
+ if rpm > (rz*step1) then
+ mRPMLedTable.RPM0 = 1 -- G
+ mRPMLedTable.RPM1 = 1 -- G
+ mRPMLedTable.RPM2 = 1 -- G
+ mRPMLedTable.RPM3 = 1 -- G
+ mRPMLedTable.RPM4 = 1 -- R
+ end
+ if rpm > (rz*step2) then
+ mRPMLedTable.RPM5 = 1 -- R
+ mRPMLedTable.RPM6 = 1 -- R
+ mRPMLedTable.RPM7 = 1 -- R
+ mRPMLedTable.RPM8 = 1 -- R
+ mRPMLedTable.RPM9 = 1 -- B
+ end
+ if rpm > (rz*step3) then
+ mRPMLedTable.RPM10 = 1 -- B
+ mRPMLedTable.RPM11 = 1 -- B
+ mRPMLedTable.RPM12 = 1 -- B
+ mRPMLedTable.RPM13 = 1 -- B
+ mRPMLedTable.RPM14 = 1 -- B
+ end
+end
+
+function PercentageSRF1(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 )
+ local onePercent = redzone / 100
+ if p1>0 and rpm >= (p1*onePercent) then mRPMLedTable.RPM0 = 1 end -- G
+ if p2>0 and rpm >= (p2*onePercent) then mRPMLedTable.RPM1 = 1 end -- G
+ if p3>0 and rpm >= (p3*onePercent) then mRPMLedTable.RPM2 = 1 end -- G
+ if p4>0 and rpm >= (p4*onePercent) then mRPMLedTable.RPM3 = 1 end -- G
+ if p5>0 and rpm >= (p5*onePercent) then mRPMLedTable.RPM4 = 1 end -- G
+ if p6>0 and rpm >= (p6*onePercent) then mRPMLedTable.RPM5 = 1 end -- R
+ if p7>0 and rpm >= (p7*onePercent) then mRPMLedTable.RPM6 = 1 end -- R
+ if p8>0 and rpm >= (p8*onePercent) then mRPMLedTable.RPM7 = 1 end -- R
+ if p9>0 and rpm >= (p9*onePercent) then mRPMLedTable.RPM8 = 1 end -- R
+ if p10>0 and rpm >= (p10*onePercent) then mRPMLedTable.RPM9 = 1 end -- R
+ if p11>0 and rpm >= (p11*onePercent) then mRPMLedTable.RPM10 = 1 end -- B
+ if p12>0 and rpm >= (p12*onePercent) then mRPMLedTable.RPM11 = 1 end -- B
+ if p13>0 and rpm >= (p13*onePercent) then mRPMLedTable.RPM12 = 1 end -- B
+ if p14>0 and rpm >= (p14*onePercent) then mRPMLedTable.RPM13 = 1 end -- B
+ if p15>0 and rpm >= (p15*onePercent) then mRPMLedTable.RPM14 = 1 end -- B
+end
+
+-- fixed rpm method, set rpm for each led (NOT RECOMMENDED)
+function RpmSRF1(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 )
+ if p1>0 and rpm >= p1 then mRPMLedTable.RPM0 = 1 end -- G
+ if p2>0 and rpm >= p2 then mRPMLedTable.RPM1 = 1 end -- G
+ if p3>0 and rpm >= p3 then mRPMLedTable.RPM2 = 1 end -- G
+ if p4>0 and rpm >= p4 then mRPMLedTable.RPM3 = 1 end -- G
+ if p5>0 and rpm >= p5 then mRPMLedTable.RPM4 = 1 end -- G
+ if p6>0 and rpm >= p6 then mRPMLedTable.RPM5 = 1 end -- R
+ if p7>0 and rpm >= p7 then mRPMLedTable.RPM6 = 1 end -- R
+ if p8>0 and rpm >= p8 then mRPMLedTable.RPM7 = 1 end -- R
+ if p9>0 and rpm >= p9 then mRPMLedTable.RPM8 = 1 end -- R
+ if p10>0 and rpm >= p10 then mRPMLedTable.RPM9 = 1 end -- R
+ if p11>0 and rpm >= p11 then mRPMLedTable.RPM10 = 1 end -- B
+ if p12>0 and rpm >= p12 then mRPMLedTable.RPM11 = 1 end -- B
+ if p13>0 and rpm >= p13 then mRPMLedTable.RPM12 = 1 end -- B
+ if p14>0 and rpm >= p14 then mRPMLedTable.RPM13 = 1 end -- B
+ if p15>0 and rpm >= p15 then mRPMLedTable.RPM14 = 1 end -- B
+end
+
+-- progressive method but with rpm value for eah led
+function ProgressiveFixedSRF1(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 )
+ -- progressive method with thresholds as parameters
+ if rpm > p1 then mRPMLedTable.RPM0 = 1 end
+ if rpm > p2 then mRPMLedTable.RPM1 = 1 end
+ if rpm > p3 then mRPMLedTable.RPM2 = 1 end
+ if rpm > p4 then mRPMLedTable.RPM3 = 1 end
+
+ if rpm > p5 then mRPMLedTable.RPM4 = 1 end
+ if rpm > p6 then mRPMLedTable.RPM5 = 1 end
+ if rpm > p7 then mRPMLedTable.RPM6 = 1 end
+ if rpm > p8 then mRPMLedTable.RPM7 = 1 end
+ if rpm > p9 then mRPMLedTable.RPM8 = 1 end
+
+ if rpm > p10 then mRPMLedTable.RPM9 = 1 end
+ if rpm > p11 then mRPMLedTable.RPM10 = 1 end
+ if rpm > p12 then mRPMLedTable.RPM11 = 1 end
+ if rpm > p13 then mRPMLedTable.RPM12 = 1 end
+ if rpm > p14 then mRPMLedTable.RPM13 = 1 end
+ if rpm > p15 then mRPMLedTable.RPM14 = 1 end
+end
+
+
+-- ==============================================================================
-- ==============================================================================
-- SLI-M, SLI-PRO ShiftLights Methods Event
function shiftLightsMethodEvent(idx)
+ mShiftlightsMethodIndex = idx
-- get red zone (red zone default value is initialized in gear.lua )
if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
-- call custom script
- local result = custom_shiftLightsMethodEvent(idx)
+ local result = custom_shiftLightsMethodEvent(mShiftlightsMethodIndex)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_shiftLightsMethodEvent(idx)
+ result = global_custom_shiftLightsMethodEvent(mShiftlightsMethodIndex)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
@@ -336,30 +580,36 @@ function shiftLightsMethodEvent(idx)
rpm = GetCarInfo("rpm")
if rpm == nil then rpm = 0 end
- -- init leds (see global.lua)
initLedTable(mRPMLedTable, 0)
- if idx == 0 then
+ if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
+ -- no shiftlights on last gear
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
+ end
+
+ if mShiftlightsMethodIndex == 0 then
-- progressive method 0
ProgressiveSLI(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 12.8, 12.98 )
- elseif idx == 1 then
+ elseif mShiftlightsMethodIndex == 1 then
-- alternate method 1
AlternateSLI(rpm, gRedZone, 11.0, 12.0, 12.9)
- elseif idx == 2 then
+ elseif mShiftlightsMethodIndex == 2 then
-- percentage method 2
PercentageSLI(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9], RPM_PERCENT_VALUES[10], RPM_PERCENT_VALUES[11], RPM_PERCENT_VALUES[12], RPM_PERCENT_VALUES[13] )
- elseif idx == 3 then
+ elseif mShiftlightsMethodIndex == 3 then
-- abs rpm method 3 (not recommended)
RpmSLI(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9], RPM_ABSOLUTE_VALUES[10], RPM_ABSOLUTE_VALUES[11], RPM_ABSOLUTE_VALUES[12], RPM_ABSOLUTE_VALUES[13] )
- elseif idx == 4 then
+ elseif mShiftlightsMethodIndex == 4 then
-- side to center method 4
SideToCenterSLI(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5 )
- elseif idx == 5 then
+ elseif mShiftlightsMethodIndex == 5 then
-- KERS + RPM
-- get kers value
@@ -376,7 +626,7 @@ function shiftLightsMethodEvent(idx)
if k_percent >= 50 then mRPMLedTable.RPM2 = 1 end
if k_percent >= 75 then mRPMLedTable.RPM3 = 1 end
- elseif idx == 6 then
+ elseif mShiftlightsMethodIndex == 6 then
-- Revers KERS + RPM
-- get kers value
@@ -406,19 +656,19 @@ end
-- BU0710 ShiftLights Methods Event
function shiftLightsBU0710Event(idx)
-
+ mShiftlightsBU0710MethodIndex = idx
-- get red zone (red zone default value is initialized in gear.lua )
if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
-- call custom script
- local result = custom_shiftLightsBU0710Event(idx)
+ local result = custom_shiftLightsBU0710Event(mShiftlightsBU0710MethodIndex)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_shiftLightsBU0710Event(idx)
+ result = global_custom_shiftLightsBU0710Event(mShiftlightsBU0710MethodIndex)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
@@ -429,22 +679,29 @@ function shiftLightsBU0710Event(idx)
-- init leds (see global.lua)
mBU0710Leds = 0
+
+ if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
+ -- no shiftlights on last gear
+ SetBU0710Led(mBU0710Leds)
+ return 1
+ end
- if (idx <= 1) or (idx >= 4) then
+ if (mShiftlightsBU0710MethodIndex <= 1) or (mShiftlightsBU0710MethodIndex >= 4) then
-- progressive methods 1 or 4
ProgressiveBU0710(rpm, gRedZone, 4.0, 6.0, 7.0, 7.5, 8.0, 8.5, 9.0, 9.3, 9.5, 9.7, 9.9 )
- elseif (idx == 2) then
+ elseif (mShiftlightsBU0710MethodIndex == 2) then
-- percentage method 2
PercentageBU0710(rpm, gRedZone, 84, 88, 90, 92, 93, 94, 95, 96, 97, 98, 99 )
- elseif (idx == 3) then
+ elseif (mShiftlightsBU0710MethodIndex == 3) then
-- abs method 3 (not recommended)
RpmBU0710(rpm, 15823, 16354, 16410, 16675, 17252, 17545, 17823, 18354, 18510, 18655, 18675 )
else
return 1
end
+
SetBU0710Led(mBU0710Leds)
return 1
end
@@ -453,19 +710,19 @@ end
-- G27 ShiftLights Methods Event
function shiftLightsG27LedsMethodEvent(idx)
+ mShiftlightsG27MethodIndex = idx
-- get red zone (red zone default value is initialized in gear.lua )
-
if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
-- call custom script
- local result = custom_shiftLightsG27LedsMethodEvent(idx)
+ local result = custom_shiftLightsG27LedsMethodEvent(mShiftlightsG27MethodIndex)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_shiftLightsG27LedsMethodEvent(idx)
+ result = global_custom_shiftLightsG27LedsMethodEvent(mShiftlightsG27MethodIndex)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
@@ -476,23 +733,30 @@ function shiftLightsG27LedsMethodEvent(idx)
-- init leds (see global.lua)
mG27Leds = 0
-
- if idx <= 0 or idx >= 3 then
+
+ if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
+ -- no shiftlights on last gear
+ SetG27Led(mG27Leds)
+ return 1
+ end
+
+ if mShiftlightsG27MethodIndex <= 0 or mShiftlightsG27MethodIndex >= 3 then
-- progressive methods 1
ProgressiveG27(rpm, gRedZone, 2.0, 2.5, 3.5, 4.5, 4.9 )
- elseif idx == 1 then
+ elseif mShiftlightsG27MethodIndex == 1 then
-- percentage method 2
--PercentageG27(rpm, gRedZone, 88, 92, 95, 97, 99 )
PercentageG27(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5] )
- elseif idx == 2 then
+ elseif mShiftlightsG27MethodIndex == 2 then
-- abs method 3 (not recommended)
RpmG27(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5] )
else
return 1
end
+
SetG27Led(mG27Leds)
return 1
end
@@ -501,19 +765,19 @@ end
-- Fanatec ShiftLights Methods Event
function shiftLightsFanatecMethodEvent(idx)
- -- get red zone (red zone default value is initialized in gear.lua )
-
+ mShiftlightsFanatecMethodIndex = idx
+ -- get red zone (red zone default value is initialized in gear.lua )
if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
-- call custom script
- local result = custom_shiftLightsFanatecMethodEvent(idx)
+ local result = custom_shiftLightsFanatecMethodEvent(mShiftlightsFanatecMethodIndex)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_shiftLightsFanatecMethodEvent(idx)
+ result = global_custom_shiftLightsFanatecMethodEvent(mShiftlightsFanatecMethodIndex)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
@@ -524,28 +788,35 @@ function shiftLightsFanatecMethodEvent(idx)
-- init leds (see global.lua)
initLedTable(mRPMLedTable, 0)
-
- if (idx < 1) or (idx > 6) then
+
+ if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
+ -- no shiftlights on last gear
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
+ end
+
+ if (mShiftlightsFanatecMethodIndex < 1) or (mShiftlightsFanatecMethodIndex > 6) then
-- progressive methods 0
ProgressiveFanatec(rpm, gRedZone, 6.0, 6.5, 7.0, 7.5, 8.0, 8.3, 8.5, 8.7, 8.9 )
- elseif idx == 1 then
+ elseif mShiftlightsFanatecMethodIndex == 1 then
-- alternate method 1
AlternateFanatec(rpm, gRedZone, 7.0, 8.0, 8.9)
- elseif (idx == 2) then
+ elseif (mShiftlightsFanatecMethodIndex == 2) then
-- percentage method 2
PercentageFanatec(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9] )
- elseif (idx == 3) then
+ elseif (mShiftlightsFanatecMethodIndex == 3) then
-- abs method 3 (not recommended)
RpmFanatec(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9] )
- elseif idx == 4 then
+ elseif mShiftlightsFanatecMethodIndex == 4 then
-- side to center method 4
SideToCenterFanatec(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5 )
- elseif idx == 5 then
+ elseif mShiftlightsFanatecMethodIndex == 5 then
-- KERS + RPM
-- get kers value, see function in global.lua
@@ -562,7 +833,7 @@ function shiftLightsFanatecMethodEvent(idx)
if k_percent >= 33 then mRPMLedTable.RPM1 = 1 end
if k_percent >= 66 then mRPMLedTable.RPM2 = 1 end
- elseif idx == 6 then
+ elseif mShiftlightsFanatecMethodIndex == 6 then
-- Revers KERS + RPM
-- get kers value, see function in global.lua
@@ -583,10 +854,206 @@ function shiftLightsFanatecMethodEvent(idx)
return 1
end
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
+end
+
+
+
+ -- SIM RACE Deluxe ShiftLights Methods Event
+function shiftLightsSRDlxMethodEvent(idx)
+ mShiftlightsSRDlxMethodIndex = idx
+ -- get red zone (red zone default value is initialized in gear.lua )
+ if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
+
+ -- call custom script
+ local result = custom_shiftLightsSRDlxMethodEvent(mShiftlightsSRDlxMethodIndex)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_shiftLightsSRDlxMethodEvent(mShiftlightsSRDlxMethodIndex)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+ -- get rpm
+ local rpm = 0
+ rpm = GetCarInfo("rpm")
+ if rpm == nil then rpm = 0 end
+
+ -- init leds (see global.lua)
+ initLedTable(mRPMLedTable, 0)
+ if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
+ -- no shiftlights on last gear
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
+ end
+
+ if mShiftlightsSRDlxMethodIndex == 0 then
+ -- progressive method 0
+ ProgressiveSRDlx(rpm, gRedZone, 5, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 9.8, 9.98 )
+
+ elseif mShiftlightsSRDlxMethodIndex == 1 then
+ -- alternate method 1
+ AlternateSRDlx(rpm, gRedZone, 7.0, 8.0, 9.9)
+
+ elseif mShiftlightsSRDlxMethodIndex == 2 then
+ -- percentage method 2
+ PercentageSRDlx(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9], RPM_PERCENT_VALUES[10] )
+
+ elseif mShiftlightsSRDlxMethodIndex == 3 then
+ -- abs rpm method 3 (not recommended)
+ RpmSRDlx(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9], RPM_ABSOLUTE_VALUES[10] )
+
+ elseif mShiftlightsSRDlxMethodIndex == 4 then
+ -- side to center method 4
+ SideToCenterSRDlx(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5 )
+
+ elseif mShiftlightsSRDlxMethodIndex == 5 then
+ -- KERS + RPM
+
+ -- get kers value
+ local k_percent = GetKersPercent()
+
+ -- without first 4 green leds
+ AlternateSRDlx(rpm, gRedZone, 100, 8.6, 9.9)
+
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+
+ if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
+ if k_percent >= 33 then mRPMLedTable.RPM1 = 1 end
+ if k_percent >= 66 then mRPMLedTable.RPM2 = 1 end
+
+ elseif mShiftlightsSRDlxMethodIndex == 6 then
+ -- Revers KERS + RPM
+
+ -- get kers value
+ local k_percent = GetKersPercent()
+
+ -- without first 4 green leds
+ AlternateSRDlx(rpm, gRedZone, 0, 8.6, 9.9)
+
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+
+ if k_percent > 0 then mRPMLedTable.RPM2 = 0 end
+ if k_percent >= 33 then mRPMLedTable.RPM1 = 0 end
+ if k_percent >= 66 then mRPMLedTable.RPM0 = 0 end
+
+ else
+ return 1
+ end
+
local tName = "mRPMLedTable"
- SetFanatecLed(tName)
+ SetRPMLed(tName)
return 1
end
+
+ -- SIM RACE F1 ShiftLights Methods Event
+function shiftLightsSRF1MethodEvent(idx)
+ mShiftlightsSRF1MethodIndex = idx
+ -- get red zone (red zone default value is initialized in gear.lua )
+ if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
+
+ -- call custom script
+ local result = custom_shiftLightsSRF1MethodEvent(mShiftlightsSRF1MethodIndex)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_shiftLightsSRF1MethodEvent(mShiftlightsSRF1MethodIndex)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- get rpm
+ local rpm = 0
+ rpm = GetCarInfo("rpm")
+ if rpm == nil then rpm = 0 end
+
+ -- init leds (see global.lua)
+ initLedTable(mRPMLedTable, 0)
+
+ if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
+ -- no shiftlights on last gear
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
+ end
+
+ if mShiftlightsSRF1MethodIndex == 0 then
+ -- progressive method 0
+ ProgressiveSRF1(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14.5, 14.99 )
+
+ elseif mShiftlightsSRF1MethodIndex == 1 then
+ -- alternate method 1
+ AlternateSRF1(rpm, gRedZone, 12.0, 13.0, 14.9)
+
+ elseif mShiftlightsSRF1MethodIndex == 2 then
+ -- percentage method 2
+ PercentageSRF1(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9], RPM_PERCENT_VALUES[10], RPM_PERCENT_VALUES[11], RPM_PERCENT_VALUES[12], RPM_PERCENT_VALUES[13], RPM_PERCENT_VALUES[14], RPM_PERCENT_VALUES[15] )
+
+ elseif mShiftlightsSRF1MethodIndex == 3 then
+ -- abs rpm method 3 (not recommended)
+ RpmSRF1(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9], RPM_ABSOLUTE_VALUES[10], RPM_PERCENT_VALUES[11], RPM_PERCENT_VALUES[12], RPM_PERCENT_VALUES[13], RPM_PERCENT_VALUES[14], RPM_PERCENT_VALUES[15] )
+
+ elseif mShiftlightsSRF1MethodIndex == 4 then
+ -- side to center method 4
+ SideToCenterSRF1(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5 )
+
+ elseif mShiftlightsSRF1MethodIndex == 5 then
+ -- KERS + RPM
+
+ -- get kers value
+ local k_percent = GetKersPercent()
+
+ -- without first 4 green leds
+ AlternateSRF1(rpm, gRedZone, 100, 13.6, 14.9)
+
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+
+ if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
+ if k_percent >= 20 then mRPMLedTable.RPM1 = 1 end
+ if k_percent >= 40 then mRPMLedTable.RPM2 = 1 end
+ if k_percent >= 60 then mRPMLedTable.RPM3 = 1 end
+ if k_percent >= 80 then mRPMLedTable.RPM4 = 1 end
+
+ elseif mShiftlightsSRF1MethodIndex == 6 then
+ -- Revers KERS + RPM
+
+ -- get kers value
+ local k_percent = GetKersPercent()
+
+ -- without first 4 green leds
+ AlternateSRF1(rpm, gRedZone, 0, 13.6, 14.9)
+
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+
+ if k_percent > 0 then mRPMLedTable.RPM4 = 0 end
+ if k_percent >= 20 then mRPMLedTable.RPM3 = 0 end
+ if k_percent >= 40 then mRPMLedTable.RPM2 = 0 end
+ if k_percent >= 60 then mRPMLedTable.RPM1 = 0 end
+ if k_percent >= 80 then mRPMLedTable.RPM0 = 0 end
+
+ else
+ return 1
+ end
+
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
+end
diff --git a/scripts/simracedlx.lua b/scripts/simracedlx.lua
new file mode 100644
index 0000000..fe716ea
--- /dev/null
+++ b/scripts/simracedlx.lua
@@ -0,0 +1,537 @@
+-- SIMRACE DELUXE Lua Script v1.5
+-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
+-- this script builds all functions associated with
+-- left and right panels of SIMRACE-DLX device
+-- last change by Zappadoc - 2013-09
+
+-- ============================================================
+-- Left and Right Panel functions
+-- ============================================================
+function srdlxLeftDigitsEvent(swFunction)
+ return srdlxDigitsEvent(swFunction, 0)
+end
+function srdlxRightDigitsEvent(swFunction)
+ return srdlxDigitsEvent(swFunction, 1)
+end
+-- IN function of left panel
+-- param: recieve from SLI Manager the current switch position
+function srdlxDigitsEvent(swFunction, side)
+ swValue = swFunction + 1
+
+ -- call custom script
+ if side == 0 then
+ local result = custom_srdlxLeftDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_srdlxLeftDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+ else
+ local result = custom_srdlxRightDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_srdlxRightDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+ end
+
+ local hr = 0
+ local mn = 0
+ local sc = 0
+ local ms = 0
+ local hd = 0
+ local lpt = 0.0
+ local diffTimeFlag = false
+ local timeFlag = false
+ local systemflag = false
+ local unit = false
+ local inf = ""
+ local spd = 0.0
+ local isSlowUpdate = false
+ local srdlxPanel = ""
+
+ -- 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")
+
+ -- lap finished, display lap time a few seconds
+ local dlt = false
+ dlt = GetContextInfo("displaylaptime")
+ if dlt == nil then dlt = false end
+ if dlt and side == 1 then
+ swValue = 11
+ 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 left and right panel
+ local qiInf = 1
+ if side == 0 then
+ qiInf = GetContextInfo("f1quickinfoleft")
+ else
+ qiInf = GetContextInfo("f1quickinforight")
+ end
+ if qiInf == nil then qiInf = 1 end
+ -- force position to match QI preference
+ swValue = qiInf
+ 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
+ if side == 0 then
+ swValue = 45
+ else
+ swValue = 1
+ end
+ end
+ end
+
+ -- get current simulation name
+ local sim = GetContextInfo("simulation")
+
+ --print ( "swValue: " .. swValue .. "\n")
+
+ -- check postion and compute left panel string
+ if swValue == 1 then
+ -- speed only
+ srdlxPanel = string.format("%3.0f ", spd )
+
+ elseif swValue == 2 then
+ -- fuel
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ srdlxPanel = string.format("F%3d", round(fuel))
+ elseif fuel >= 10 then
+ srdlxPanel = string.format("F%02d ", round(fuel))
+ else
+ srdlxPanel = string.format("F%1.1f ", fuel)
+ end
+ end
+ elseif swValue == 3 then
+ -- position
+ inf = GetContextInfo("position")
+ if inf ~= nil then
+ if inf >= 100 then
+ srdlxPanel = string.format("P%3d", inf)
+ else
+ srdlxPanel = string.format("P%02d ", inf)
+ end
+ end
+ elseif swValue == 4 then
+ -- laps completed
+ inf = GetContextInfo("laps")
+ if inf ~= nil then
+ -- if more then 99 laps
+ if inf >= 100 then
+ srdlxPanel = string.format("L%3d", inf)
+ else
+ srdlxPanel = string.format("L%02d ", inf)
+ end
+ end
+ elseif swValue == 5 then
+ -- sector
+ inf = GetCarInfo("sector")
+ if inf ~= nil then
+ -- check if sector > 9
+ if inf >9 then
+ srdlxPanel = string.format("S%02d ", inf)
+ else
+ srdlxPanel = string.format("S%01d ", inf)
+ end
+ end
+ elseif swValue == 6 then
+ -- total laps if available
+ local tl = GetContextInfo("lapscount")
+ if tl < 1 then tl = 0 end
+ -- if more then 99 laps
+ if tl >= 100 or tl >= 100 then
+ srdlxPanel = string.format("%03d ", tl)
+ else
+ srdlxPanel = string.format("t%02d ", tl)
+ end
+
+ elseif swValue == 7 then
+ -- water temp
+ inf = GetCarInfo("watertemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ srdlxPanel = string.format("%2.1f ", inf)
+ end
+ elseif swValue == 8 then
+ -- oil temp
+ inf = GetCarInfo("oiltemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ srdlxPanel = string.format("%2.1f ", inf)
+ end
+
+ elseif swValue == 9 then
+ -- best lap time
+ timeFlag = true
+ lpt = GetTimeInfo("laptime")
+
+ elseif swValue == 10 then
+ -- best lap time
+ timeFlag = true
+ lpt = GetTimeInfo("bestlaptime")
+
+ elseif swValue == 11 then
+ -- last lap time
+ timeFlag = true
+ lpt = GetTimeInfo("lastlaptime")
+
+ elseif swValue >= 12 and swValue <= 18 and isAppIRacing(sim) then
+ timeFlag = true
+ diffTimeFlag = true
+ -- iRacing partials
+ local ts = GetContextInfo("partialcount")
+ local sector = GetCarInfo("sector")
+ if ts ~= nil and ts > 0 then
+ if swValue == 12 then
+ lpt = GetPartialTimeInfo("currentpartial", sector)
+ elseif swValue == 13 then
+ lpt = GetPartialTimeInfo("vsbestlap", sector)
+ elseif swValue == 14 then
+ lpt = GetPartialTimeInfo("vsoptimallap", sector)
+ elseif swValue == 15 then
+ lpt = GetPartialTimeInfo("vsoptimalsector", sector)
+ elseif swValue == 16 then
+ lpt = GetPartialTimeInfo("vssessionbestlap", sector)
+ elseif swValue == 17 then
+ lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
+ elseif swValue == 18 then
+ lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
+ end
+ else
+ lpt = 0.0
+ end
+
+ elseif swValue == 19 then
+ -- real time diff vs your best
+ diffTimeFlag = true
+ timeFlag = true
+ lpt = GetTimeInfo("realdiffbest")
+
+ elseif swValue == 20 then
+ -- real time diff vs your last
+ diffTimeFlag = true
+ timeFlag = true
+ lpt = GetTimeInfo("realdifflast")
+
+ elseif swValue == 21 then
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ srdlxPanel = string.format("L%3.0f", math.floor(remainintank) )
+
+ elseif swValue == 22 then
+ -- rpm
+ isSlowUpdate = true
+ diffTimeFlag = true
+ local rpm = GetCarInfo("rpm")
+ local r = rpm / 10.0
+ if r < 1000 then
+ srdlxPanel = string.format("%3.1f", r)
+ else
+ srdlxPanel = string.format("%4d.", round(r))
+ end
+ elseif swValue == 23 then
+ -- track size
+ isSlowUpdate = true
+ diffTimeFlag = true
+ local trcksz = GetContextInfo("tracksize")
+ local r = trcksz / 10
+ if r < 1000 then
+ srdlxPanel = string.format("%3.1f", r)
+ else
+ srdlxPanel = string.format("%4d.", round(r))
+ end
+
+ elseif swValue == 24 then
+ -- distance percent
+ local dist = GetContextInfo("lapdistance")
+ -- track size
+ local trcksz = GetContextInfo("tracksize")
+ local p = round(dist / (trcksz / 100))
+ srdlxPanel = string.format("%3d ", p )
+
+ elseif swValue == 25 then
+ -- kers
+ local kers = GetCarInfo("kers")
+ srdlxPanel = string.format("%3d ", round(kers/1000))
+
+ elseif swValue == 26 then
+ -- kers max
+ local kmx = GetCarInfo("kersmax")
+ srdlxPanel = string.format("%3d ", round(kmx/1000))
+
+ elseif swValue == 27 then
+ -- drs
+ local drs = GetCarInfo("drs")
+ if drs == 1 then
+ srdlxPanel = "ON "
+ else
+ srdlxPanel = "OFF"
+ end
+
+ elseif swValue == 28 then
+ -- kers percent
+ local kers = GetCarInfo("kers")
+ srdlxPanel = string.format("%3d ", round((kers/1000)/4))
+
+ elseif swValue == 29 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
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 30 then
+ inf = GetCarInfo("wheeltempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 31 then
+ inf = GetCarInfo("wheeltemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 32 then
+ inf = GetCarInfo("wheeltemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 33 then
+ -- wheels pressure if available
+ inf = GetCarInfo("wheelpressfrontleft")
+ if inf ~= nil then
+ -- convert to psi
+ srdlxPanel = string.format("%2.1f ", inf / 6.88)
+ end
+
+ elseif swValue == 34 then
+ inf = GetCarInfo("wheelpressfrontright")
+ if inf ~= nil then
+ srdlxPanel = string.format("%2.1f ", inf / 6.88)
+ end
+
+ elseif swValue == 35 then
+ inf = GetCarInfo("wheelpressrearleft")
+ if inf ~= nil then
+ srdlxPanel = string.format("%2.1f ", inf / 6.88)
+ end
+
+ elseif swValue == 36 then
+ inf = GetCarInfo("wheelpressrearright")
+ if inf ~= nil then
+ srdlxPanel = string.format("%2.1f ", inf / 6.88)
+ end
+
+ elseif swValue == 37 then
+ -- brakes temp if available
+ inf = GetCarInfo("braketempfrontleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 38 then
+ inf = GetCarInfo("braketempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 39 then
+ inf = GetCarInfo("braketemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 40 then
+ inf = GetCarInfo("braketemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 41 then
+ -- time remaining if available
+ lpt = GetTimeInfo("timeremaining")
+ timeFlag = true
+
+ elseif swValue == 42 then
+ -- PC system time
+ systemflag = true
+ lpt = GetTimeInfo("systemtime")
+ timeFlag = true
+ diffTimeFlag = true
+ elseif swValue == 43 then
+ -- time elapsed if available
+ lpt = GetTimeInfo("timetotalelapsed")
+ timeFlag = true
+
+ elseif swValue == 44 then
+ -- last sector 1, 2 and 3
+ local sector = GetCarInfo("sector")
+ timeFlag = true
+ diffTimeFlag = true
+ if sector == 1 then
+ -- sector 3
+ local ls1 = GetTimeInfo("lastsector1")
+ local ls2 = GetTimeInfo("lastsector2")
+ local lt = GetTimeInfo("lastlaptime")
+ if ls1 > 0 and ls2 > 0 then
+ lpt = lt - (ls1 + ls2)
+ end
+ elseif sector == 2 then
+ local ls1 = GetTimeInfo("lastsector1")
+ lpt = ls1
+ else
+ -- sector 3
+ local ls2 = GetTimeInfo("lastsector2")
+ lpt = ls2
+ end
+
+ elseif swValue == 45 then
+ -- PIT
+ srdlxPanel = "PIt "
+
+ elseif swValue == 46 then
+ -- sc
+ local sc = GetContextInfo("safetycare")
+ if sc == 1 then
+ srdlxPanel = "SCAR"
+ else
+ srdlxPanel = "OFF "
+ end
+
+ else
+ srdlxPanel = " "
+ end
+
+ local refreshRate = mRefreshLapTimeRate
+ if diffTimeFlag then
+ refreshRate = mDeltaTimeDelay
+ end
+
+ if timeFlag and lpt ~= nil then
+
+ -- set char of negative number
+ 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 .."\n" )
+
+ -- update display every mDeltaTimeDelay time
+ if GetTicks() > (refreshRate + mDeltaTimeOldTicks ) then
+ mDeltaTimeOldTicks = GetTicks()
+
+ if lpt == -1 or (mn + sc + ms) == 0.0000 then
+ mDeltaTimeBackup = "-.---"
+
+ elseif systemflag then
+ mDeltaTimeBackup = string.format( "%2d.%02d", mn, sc)
+ -- > 9mn
+ elseif mn > 9 then
+ if c == "" then
+ mDeltaTimeBackup = string.format( "%2d.%2d", mn, sc)
+ else
+ mDeltaTimeBackup = string.format( "%s%2d ", c, mn)
+ end
+
+ -- < 10mn
+ elseif mn > 0 and mn < 10 then
+ if c == "" then
+ mDeltaTimeBackup = string.format( "%1d.%02d.%01d", mn, sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%1d.%02d", c, mn, sc)
+ end
+
+ else
+ -- mn == 0 ; sc > 9
+ if sc > 9 then
+ if c == "" then
+ mDeltaTimeBackup = string.format( "0.%2d.%1d", sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s0.%2d.", c, sc)
+ end
+ else
+ -- sc < 10
+ if c == "" then
+ mDeltaTimeBackup = string.format( "0.%01d.%02d", sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s0.%01d.%01d", c, sc, hd)
+ end
+ end
+ end
+ end
+
+ --print(srdlxPanel,mDeltaTimeBackup)
+ srdlxPanel = mDeltaTimeBackup
+ end
+
+ if isSlowUpdate then
+
+ if GetTicks() > ( refreshRate + mDeltaTimeOldTicks ) then
+ mDeltaTimeOldTicks = GetTicks()
+ if side == 0 then
+ mSRDlxLeftText = srdlxPanel
+ else
+ mSRDlxRightText = srdlxPanel
+ end
+ -- print(GetTicks() .. mSRDlxRightText .."\n")
+ end
+ else
+ if side == 0 then
+ mSRDlxLeftText = srdlxPanel
+ else
+ mSRDlxRightText = srdlxPanel
+ end
+ end
+
+ -- print(mSRDlxLeftText, mSRDlxRightText, srdlxPanel)
+ -- send string to sli manager
+ if side == 0 then
+ SetLeftDigits( mSRDlxLeftText )
+ else
+ SetRightDigits( mSRDlxRightText )
+ end
+
+ return 1
+end
diff --git a/scripts/simracedlx_iracing.lua b/scripts/simracedlx_iracing.lua
new file mode 100644
index 0000000..3dfb281
--- /dev/null
+++ b/scripts/simracedlx_iracing.lua
@@ -0,0 +1,11 @@
+-- iRacing Custom Scripts - SLIMax Manager Scripts v1.9
+-- Copyright ©2011-2013 by Zappadoc - All Rights Reserved.
+-- last change by Zappadoc - 2013-05
+
+-- ================================
+-- add the short desciption of your script(s) in mScript_Info global var
+mScript_Info = "A useful iRacing COMBO SETUP to select automatically the good settings for each iracing car you drive (shiftlights, max gears, osp, et.)."
+
+-- ================================
+-- load common scripts file
+require "scripts/zdoc_scripts/iracing_common_scripts" \ No newline at end of file
diff --git a/scripts/simracef1.lua b/scripts/simracef1.lua
new file mode 100644
index 0000000..c7503cd
--- /dev/null
+++ b/scripts/simracef1.lua
@@ -0,0 +1,694 @@
+-- SIMRACE F1 Lua Script v1.1.3
+-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
+-- this script builds all functions associated with
+-- left and right panels of SIMRACE-F1 device
+-- last change by Zappadoc - 2013-10
+
+-- ============================================================
+-- Left and Right Panel functions
+-- ============================================================
+function srf1LeftDigitsEvent(swFunction)
+ return srf1DigitsEvent(swFunction, 0)
+end
+function srf1RightDigitsEvent(swFunction)
+ return srf1DigitsEvent(swFunction, 1)
+end
+-- IN function of left panel
+-- param: recieve from SLI Manager the current switch position
+function srf1DigitsEvent(swFunction, side)
+ swValue = swFunction + 1
+
+ -- call custom script
+ if side == 0 then
+ local result = custom_srf1LeftDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_srf1LeftDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+ else
+ local result = custom_srf1RightDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_srf1RightDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+ end
+
+ local hr = 0
+ local mn = 0
+ local sc = 0
+ local ms = 0
+ local hd = 0
+ local lpt = 0.0
+ local diffTimeFlag = false
+ local timeFlag = false
+ local systemflag = false
+ local unit = false
+ local inf = ""
+ local spd = 0.0
+ local isSlowUpdate = false
+ local srf1Panel = ""
+
+ -- 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")
+
+ -- lap finished, display lap time a few seconds
+ local dlt = false
+ dlt = GetContextInfo("displaylaptime")
+ if dlt == nil then dlt = false end
+ if dlt and side == 1 and swValue ~= 47 and swValue ~= 48 then
+ swValue = 11
+ 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 left and right panel
+ local qiInf = 1
+ if side == 0 then
+ qiInf = GetContextInfo("quickinfoleft")
+ else
+ qiInf = GetContextInfo("quickinforight")
+ end
+ if qiInf == nil then qiInf = 1 end
+ -- force position to match QI preference
+ swValue = qiInf
+ 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
+ if side == 0 then
+ swValue = 45
+ else
+ swValue = 1
+ end
+ end
+ end
+
+ -- get current simulation name
+ local sim = GetContextInfo("simulation")
+
+ --print ( "swValue: " .. swValue .. "\n")
+
+ -- check postion and compute left panel string
+ if swValue == 1 then
+ -- speed only
+ srf1Panel = string.format("%3.0f ", spd )
+
+ elseif swValue == 2 then
+ -- fuel
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ srf1Panel = string.format("F%3d", round(fuel))
+ elseif fuel >= 10 then
+ srf1Panel = string.format("F%2d ", round(fuel))
+ else
+ srf1Panel = string.format("F%1.1f ", fuel)
+ end
+ end
+ elseif swValue == 3 then
+ -- position
+ inf = GetContextInfo("position")
+ if inf ~= nil then
+ if inf >= 100 then
+ srf1Panel = string.format("P%3d", inf)
+ elseif inf >= 10 then
+ srf1Panel = string.format("P%2d ", inf)
+ else
+ srf1Panel = string.format("P%1d ", inf)
+ end
+ end
+ elseif swValue == 4 then
+ -- laps completed
+ inf = GetContextInfo("laps")
+ if inf ~= nil then
+ -- if more then 99 laps
+ if inf >= 100 then
+ srf1Panel = string.format("L%3d", inf)
+ elseif inf >= 10 then
+ srf1Panel = string.format("L%2d ", inf)
+ else
+ srf1Panel = string.format("L%1d ", inf)
+ end
+ end
+ elseif swValue == 5 then
+ -- sector
+ inf = GetCarInfo("sector")
+ if inf ~= nil then
+ -- check if sector > 9
+ if inf >9 then
+ srf1Panel = string.format("S%2d ", inf)
+ else
+ srf1Panel = string.format("S%1d ", inf)
+ end
+ end
+ elseif swValue == 6 then
+ -- total laps if available
+ local tl = GetContextInfo("lapscount")
+ if tl < 1 then tl = 0 end
+ -- if more then 99 laps
+ if tl >= 100 then
+ srf1Panel = string.format("T%3d", tl)
+ elseif tl >= 10 then
+ srf1Panel = string.format("T%2d ", tl)
+ else
+ srf1Panel = string.format("T%1d ", tl)
+ end
+
+ elseif swValue == 7 then
+ -- water temp
+ inf = GetCarInfo("watertemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ srf1Panel = string.format("W%2.1f", inf)
+ end
+ elseif swValue == 8 then
+ -- oil temp
+ inf = GetCarInfo("oiltemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ srf1Panel = string.format("o%2.1f", inf)
+ end
+
+ elseif swValue == 9 then
+ -- best lap time
+ timeFlag = true
+ lpt = GetTimeInfo("laptime")
+
+ elseif swValue == 10 then
+ -- best lap time
+ timeFlag = true
+ lpt = GetTimeInfo("bestlaptime")
+
+ elseif swValue == 11 then
+ -- last lap time
+ timeFlag = true
+ lpt = GetTimeInfo("lastlaptime")
+
+ elseif swValue >= 12 and swValue <= 18 and isAppIRacing(sim) then
+ timeFlag = true
+ diffTimeFlag = true
+ -- iRacing partials
+ local ts = GetContextInfo("partialcount")
+ local sector = GetCarInfo("sector")
+ if ts ~= nil and ts > 0 then
+ if swValue == 12 then
+ lpt = GetPartialTimeInfo("currentpartial", sector)
+ elseif swValue == 13 then
+ lpt = GetPartialTimeInfo("vsbestlap", sector)
+ elseif swValue == 14 then
+ lpt = GetPartialTimeInfo("vsoptimallap", sector)
+ elseif swValue == 15 then
+ lpt = GetPartialTimeInfo("vsoptimalsector", sector)
+ elseif swValue == 16 then
+ lpt = GetPartialTimeInfo("vssessionbestlap", sector)
+ elseif swValue == 17 then
+ lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
+ elseif swValue == 18 then
+ lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
+ end
+ else
+ lpt = 0.0
+ end
+
+ elseif swValue == 19 then
+ -- real time diff vs your best
+ diffTimeFlag = true
+ timeFlag = true
+ lpt = GetTimeInfo("realdiffbest")
+
+ elseif swValue == 20 then
+ -- real time diff vs your last
+ diffTimeFlag = true
+ timeFlag = true
+ lpt = GetTimeInfo("realdifflast")
+
+ elseif swValue == 21 then
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ srf1Panel = string.format("L%3.0f", math.floor(remainintank) )
+
+ elseif swValue == 22 then
+ -- rpm
+ isSlowUpdate = true
+ --timeFlag = true
+ local rpm = GetCarInfo("rpm")
+ local r = rpm / 10.0
+ if r < 1000 then
+ srf1Panel = string.format("%3.1f", r)
+ else
+ srf1Panel = string.format("%4d.", round(r))
+ end
+ elseif swValue == 23 then
+ -- track size
+ isSlowUpdate = true
+ --timeFlag = true
+ local trcksz = GetContextInfo("tracksize")
+ local r = trcksz / 10
+ if r < 1000 then
+ srf1Panel = string.format("%3.1f", r)
+ else
+ srf1Panel = string.format("%4d.", round(r))
+ end
+
+ elseif swValue == 24 then
+ -- distance percent
+ local dist = GetContextInfo("lapdistance")
+ -- track size
+ local trcksz = GetContextInfo("tracksize")
+ local p = round(dist / (trcksz / 100))
+ srf1Panel = string.format("D%3d", p )
+
+ elseif swValue == 25 then
+ -- kers
+ local kers = GetCarInfo("kers")
+ srf1Panel = string.format("K%3d", round(kers/1000))
+
+ elseif swValue == 26 then
+ -- kers max
+ local kmx = GetCarInfo("kersmax")
+ srf1Panel = string.format("K%3d", round(kmx/1000))
+
+ elseif swValue == 27 then
+ -- drs
+ local drs = GetCarInfo("drs")
+ if drs == 1 then
+ srf1Panel = "ON "
+ else
+ srf1Panel = "OFF"
+ end
+
+ elseif swValue == 28 then
+ -- kers percent
+ local kers = GetCarInfo("kers")
+ srf1Panel = string.format("K%3d", round((kers/1000)/4))
+
+ elseif swValue == 29 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
+ srf1Panel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 30 then
+ inf = GetCarInfo("wheeltempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 31 then
+ inf = GetCarInfo("wheeltemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 32 then
+ inf = GetCarInfo("wheeltemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 33 then
+ -- wheels pressure if available
+ inf = GetCarInfo("wheelpressfrontleft")
+ if inf ~= nil then
+ -- convert to psi
+ srf1Panel = string.format("%2.1f ", inf / 6.88)
+ end
+
+ elseif swValue == 34 then
+ inf = GetCarInfo("wheelpressfrontright")
+ if inf ~= nil then
+ srf1Panel = string.format("%2.1f ", inf / 6.88)
+ end
+
+ elseif swValue == 35 then
+ inf = GetCarInfo("wheelpressrearleft")
+ if inf ~= nil then
+ srf1Panel = string.format("%2.1f ", inf / 6.88)
+ end
+
+ elseif swValue == 36 then
+ inf = GetCarInfo("wheelpressrearright")
+ if inf ~= nil then
+ srf1Panel = string.format("%2.1f ", inf / 6.88)
+ end
+
+ elseif swValue == 37 then
+ -- brakes temp if available
+ inf = GetCarInfo("braketempfrontleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 38 then
+ inf = GetCarInfo("braketempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 39 then
+ inf = GetCarInfo("braketemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 40 then
+ inf = GetCarInfo("braketemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
+
+ elseif swValue == 41 then
+ -- time remaining if available
+ lpt = GetTimeInfo("timeremaining")
+ timeFlag = true
+
+ elseif swValue == 42 then
+ -- PC system time
+ systemflag = true
+ lpt = GetTimeInfo("systemtime")
+ timeFlag = true
+ --diffTimeFlag = true
+ elseif swValue == 43 then
+ -- time elapsed if available
+ lpt = GetTimeInfo("timetotalelapsed")
+ timeFlag = true
+
+ elseif swValue == 44 then
+ -- last sector 1, 2 and 3
+ local sector = GetCarInfo("sector")
+ timeFlag = true
+ --diffTimeFlag = true
+ if sector == 1 then
+ -- sector 3
+ local ls1 = GetTimeInfo("lastsector1")
+ local ls2 = GetTimeInfo("lastsector2")
+ local lt = GetTimeInfo("lastlaptime")
+ if ls1 > 0 and ls2 > 0 then
+ lpt = lt - (ls1 + ls2)
+ end
+ elseif sector == 2 then
+ local ls1 = GetTimeInfo("lastsector1")
+ lpt = ls1
+ else
+ -- sector 3
+ local ls2 = GetTimeInfo("lastsector2")
+ lpt = ls2
+ end
+
+ elseif swValue == 45 then
+ -- PIT
+ srf1Panel = "PIT "
+
+ elseif swValue == 46 then
+ -- sc
+ local sc = GetContextInfo("safetycare")
+ if sc == 1 then
+ srf1Panel = "SCAR"
+ else
+ srf1Panel = "OFF "
+ end
+
+ elseif swValue == 47 then
+ -- real time delta vs last + last sector diff 1, 2 and 3
+ local sector = GetCarInfo("sector")
+ timeFlag = true
+ diffTimeFlag = true
+ if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
+ -- 8s delay, increase it if needed
+ mDiffSectorDelay = GetTicks() + 8000
+ mDiffOldSector = sector
+ end
+ -- init backup vars
+ if mOld_lt == nil then
+ mOld_ls1 = 0.00000
+ mOld_ls2 = 0.00000
+ mOld_lt = 0.00000
+ mDelta_lpt = 0.00000
+ mDelta_lptb = 0.00000
+ end
+
+ -- display delta by default
+ lpt = GetTimeInfo("realdifflast")
+
+ if mDiffSectorDelay > GetTicks() then
+ -- display sector
+ if sector == 1 then
+ -- sector 3
+ --local ls1 = GetTimeInfo("lastsector1")
+ --local ls2 = GetTimeInfo("lastsector2")
+ local lt = GetTimeInfo("lastlaptime")
+
+ --i-- delta sector 3f ls1 > 0 and ls2 > 0 and lt > 0 and mOld_ls1 > 0 and mOld_ls2 > 0 and mOld_lt > 0 then
+ -- delta sector 3
+ --lpt = (lt - (ls1 + ls2)) - (mOld_lt - (mOld_ls1 + mOld_ls2))
+ if lt > 0 and mOld_lt > 0 then
+ if lt ~= mOld_lt then
+ mDelta_lpt = lt - mOld_lt
+ print(mDelta_lpt, lt, mOld_lt)
+ end
+ lpt = mDelta_lpt
+ end
+
+ mOld_lt = lt
+
+
+ elseif sector == 2 then
+ -- sector 1
+ local ls1 = GetTimeInfo("lastsector1")
+ if ls1 > 0 and mOld_ls1 > 0 then
+ lpt = ls1 - mOld_ls1
+ end
+ mOld_ls2 = GetTimeInfo("lastsector2")
+ print(lpt, ls1 , mOld_ls1, mOld_ls2)
+
+ else
+ -- sector 2
+ local ls2 = GetTimeInfo("lastsector2")
+ if ls2 > 0 and mOld_ls2 > 0 then
+ lpt = ls2 - mOld_ls2
+ end
+ mOld_ls1 = GetTimeInfo("lastsector1")
+ print(lpt, ls2 , mOld_ls1, mOld_ls2)
+ end
+ end
+
+ elseif swValue == 48 then
+ -- real time delta vs best + last sector diff 1, 2 and 3
+
+ -- get sector
+ local sector = GetCarInfo("sector")
+ -- set flags
+ timeFlag = true
+ diffTimeFlag = true
+
+ -- set delay
+ if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
+ -- 8s delay, increase it if needed
+ mDiffSectorDelay = GetTicks() + 8000
+ mDiffOldSector = sector
+ end
+
+ -- init backup vars
+ if mOld_bt == nil then
+ mOld_bs1 = 0.00000
+ mOld_bs2 = 0.00000
+ mOld_bt = 0.00000
+ mDelta_lpt = 0.00000
+ mDelta_lptb = 0.00000
+ end
+
+ -- display delta by default
+ lpt = GetTimeInfo("realdiffbest")
+
+ if mDiffSectorDelay > GetTicks() then
+ -- display sector diff during delay
+ if sector == 1 then
+ -- sector 3
+ --local bs1 = GetTimeInfo("bestsector1")
+ --local bs2 = GetTimeInfo("bestsector2")
+ local bt = GetTimeInfo("bestlaptime")
+
+ --if bs1 > 0 and bs2 > 0 and bt > 0 and mOld_bs1 > 0 and mOld_bs2 > 0 and mOld_bt > 0 then
+ -- delta sector 3
+ -- lpt = (bt - (bs1 + bs2)) - (mOld_bt - (mOld_bs1 + mOld_bs2))
+ if bt > 0 and mOld_bt > 0 then
+ if bt ~= mOld_bt then
+ mDelta_lptb = bt - mOld_bt
+ print(mDelta_lpt, bt, mOld_bt)
+ end
+ lpt = mDelta_lptb
+ end
+
+ mOld_bt = bt
+
+ elseif sector == 2 then
+ -- sector 1
+ local bs1 = GetTimeInfo("bestsector1")
+ if bs1 > 0 and mOld_bs1 > 0 then
+ lpt = bs1 - mOld_bs1
+ end
+ print(lpt, bs1 )
+ mOld_bs2 = GetTimeInfo("bestsector2")
+
+ else
+ -- sector 2
+ local bs2 = GetTimeInfo("bestsector2")
+ if bs2 > 0 and mOld_bs2 > 0 then
+ lpt = bs2 - mOld_bs2
+ end
+ print(lpt, bs2 )
+ mOld_bs1 = GetTimeInfo("bestsector1")
+ end
+ end
+
+ else
+ srf1Panel = " "
+ end
+ -- check if diff time is ready
+ local diffOK = GetTimeInfo("realdifftimeready")
+ if diffTimeFlag and diffOK == false then
+ diffTimeFlag = false
+ timeFlag = false
+ srf1Panel = "NPEF"
+
+ mOld_ls1 = 0.00000
+ mOld_ls2 = 0.00000
+ mOld_lt = 0.00000
+ mDelta_lpt = 0.00000
+ mDelta_lptb = 0.00000
+ end
+
+ local c = ""
+ local refreshRate = mRefreshLapTimeRate
+ if diffTimeFlag then
+ c = "+"
+ refreshRate = mDeltaTimeDelay
+ end
+
+ if timeFlag and lpt ~= nil then
+
+ -- set char of negative number
+ if diffTimeFlag then
+ if lpt < 0 then c = "-" end
+ end
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lpt)
+
+ --print("lpt: " .. lpt .. " m: " .. mn .. " - s: " .. sc .. " - ms: " .. ms .."\n" )
+
+ -- update display every mDeltaTimeDelay time
+ if GetTicks() > (refreshRate + mDeltaTimeOldTicks ) then
+ mDeltaTimeOldTicks = GetTicks()
+
+ if lpt == -1 or (mn + sc + ms) == 0.0000 then
+ mDeltaTimeBackup = "-.---"
+
+ elseif systemflag then
+ mDeltaTimeBackup = string.format( "%2d.%02d", mn, sc)
+
+ elseif mn > 9 then
+ -- > 9mn
+ if c == "" then
+ mDeltaTimeBackup = string.format( "%2d.%2d", mn, sc)
+ else
+ mDeltaTimeBackup = string.format( "%s%2d ", c, mn)
+ end
+
+ elseif mn > 0 and mn < 10 then
+ -- < 10mn
+ if c == "" then
+ mDeltaTimeBackup = string.format( "%1d.%02d.%01d", mn, sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%1d.%02d", c, mn, sc)
+ end
+
+ else
+ -- sc > 9
+ if sc > 9 then
+ if c == "" then
+ mDeltaTimeBackup = string.format( "0.%2d.%1d", sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%02d.%01d", c, sc, hd)
+ end
+
+ else
+ -- sc < 0
+ if c == "" then
+ mDeltaTimeBackup = string.format( "0.%01d.%02d", sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%01d.%02d", c, sc, hd)
+ end
+
+ end
+ end
+ end
+
+ --print(srf1Panel,mDeltaTimeBackup)
+ srf1Panel = mDeltaTimeBackup
+ end
+
+ if isSlowUpdate then
+
+ if GetTicks() > ( refreshRate + mDeltaTimeOldTicks ) then
+ mDeltaTimeOldTicks = GetTicks()
+ if side == 0 then
+ mSRF1LeftText = srf1Panel
+ else
+ mSRF1RightText = srf1Panel
+ end
+ -- print(GetTicks() .. mSRF1RightText .."\n")
+ end
+ else
+ if side == 0 then
+ mSRF1LeftText = srf1Panel
+ else
+ mSRF1RightText = srf1Panel
+ end
+ end
+
+ -- print(mSRF1LeftText, mSRF1RightText, srf1Panel)
+ -- send string to sli manager
+ if side == 0 then
+ SetLeftDigits( mSRF1LeftText )
+ else
+ SetRightDigits( mSRF1RightText )
+ end
+
+ return 1
+end
diff --git a/scripts/simracef1_iracing.lua b/scripts/simracef1_iracing.lua
new file mode 100644
index 0000000..e50287c
--- /dev/null
+++ b/scripts/simracef1_iracing.lua
@@ -0,0 +1,11 @@
+-- iRacing Custom Scripts - SLIMax Manager Scripts v1.9
+-- Copyright ©2011-2013 by Zappadoc - All Rights Reserved.
+-- last change by Zappadoc - 2013-08
+
+-- ================================
+-- add the short desciption of your script(s) in mScript_Info global var
+mScript_Info = "A useful iRacing COMBO SETUP to select automatically the good settings for each iracing car you drive (shiftlights, max gears, osp, et.)."
+
+-- ================================
+-- load common scripts file
+require "scripts/zdoc_scripts/iracing_common_scripts" \ No newline at end of file
diff --git a/scripts/slidevice.lua b/scripts/slidevice.lua
index ef81cfa..2f05552 100755..100644
--- a/scripts/slidevice.lua
+++ b/scripts/slidevice.lua
@@ -1,13 +1,13 @@
--- Load SLIMax Mgr Lua Scripts v3
+-- Load SLIMax Mgr Lua Scripts v3.3
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
--- changed by Zappadoc - 2013-02
+-- changed by Zappadoc - 2013-09
-- main device script, do not modify this script
-print ()
-print ("-------------------------------------------")
require "scripts/led"
require "scripts/enter_exit_session"
require "scripts/gear"
+require "scripts/simracef1"
+require "scripts/simracedlx"
require "scripts/fanatec"
require "scripts/slipro"
require "scripts/shiftlights"
@@ -16,11 +16,15 @@ require "scripts/osp"
require "scripts/controls"
require "scripts/devhook"
require "scripts/global_custom_scripts"
+require "scripts/custom_events"
-- load the custom scripts if exists
scr = GetCustomScripts("scriptname")
+-- print ( scr )
if scr ~= nil and scr ~= "" then
mCustomScriptsFileName = scr
require(mCustomScriptsFileName)
- print ( string.format("%s => LOADED", scr ) )
+ custom_initEvent(scr)
end
+
+
diff --git a/scripts/sliemu_iracing.lua b/scripts/sliemu_iracing.lua
index 2d5b5ba..2d5b5ba 100755..100644
--- a/scripts/sliemu_iracing.lua
+++ b/scripts/sliemu_iracing.lua
diff --git a/scripts/sliemu_iracing_basic.lua b/scripts/sliemu_iracing_basic.lua
deleted file mode 100755
index 336a7f2..0000000
--- a/scripts/sliemu_iracing_basic.lua
+++ /dev/null
@@ -1,11 +0,0 @@
--- iRacing Custom Scripts - SLIMax Manager Scripts v1.8
--- Copyright ©2011-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2012-09-16
-
--- ================================
--- add the short desciption of your script(s) in mScript_Info global var
-mScript_Info = "A useful iRacing custom scripts to select automatically the good settings for each iracing car you drive (shiftlights, max gears, osp, et.)."
-
--- ================================
--- load common scripts file
-require "scripts/zdoc_scripts/iracing_common_scripts" \ No newline at end of file
diff --git a/scripts/slim_iracing.lua b/scripts/slim_iracing.lua
index 2d5b5ba..2d5b5ba 100755..100644
--- a/scripts/slim_iracing.lua
+++ b/scripts/slim_iracing.lua
diff --git a/scripts/slim_iracing_basic.lua b/scripts/slim_iracing_basic.lua
deleted file mode 100755
index 336a7f2..0000000
--- a/scripts/slim_iracing_basic.lua
+++ /dev/null
@@ -1,11 +0,0 @@
--- iRacing Custom Scripts - SLIMax Manager Scripts v1.8
--- Copyright ©2011-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2012-09-16
-
--- ================================
--- add the short desciption of your script(s) in mScript_Info global var
-mScript_Info = "A useful iRacing custom scripts to select automatically the good settings for each iracing car you drive (shiftlights, max gears, osp, et.)."
-
--- ================================
--- load common scripts file
-require "scripts/zdoc_scripts/iracing_common_scripts" \ No newline at end of file
diff --git a/scripts/slimax_script_readme.txt b/scripts/slimax_script_readme.txt
index 148f7f7..f309203 100755..100644
--- a/scripts/slimax_script_readme.txt
+++ b/scripts/slimax_script_readme.txt
@@ -1,6 +1,6 @@
-SLIMax Manager III 3.0 Scripting Information - PART OF SLIMax Manager pkg
+SLIMax Manager III 3.3.1 Scripting Information - PART OF SLIMax Manager pkg
Copyright (c)2011-2013 by EK & Zappadoc - All Rights Reserved.
-updated 2013-02 by Zappadoc
+updated 2013-10 by Zappadoc
** ALL INFORMATION BELOW ARE SUBJECT TO CHANGE WITHOUT NOTICE **
@@ -37,42 +37,83 @@ All event functions below must return 1 if the event has been fully managed or
2 to skip and give control to SLIMax Mgr
---------------------------------------------
+GLOBAL EVENTS (ALL DEVICES)
+---------------------------------------------
+function controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) and custom_controlsEvent
+params = see the control.lua script
+Devices supported: global event
+Notes: Controls Event, Manage buttons and switches. (see controls.lua script)
+
+---------------------------------------------
+function deviceReport(deviceType) and custom_deviceReport
+param = the current targeted device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
+Devices supported: global event
+Notes: This function is called periodically and outputs the previously processed data to the device when it returns
+back to the manager, if needed, patch any previous function here to
+display additional info or to change everything. (see devhook.lua script)
+
+---------------------------------------------
+function enterSessionEvent(deviceType) and custom_enterSessionEvent
+param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
+Notes: Triggered when the session starts
+(see enter_exit_session.lua script)
+
+---------------------------------------------
+function exitSessionEvent(deviceType) and custom_exitSessionEvent
+param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
+Devices supported: global event
+Notes: Triggered when the session ends
+(see enter_exit_session.lua script)
+
+---------------------------------------------
+LOCAL EVENTS (SPECIFIC TO DEVICES)
+---------------------------------------------
function shiftLightsMethodEvent(idx) and custom_shiftLightsMethodEvent
function shiftLightsBU0710Event(idx) and custom_shiftLightsBU0710Event
function shiftLightsFanatecMethodEvent(idx) and custom_shiftLightsFanatecMethodEvent
function shiftLightsG27LedsMethodEvent(idx) and custom_shiftLightsG27LedsMethodEvent
+function shiftLightsSRDlxMethodEvent(idx) and custom_shiftLightsSRDlxMethodEvent
+function shiftLightsSRF1MethodEvent(idx) and custom_shiftLightsSRF1MethodEvent
param = current method index
-Devices supported: SLI Boards series, Fanatec Wheels and Logitech G27 leds
+Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
Notes: shiftlights method event, computes all shiftlights methods
(see shiftlights.lua script)
---------------------------------------------
function ospMethodEvent(idx) and custom_ospMethodEvent
+function ospSRDlxMethodEvent(idx) and custom_ospSRDlxMethodEvent
+function ospSRF1MethodEvent(idx) and custom_ospSRF1MethodEvent
function ospFanatecMethodEvent(idx) and custom_ospFanatecMethodEvent
function ospG27LedsMethodEvent(idx) and custom_ospG27LedsMethodEvent
param = current method index
-Devices supported: SLI Boards series, Fanatec Wheels and Logitech G27 leds
+Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
Notes: OSP method event, computes all Optimal Shift-Points methods
(see osp.lua script)
---------------------------------------------
function spdLmtMethodEvent(idx) and custom_spdLmtMethodEvent
+function spdLmtSRDlxMethodEvent(idx) and custom_spdLmtSRDlxMethodEvent
+function spdLmtSRF1MethodEvent(idx) and custom_spdLmtSRF1MethodEvent
function spdLmtFanatecMethodEvent(idx) and custom_spdLmtFanatecMethodEvent
function spdLmtG27MethodEvent(idx) and custom_spdLmtG27MethodEvent
param = current method index
-Devices supported: SLI Boards series, Fanatec Wheels and Logitech G27 leds
+Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
Notes: speedlimiter method event, computes all speedlimiter methods
(see speedlimiter.lua script)
---------------------------------------------
function leftDigitsEvent(swPosition) and custom_leftDigitsEvent
function rightDigitsEvent(swPosition) and custom_rightDigitsEvent
+function srdlxLeftDigitsEvent(swPosition) and custom_srdlxLeftDigitsEvent
+function srdlxRightDigitsEvent(swPosition) and custom_srdlxRightDigitsEvent
+function srf1LeftDigitsEvent(swPosition) and custom_srf1LeftDigitsEvent
+function srf1RightDigitsEvent(swPosition) and custom_srf1RightDigitsEvent
function fanatecDigitsEvent(swPosition) and custom_fanatecDigitsEvent
param = switch position
-Devices supported: SLI Boards series and Fanatec Wheels
-Notes: SLI-PRO Left and Right Panel and Fanatec digits functions events, computes data to be
-displayed on left and rights digits of SLI-PRO device
-(see slipro.lua script)
+Devices supported: SLI-PRO, SIM RACE Deluxe, SIM RACE F1 and Fanatec Wheels and emulators SLI-EMU and SRF1-EMU
+
+Notes: computes data to be displayed on digits panel of the device
+(see scripts: slipro.lua, simracedlx.lua, simracef1.lua and fanatec.lua)
---------------------------------------------
function gearEvent(gear) and custom_gearEvent
@@ -83,33 +124,6 @@ Notes: gear event, show the current selected gear on central digit
(see gear.lua script)
---------------------------------------------
-function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex) and custom_controlsEvent
-params = see the script
-Devices supported: global event
-Notes: Controls Event, Manage buttons and switches. (see controls.lua script)
-
----------------------------------------------
-function deviceReport(devType) and custom_deviceReport
-param = the current targeted SLI device
-Devices supported: global event
-Notes: This function is called periodically and outputs the previously processed data to the device when it returns
-back to the manager, if needed, patch any previous function here to
-display additional info or to change everything. (see devhook.lua script)
-
----------------------------------------------
-function enterSessionEvent(devType) and custom_enterSessionEvent
-param = current device (SLI-M, SLI-PRO or BU0710)
-Notes: Triggered when the session starts
-(see enter_exit_session.lua script)
-
----------------------------------------------
-function exitSessionEvent(devType) and custom_exitSessionEvent
-param = current device (SLI-M, SLI-PRO or BU0710)
-Devices supported: global event
-Notes: Triggered when the session ends
-(see enter_exit_session.lua script)
-
----------------------------------------------
function ledEvent(idx, ledFunction, state) and custom_ledEvent
param = index of the led, std state of the led and corresponding function
1=LowFuel
@@ -178,11 +192,11 @@ param motor = 0 or 1 (left or right motor )
param power: from 0 to 100
param delay: from 0 to 1000 ms (1sec max)
-SetFanatecLed(string table)
+SetFanatecLed(string table) <<<<< DEPRECATED use SetRPMLed()
param string = name of lua table (default mRPMLedTable)
set RPM led of Fanatec rim ( see shiftlights.lua script)
-SetFanatecGear(gear)
+SetFanatecGear(gear) <<<<< DEPRECATED use SetGearDigits()
param string = one char string (i.e. "r" or "n" or "1" ... )
set the gear value in center of the Fanatec digits panel (see fanatec.lua script)
@@ -206,19 +220,19 @@ set gear digit of current targeted SLI device ( see gear.lua script)
---------------------------------------------
SetRPMLed(string)
param string = name of lua table (default mRPMLedTable)
-set RPM led of current targeted SLI device, SLI-M or SLI-PRO ( see shiftlights.lua script)
+set RPM led of current targeted SLI device, SLI-M or SLI-PRO or SIM RACE Deluxe ( see shiftlights.lua script)
---------------------------------------------
SetWarnLed(idx, val)
param integer = index of led from 1 to 6
param integer = value 1 or 0
-set the 6 extra leds of current targeted SLI device (SLI-M or SLI-PRO)
+set the 6 extra leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
---------------------------------------------
SetExtLed(idx, val)
param integer = index of led from 1 to 5
param integer = value 1 or 0
-set the 5 external leds of current targeted SLI device (SLI-M or SLI-PRO)
+set the 5 external leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
---------------------------------------------
SetOSPStatus(boolean)
@@ -227,28 +241,28 @@ in Optimal ShiftPoints (OSP) Methods compute your own OSP curve and set
the corresponding OSP state with this function (true or false - see osp.lua script)
---------------------------------------------
-========== SLI-PRO DIGITS ==========
+========== SLI-PRO or SIM RACE Deluxe DIGITS PANELs ==========
SetRightDigits(string)
SetLeftDigits(string)
param string = 6 chars string + delimiter
set the alpha-numerical text (including the . and : delimiter) to the right
-and left digits (see slipro.lua script)
+and left digits (see slipro.lua or simracedlx.lua script)
---------------------------------------------
SetDigitsAllowed(boolean)
param boolean = true or false
-by default the 6 + 6 SLI-PRO digits are showed but sometime we need to temporarily
+by default the 6 + 6 SLI-PRO digits or 4 x 4 SIM RACE Deluxe digits are showed but sometime we need to temporarily
hide them to set our custom information, pass false to this function to hide digits
and true to show them again
---------------------------------------------
-SetKeystroke(keycode, delay, modifier)
+SetKeystroke(keycode, delay, modifier, modifier2)
param string or integer = the key as a string (see the special keycode table below ) or Microsoft VKey code as integer
param int = the delay from 50 to 1000 ms
-param modifier = SHIFT or CONTROL or ALT
-This function is experimental and unsupported
+param modifier = SHIFT or CONTROL or ALT or ""
+param optional modifier2 = SHIFT or CONTROL or ALT or ""
-SPECIAL KEYCODE TABLE:
+SPECIAL KEYCODE TABLE IN ADDITION TO A...Z CHARS:
BACKSPACE
DEL
INSERT
@@ -314,8 +328,9 @@ Param "selector" (string), this string contains the following value:
SLISleep(ms)
-----------------------------------------------------------------------------------
+Force sending report (not recommended)
SLISendReport()
-FanatecSendReport()
+FanatecSendReport() <<<<< DEPRECATED use SLISendReport()
-----------------------------------------------------------------------------------
SetGlobalBrightness(int)
@@ -336,6 +351,25 @@ param integer = from 0 to 5000
set interval to update the display for easy reading of time
the deltatime delay is in ms (1000 = 1s )
+---------------------------------------------
+result = SetSMXGlobal(globalVarName, stringValue)
+param globalVarName = ref name to global
+param stringValue = value (if you want to store a number convert it to string)
+result return = -2 exceed capacity (20 global max); -1 Error; 0 create new record; 1 update new record
+
+---------------------------------------------
+result, stringValue = GetSMXGlobal(globalVarName )
+param globalVarName = ref name to global
+return string in stringValue or empty
+result return = -1 Error; 0 not found; 1 ok
+
+---------------------------------------------
+SMXMessageBox(text, title, buttons_style, icon_style)
+param text = message text
+param title (optional) = title of the dialog box
+param buttons_style (optional) = see global.lua or Microsoft MessageBox buttons flags
+param icon_style (optional) = see global.lua or Microsoft MessageBox icon flags
+
=========================================
functions to get SLI Manager Information
=========================================
@@ -354,6 +388,9 @@ Param "selector" (string), this string contains the following value:
IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
+"devicelist" return the coma delimited list of current detected devices IDs (included game controllers)
+Reminder regarding device ID: if ID < 40 this is a shiftlight/Digits device; if >=40 this is a game controller
+
Fanatec additions:
"bypass" return the state of BYPASS preference (see advanced options panel)
"fanatecdigitscount" return the number of digits default = 3
@@ -371,7 +408,7 @@ Fanatec additions:
"shiftlightsmethod" return current selected method of targeted device
"ospmethod" return current selected method of targeted device
"speedlimitermethod" return current selected method of targeted device
-
+"pitfeedback" return true when car is on pit lane
"ospcustom" return true if an OSP record to the current car has been found
"neutral" return ascii code of neutral char (default 'n')
"reverse" return ascii code of reverse char (default 'r')
@@ -417,6 +454,7 @@ Fanatec additions:
"globalbrightness" return current global brightness value
"lowfuel" return low fuel status
"dumplastlap" return status of telemetry report (true = activated)
+"safetycar" return status of SC (true = ON TRACK ) if available
-----------------------------------------------------------------------------------
GetCarInfo("selector")
@@ -424,6 +462,8 @@ returns car info (internal function)
Param "selector" (string), this string contains the following value:
IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
+
+"ignition" return the ignition state in rFactor2, 0=off 1=ignition 2=ignition+starter
"kers" return kers value
"kers max" return max kers energy
"drs" return ON or OFF status
@@ -435,10 +475,14 @@ IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
"inpits" car is in pitlane? (integer) 0= on track; 1= pit stall area; 2= Approaching Pits (Pit Road)
"rpm" return current car rpm (r/mn)
"redzone" return current max engine rpm
+
"fuel" return current fuel in tank
"fuelmax" return the max capacity of fuel tank
"fuelperlap" return the consumption of fuel during the previous lap, updated after each lap
+"averagefuelperlap" return the average of consumption of fuel during a lap
+"remainlapsintank" get an average consumption of fuel per lap and return the remaining laps
"fuelatstart" return the fuel in tank at the beginning of each lap
+
"watertemp" return water engine temp (celsius)
"oiltemp" return oil engine temp (celsius)
"sector" return current sector (integer)
@@ -475,6 +519,7 @@ IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
"laptime" return current lap time if available
"bestlaptime" return best lap time if available
"lastlaptime" return last lap time if available
+"realdifftimeready" return true when telemetry data of at least one lap has been collected if available
"realdiffbest" return real-time diff (delta) vs best if available
"realdifflast" return real-time diff (delta) vs last if available
"sector1" return current sector 1 if available
@@ -539,6 +584,31 @@ returns the corresponding name of device ID
Param deviceID (integer)
return string value
+-----------------------------------------------------------------------------------
+GetLedIndex("selector")
+returns the corresponding index of the led
+Param led function (string) see the list below
+return integer value
+
+"speedlimiter"
+"osp1"
+"osp2"
+"lowfuel"
+"tractioncontrol"
+"abs"
+"greenflag"
+"yellowflag"
+"redflag"
+"overheating"
+"damage"
+"pitrequest"
+"power"
+"revlimit"
+"headlights"
+"blueflag"
+"drs"
+"safeprefs"
+"drslegal"
===============================
Script Developpment
@@ -558,8 +628,26 @@ gRedZone = the default value is set in gear.lua script. This value can be overwr
mLeftSpdLmtText and mRightSpdLmtText contains the default text for left and right digits panel in speedlimiter method 4 and 5 and can be "patched" (replaced with your own text) in custom_spdLmtMethodEvent() function (see custom_scripts.lua file)
mOSPMethod to overwrite the method value, useful in custom_ospMethodEvent() function to patch the current OSP method with another one
+mOSPBU0710Method same as above for BU0710
+mOSPG27Method same as above for G27
+mOSPFanatecMethod same as above for Fanatec
+mOSPSRDlxMethod same as above for SIM RACE Deluxe
+mOSPSRF1Method same as above for SIM RACE F1
mSpdLimitMethod to overwrite the method value, useful in custom_spdLmtMethodEvent() function to patch the current PIT LIMITER method with another one
+mSpdLimitG27Method same as above for G27
+mSpdLimitFanatecMethod same as above for Fanatec
+mSpdLimitSRDlxMethod same as above for SIM RACE Deluxe
+mSpdLimitSRF1Method same as above for SIM RACE F1
+
+mShiftlightsMethodIndex to overwrite the method value, useful in custom_shiftlightsMethodEvent() function to patch the current shiftlights method with another one
+mShiftlightsBU0710MethodIndex same as above for BU0710
+mShiftlightsG27MethodIndex same as above for G27
+mShiftlightsFanatecMethodIndex same as above for Fanatec
+mShiftlightsSRDlxMethodIndex same as above for SIM RACE Deluxe
+mShiftlightsSRF1MethodIndex same as above for SIM RACE F1
+
+oldGear is useful in custom_gearFanatecEvent() function to patch the current gear value
-----------------------
SHIFTLIGHTS UTILITIES
diff --git a/scripts/slipro.lua b/scripts/slipro.lua
index ed4cd63..df4833c 100755..100644
--- a/scripts/slipro.lua
+++ b/scripts/slipro.lua
@@ -1,8 +1,8 @@
--- SLIPRO Lua Script v3
+-- SLIPRO Lua Script v3.3.2
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all functions associated with
-- left and right panels of SLIPRO device
--- last change by Zappadoc - 2013-02
+-- last change by Zappadoc - 2013-09
-- ============================================================
-- Left and Right Panel functions
@@ -45,6 +45,19 @@ function leftDigitsEvent(swFunction)
-- 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")
@@ -209,9 +222,10 @@ function leftDigitsEvent(swFunction)
lPanel = string.format(" P%02d ", pos )
elseif swValue == 22 then
- -- logo
- lPanel = "SLIMAX"
-
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ lPanel = string.format(" FL%3.0f", math.floor(remainintank) )
+
elseif swValue == 23 then
-- rpm
local rpm = GetCarInfo("rpm")
@@ -290,6 +304,19 @@ function leftDigitsEvent(swFunction)
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("safetycare")
+ if sc == 1 then
+ lPanel = " SCAR "
+ else
+ lPanel = " OFF "
+ end
+
else
lPanel = "-:--.---"
end
@@ -338,7 +365,7 @@ function rightDigitsEvent(swFunction)
local dlt = false
dlt = GetContextInfo("displaylaptime")
if dlt == nil then dlt = false end
- if dlt then
+ if dlt and swValue ~= 37 and swValue ~= 38 then
swValue = 3
end
@@ -355,6 +382,20 @@ function rightDigitsEvent(swFunction)
-- 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 .. "\n")
+
-- get sim name
local sim = GetContextInfo("simulation")
if sim ~= nil then
@@ -445,16 +486,17 @@ function rightDigitsEvent(swFunction)
SetRightDigits( rPanel )
return 1
elseif swValue == 19 then
- -- logo
- rPanel = "SLIMAX"
- SetRightDigits( rPanel )
- return 1
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ rPanel = string.format(" FL%3.0f", math.floor(remainintank) )
+
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")
@@ -468,6 +510,7 @@ function rightDigitsEvent(swFunction)
end
SetRightDigits( rPanel )
return 1
+
elseif swValue == 22 then
-- PC system time
lpt = GetTimeInfo("systemtime")
@@ -476,6 +519,7 @@ function rightDigitsEvent(swFunction)
rPanel = string.format( " %02d.%02d ", hr, mn)
SetRightDigits( rPanel )
return 1
+
elseif swValue == 23 then
-- rpm:gear
local rpm = GetCarInfo("rpm")
@@ -488,6 +532,7 @@ function rightDigitsEvent(swFunction)
SetRightDigits( rPanel )
end
return 1
+
elseif swValue == 24 then
-- time elapsed if available
lpt = GetTimeInfo("timetotalelapsed")
@@ -609,6 +654,140 @@ function rightDigitsEvent(swFunction)
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
+ local sector = GetCarInfo("sector")
+ diffFlag = true
+ if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
+ -- 8s delay, increase it if needed
+ mDiffSectorDelay = GetTicks() + 8000
+ mDiffOldSector = sector
+ end
+ -- init backup vars
+ if mOld_lt == nil then
+ mOld_ls1 = 0.00000
+ mOld_ls2 = 0.00000
+ mOld_lt = 0.00000
+ mDelta_lpt = 0.00000
+ mDelta_lptb = 0.00000
+ end
+
+ -- display delta by default
+ lpt = GetTimeInfo("realdifflast")
+
+ if mDiffSectorDelay > GetTicks() then
+ -- display sector
+ if sector == 1 then
+ -- sector 3
+ local lt = GetTimeInfo("lastlaptime")
+
+ -- if ls1 > 0 and ls2 > 0 and lt > 0 and mOld_ls1 > 0 and mOld_ls2 > 0 and mOld_lt > 0 then
+ -- delta sector 3
+ --lpt = (lt - (ls1 + ls2)) - (mOld_lt - (mOld_ls1 + mOld_ls2))
+ if lt > 0 and mOld_lt > 0 then
+ if lt ~= mOld_lt then
+ mDelta_lpt = lt - mOld_lt
+ print(mDelta_lpt, lt, mOld_lt)
+ end
+ lpt = mDelta_lpt
+ end
+
+ mOld_lt = lt
+
+
+ elseif sector == 2 then
+ -- sector 1
+ local ls1 = GetTimeInfo("lastsector1")
+ if ls1 > 0 and mOld_ls1 > 0 then
+ lpt = ls1 - mOld_ls1
+ end
+ mOld_ls2 = GetTimeInfo("lastsector2")
+ print(lpt, ls1 , mOld_ls1, mOld_ls2)
+
+ else
+ -- sector 2
+ local ls2 = GetTimeInfo("lastsector2")
+ if ls2 > 0 and mOld_ls2 > 0 then
+ lpt = ls2 - mOld_ls2
+ end
+ mOld_ls1 = GetTimeInfo("lastsector1")
+ print(lpt, ls2 , mOld_ls1, mOld_ls2)
+ end
+ end
+
+ elseif swValue == 38 then
+ -- real time delta vs best + last sector diff 1, 2 and 3
+
+ -- get sector
+ local sector = GetCarInfo("sector")
+ -- set flags
+ diffFlag = true
+
+ -- set delay
+ if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
+ -- 8s delay, increase it if needed
+ mDiffSectorDelay = GetTicks() + 8000
+ mDiffOldSector = sector
+ end
+
+ -- init backup vars
+ if mOld_bt == nil then
+ mOld_bs1 = 0.00000
+ mOld_bs2 = 0.00000
+ mOld_bt = 0.00000
+ mDelta_lpt = 0.00000
+ mDelta_lptb = 0.00000
+ end
+
+ -- display delta by default
+ lpt = GetTimeInfo("realdiffbest")
+
+ if mDiffSectorDelay > GetTicks() then
+ -- display sector diff during delay
+ if sector == 1 then
+ -- sector 3
+ local bt = GetTimeInfo("bestlaptime")
+
+ --if bs1 > 0 and bs2 > 0 and bt > 0 and mOld_bs1 > 0 and mOld_bs2 > 0 and mOld_bt > 0 then
+ -- delta sector 3
+ -- lpt = (bt - (bs1 + bs2)) - (mOld_bt - (mOld_bs1 + mOld_bs2))
+ if bt > 0 and mOld_bt > 0 then
+ if bt ~= mOld_bt then
+ mDelta_lptb = bt - mOld_bt
+ print(mDelta_lpt, bt, mOld_bt)
+ end
+ lpt = mDelta_lptb
+ end
+
+ mOld_bt = bt
+
+ elseif sector == 2 then
+ -- sector 1
+ local bs1 = GetTimeInfo("bestsector1")
+ if bs1 > 0 and mOld_bs1 > 0 then
+ lpt = bs1 - mOld_bs1
+ end
+ print(lpt, bs1 )
+ mOld_bs2 = GetTimeInfo("bestsector2")
+
+ else
+ -- sector 2
+ local bs2 = GetTimeInfo("bestsector2")
+ if bs2 > 0 and mOld_bs2 > 0 then
+ lpt = bs2 - mOld_bs2
+ end
+ print(lpt, bs2 )
+ mOld_bs1 = GetTimeInfo("bestsector1")
+ end
+ end
+
else
-- none
rPanel = "-:--.---"
@@ -619,18 +798,40 @@ function rightDigitsEvent(swFunction)
if lpt == nil then return 0 end
+ local refreshRate = mRefreshLapTimeRate
+ if diffFlag then
+ refreshRate = mDeltaTimeDelay
+ end
+
+ -- check if diff time is ready
+ local diffOK = GetTimeInfo("realdifftimeready")
+ if diffFlag and diffOK == false then
+ diffFlag = false
+ rPanel = " nPEF "
+
+ mOld_ls1 = 0.00000
+ mOld_ls2 = 0.00000
+ mOld_lt = 0.00000
+ mDelta_lpt = 0.00000
+ mDelta_lptb = 0.00000
+
+ 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 diffFlag then
- --
- if GetTicks() > (mDeltaTimeDelay + mDeltaTimeOldTicks ) then
- mDeltaTimeOldTicks = GetTicks()
+ if diffFlag then
+ --
if lpt == -1 or (mn + sc + ms) == 0.0000 then
mDeltaTimeBackup = " --.---"
elseif mn > 0 then
@@ -638,20 +839,25 @@ function rightDigitsEvent(swFunction)
else
mDeltaTimeBackup = string.format( "%s%2d.%03d", c, sc, ms)
end
- end
- rPanel = mDeltaTimeBackup
- else
- if lpt == -1 or (mn + sc + ms) == 0.0000 then
- rPanel = "-:--.---"
- elseif mn < 10 then
- rPanel = string.format( "%1d:%02d.%03d", mn, sc, ms)
- elseif hr > 0 then
- rPanel = string.format( " %02d.%02d ", hr, mn)
- else
- rPanel = string.format( " %02d.%02d.%01d", mn, sc, ms)
- end
+ 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
diff --git a/scripts/slipro_f1_2012_villota.lua b/scripts/slipro_f1_2012_villota.lua
deleted file mode 100755
index 7798966..0000000
--- a/scripts/slipro_f1_2012_villota.lua
+++ /dev/null
@@ -1,102 +0,0 @@
--- Custom Scripts Template SLIMax Manager Scripts v2.0
--- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2012-12-02
-
-
--- villota77's script for F1 2012 - v1.3.2
-
--- This script tries to imitate the way KERS and delta time info is shown in real F1 steering wheel displays
--- (1) KERS is shown in the left display as a pure number (in percentage)
--- (2) Delta time ("qualy time") with respect to best (or last) lap is shown in the right display
--- in X.XX format (if it is positive - note there is not a "+" sign in SLIPro)
--- or -X.XX format (if it is negative)
--- (3) Delta-time info is refreshed every 1 second so you don't have digits flickering
--- (4) At the end of the lap, the right display will freeze and show deltatime (to best lap) during a number of seconds chosen in SLIMaxMng
---- (General Options - LAPTIMEDISPLAYDELAY). Then it will resume showing real-time data.
-
-
--- ================================
--- CONSTANTS
-
--- ================================
--- additional lua extension module dll
-
--- ================================
--- additional scripts file
-require "scripts/villota_scripts/villota_custom_functions"
-
--- ================================
--- custom globals
-
--- ================================
--- custom functions
-
--- ================================
--- custom events
-
-
-function custom_initEvent(scriptfile)
- -- type your custom script initialization here
-end
-
-function custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_deviceReport(devType)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_ospMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
- return 2
-end
-
-function custom_shiftLightsMethodEvent(idx)
- -- type your custom shiftlights method here
- return 2
-end
-
-function custom_shiftLightsBU0710Event(idx)
- -- type your custom shiftlights method for BU0710 device only here
- return 2
-end
-
-function custom_leftDigitsEvent(swFunction)
- -- call custom function
- return villota_custom_leftDigitsEvent(swFunction)
-end
-
-function custom_rightDigitsEvent(swFunction)
- -- call custom function
- return villota_custom_rightDigitsEvent(swFunction)
-end
-
-
-function custom_spdLmtMethodEvent(idx)
- -- type your custom speedlimiter method here
- return 2
-end
-
-function custom_gearEvent(gear)
- -- type your custom gear event script here
- return 2
-end
-
-function custom_enterSessionEvent(devType)
- -- type your custom script on session start, here
- return 2
-end
-
-function custom_exitSessionEvent(devType)
- -- type your custom script on session ending, here
- return 2
-end
-
--- triggered from v2.2.4 of SMX2
-function custom_ledEvent(ledIndex, ledFunction, ledState)
- -- type your custom script on session ending, here
- return 2
-end
diff --git a/scripts/slipro_gtr2_villota.lua b/scripts/slipro_gtr2_villota.lua
deleted file mode 100755
index 7919983..0000000
--- a/scripts/slipro_gtr2_villota.lua
+++ /dev/null
@@ -1,102 +0,0 @@
--- Custom Scripts Template SLIMax Manager Scripts v2.0
--- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2012-12-02
-
-
--- villota77's script for F1 2013 - v1.3.2
-
--- This script tries to imitate the way KERS and delta time info is shown in real F1 steering wheel displays
--- (1) KERS is shown in the left display as a pure number (in percentage)
--- (2) Delta time ("qualy time") with respect to best (or last) lap is shown in the right display
--- in X.XX format (if it is positive - note there is not a "+" sign in SLIPro)
--- or -X.XX format (if it is negative)
--- (3) Delta-time info is refreshed every 1 second so you don't have digits flickering
--- (4) At the end of the lap, the right display will freeze and show deltatime (to best lap) during a number of seconds chosen in SLIMaxMng
---- (General Options - LAPTIMEDISPLAYDELAY). Then it will resume showing real-time data.
-
-
--- ================================
--- CONSTANTS
-
--- ================================
--- additional lua extension module dll
-
--- ================================
--- additional scripts file
-require "scripts/villota_scripts/villota_custom_functions"
-
--- ================================
--- custom globals
-
--- ================================
--- custom functions
-
--- ================================
--- custom events
-
-
-function custom_initEvent(scriptfile)
- -- type your custom script initialization here
-end
-
-function custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_deviceReport(devType)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_ospMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
- return 2
-end
-
-function custom_shiftLightsMethodEvent(idx)
- -- type your custom shiftlights method here
- return 2
-end
-
-function custom_shiftLightsBU0710Event(idx)
- -- type your custom shiftlights method for BU0710 device only here
- return 2
-end
-
-function custom_leftDigitsEvent(swFunction)
- -- type your custom functions here
- return 2
-end
-
-function custom_rightDigitsEvent(swFunction)
- -- call custom function
- return villota_custom_rightDigitsEvent(swFunction)
-end
-
-
-function custom_spdLmtMethodEvent(idx)
- -- type your custom speedlimiter method here
- return 2
-end
-
-function custom_gearEvent(gear)
- -- type your custom gear event script here
- return 2
-end
-
-function custom_enterSessionEvent(devType)
- -- type your custom script on session start, here
- return 2
-end
-
-function custom_exitSessionEvent(devType)
- -- type your custom script on session ending, here
- return 2
-end
-
--- triggered from v2.2.4 of SMX2
-function custom_ledEvent(ledIndex, ledFunction, ledState)
- -- type your custom script on session ending, here
- return 2
-end
diff --git a/scripts/slipro_iracing.lua b/scripts/slipro_iracing.lua
index 2d5b5ba..2d5b5ba 100755..100644
--- a/scripts/slipro_iracing.lua
+++ b/scripts/slipro_iracing.lua
diff --git a/scripts/slipro_iracing_basic.lua b/scripts/slipro_iracing_basic.lua
deleted file mode 100755
index 336a7f2..0000000
--- a/scripts/slipro_iracing_basic.lua
+++ /dev/null
@@ -1,11 +0,0 @@
--- iRacing Custom Scripts - SLIMax Manager Scripts v1.8
--- Copyright ©2011-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2012-09-16
-
--- ================================
--- add the short desciption of your script(s) in mScript_Info global var
-mScript_Info = "A useful iRacing custom scripts to select automatically the good settings for each iracing car you drive (shiftlights, max gears, osp, et.)."
-
--- ================================
--- load common scripts file
-require "scripts/zdoc_scripts/iracing_common_scripts" \ No newline at end of file
diff --git a/scripts/slipro_lfs_villota.lua b/scripts/slipro_lfs_villota.lua
deleted file mode 100755
index 7919983..0000000
--- a/scripts/slipro_lfs_villota.lua
+++ /dev/null
@@ -1,102 +0,0 @@
--- Custom Scripts Template SLIMax Manager Scripts v2.0
--- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2012-12-02
-
-
--- villota77's script for F1 2013 - v1.3.2
-
--- This script tries to imitate the way KERS and delta time info is shown in real F1 steering wheel displays
--- (1) KERS is shown in the left display as a pure number (in percentage)
--- (2) Delta time ("qualy time") with respect to best (or last) lap is shown in the right display
--- in X.XX format (if it is positive - note there is not a "+" sign in SLIPro)
--- or -X.XX format (if it is negative)
--- (3) Delta-time info is refreshed every 1 second so you don't have digits flickering
--- (4) At the end of the lap, the right display will freeze and show deltatime (to best lap) during a number of seconds chosen in SLIMaxMng
---- (General Options - LAPTIMEDISPLAYDELAY). Then it will resume showing real-time data.
-
-
--- ================================
--- CONSTANTS
-
--- ================================
--- additional lua extension module dll
-
--- ================================
--- additional scripts file
-require "scripts/villota_scripts/villota_custom_functions"
-
--- ================================
--- custom globals
-
--- ================================
--- custom functions
-
--- ================================
--- custom events
-
-
-function custom_initEvent(scriptfile)
- -- type your custom script initialization here
-end
-
-function custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_deviceReport(devType)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_ospMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
- return 2
-end
-
-function custom_shiftLightsMethodEvent(idx)
- -- type your custom shiftlights method here
- return 2
-end
-
-function custom_shiftLightsBU0710Event(idx)
- -- type your custom shiftlights method for BU0710 device only here
- return 2
-end
-
-function custom_leftDigitsEvent(swFunction)
- -- type your custom functions here
- return 2
-end
-
-function custom_rightDigitsEvent(swFunction)
- -- call custom function
- return villota_custom_rightDigitsEvent(swFunction)
-end
-
-
-function custom_spdLmtMethodEvent(idx)
- -- type your custom speedlimiter method here
- return 2
-end
-
-function custom_gearEvent(gear)
- -- type your custom gear event script here
- return 2
-end
-
-function custom_enterSessionEvent(devType)
- -- type your custom script on session start, here
- return 2
-end
-
-function custom_exitSessionEvent(devType)
- -- type your custom script on session ending, here
- return 2
-end
-
--- triggered from v2.2.4 of SMX2
-function custom_ledEvent(ledIndex, ledFunction, ledState)
- -- type your custom script on session ending, here
- return 2
-end
diff --git a/scripts/slipro_rfactor2_villota.lua b/scripts/slipro_rfactor2_villota.lua
deleted file mode 100755
index 7919983..0000000
--- a/scripts/slipro_rfactor2_villota.lua
+++ /dev/null
@@ -1,102 +0,0 @@
--- Custom Scripts Template SLIMax Manager Scripts v2.0
--- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2012-12-02
-
-
--- villota77's script for F1 2013 - v1.3.2
-
--- This script tries to imitate the way KERS and delta time info is shown in real F1 steering wheel displays
--- (1) KERS is shown in the left display as a pure number (in percentage)
--- (2) Delta time ("qualy time") with respect to best (or last) lap is shown in the right display
--- in X.XX format (if it is positive - note there is not a "+" sign in SLIPro)
--- or -X.XX format (if it is negative)
--- (3) Delta-time info is refreshed every 1 second so you don't have digits flickering
--- (4) At the end of the lap, the right display will freeze and show deltatime (to best lap) during a number of seconds chosen in SLIMaxMng
---- (General Options - LAPTIMEDISPLAYDELAY). Then it will resume showing real-time data.
-
-
--- ================================
--- CONSTANTS
-
--- ================================
--- additional lua extension module dll
-
--- ================================
--- additional scripts file
-require "scripts/villota_scripts/villota_custom_functions"
-
--- ================================
--- custom globals
-
--- ================================
--- custom functions
-
--- ================================
--- custom events
-
-
-function custom_initEvent(scriptfile)
- -- type your custom script initialization here
-end
-
-function custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_deviceReport(devType)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_ospMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
- return 2
-end
-
-function custom_shiftLightsMethodEvent(idx)
- -- type your custom shiftlights method here
- return 2
-end
-
-function custom_shiftLightsBU0710Event(idx)
- -- type your custom shiftlights method for BU0710 device only here
- return 2
-end
-
-function custom_leftDigitsEvent(swFunction)
- -- type your custom functions here
- return 2
-end
-
-function custom_rightDigitsEvent(swFunction)
- -- call custom function
- return villota_custom_rightDigitsEvent(swFunction)
-end
-
-
-function custom_spdLmtMethodEvent(idx)
- -- type your custom speedlimiter method here
- return 2
-end
-
-function custom_gearEvent(gear)
- -- type your custom gear event script here
- return 2
-end
-
-function custom_enterSessionEvent(devType)
- -- type your custom script on session start, here
- return 2
-end
-
-function custom_exitSessionEvent(devType)
- -- type your custom script on session ending, here
- return 2
-end
-
--- triggered from v2.2.4 of SMX2
-function custom_ledEvent(ledIndex, ledFunction, ledState)
- -- type your custom script on session ending, here
- return 2
-end
diff --git a/scripts/slipro_rfactor_villota.lua b/scripts/slipro_rfactor_villota.lua
deleted file mode 100755
index 7919983..0000000
--- a/scripts/slipro_rfactor_villota.lua
+++ /dev/null
@@ -1,102 +0,0 @@
--- Custom Scripts Template SLIMax Manager Scripts v2.0
--- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2012-12-02
-
-
--- villota77's script for F1 2013 - v1.3.2
-
--- This script tries to imitate the way KERS and delta time info is shown in real F1 steering wheel displays
--- (1) KERS is shown in the left display as a pure number (in percentage)
--- (2) Delta time ("qualy time") with respect to best (or last) lap is shown in the right display
--- in X.XX format (if it is positive - note there is not a "+" sign in SLIPro)
--- or -X.XX format (if it is negative)
--- (3) Delta-time info is refreshed every 1 second so you don't have digits flickering
--- (4) At the end of the lap, the right display will freeze and show deltatime (to best lap) during a number of seconds chosen in SLIMaxMng
---- (General Options - LAPTIMEDISPLAYDELAY). Then it will resume showing real-time data.
-
-
--- ================================
--- CONSTANTS
-
--- ================================
--- additional lua extension module dll
-
--- ================================
--- additional scripts file
-require "scripts/villota_scripts/villota_custom_functions"
-
--- ================================
--- custom globals
-
--- ================================
--- custom functions
-
--- ================================
--- custom events
-
-
-function custom_initEvent(scriptfile)
- -- type your custom script initialization here
-end
-
-function custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_deviceReport(devType)
- -- type your script here (just before sending report to the device )
- return 2
-end
-
-function custom_ospMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
- return 2
-end
-
-function custom_shiftLightsMethodEvent(idx)
- -- type your custom shiftlights method here
- return 2
-end
-
-function custom_shiftLightsBU0710Event(idx)
- -- type your custom shiftlights method for BU0710 device only here
- return 2
-end
-
-function custom_leftDigitsEvent(swFunction)
- -- type your custom functions here
- return 2
-end
-
-function custom_rightDigitsEvent(swFunction)
- -- call custom function
- return villota_custom_rightDigitsEvent(swFunction)
-end
-
-
-function custom_spdLmtMethodEvent(idx)
- -- type your custom speedlimiter method here
- return 2
-end
-
-function custom_gearEvent(gear)
- -- type your custom gear event script here
- return 2
-end
-
-function custom_enterSessionEvent(devType)
- -- type your custom script on session start, here
- return 2
-end
-
-function custom_exitSessionEvent(devType)
- -- type your custom script on session ending, here
- return 2
-end
-
--- triggered from v2.2.4 of SMX2
-function custom_ledEvent(ledIndex, ledFunction, ledState)
- -- type your custom script on session ending, here
- return 2
-end
diff --git a/scripts/speedlimiter.lua b/scripts/speedlimiter.lua
index 8ce1f63..81bef78 100755..100644
--- a/scripts/speedlimiter.lua
+++ b/scripts/speedlimiter.lua
@@ -1,7 +1,7 @@
--- SLIMax Mgr Lua Script v3
+-- SLIMax Mgr Lua Script v3.3.1
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all speed/pit-limiter feedback methods
--- last change by Zappadoc - 2013-02
+-- last change by Zappadoc - 2013-10
-- SLI-M, SLI-PRO speed limiter Methods
function spdLmtMethodEvent(idx)
@@ -33,8 +33,8 @@ function spdLmtMethodEvent(idx)
-- get global prefs
GetSLIMaxInfo()
- -- init table
- if idx >= 2 then
+ if mSpdLimitMethod >= 2 then
+ -- init table
initLedTable(mRPMLedTable, 0)
SetRPMLed("mRPMLedTable")
end
@@ -241,16 +241,16 @@ end
-- G27 speed limiter Methods
function spdLmtG27MethodEvent(idx)
- mSpdLimitMethod = idx
+ mSpdLimitG27Method = idx
-- call custom script
- local result = custom_spdLmtG27MethodEvent(mSpdLimitMethod)
+ local result = custom_spdLmtG27MethodEvent(mSpdLimitG27Method)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_spdLmtG27MethodEvent(mSpdLimitMethod)
+ result = global_custom_spdLmtG27MethodEvent(mSpdLimitG27Method)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
@@ -270,11 +270,11 @@ function spdLmtG27MethodEvent(idx)
-- init table
mG27Leds = 0
- if mNoBlink or mSpdLimitMethod == 0 then
+ if mNoBlink or mSpdLimitG27Method == 0 then
-- speedlimiter led NOT blinking
mG27Leds = 0x1F
- elseif mSpdLimitMethod == 1 then
+ elseif mSpdLimitG27Method == 1 then
-- speedlimiter led blinking, method 1
if GetTicks() > mOldTickCount then
mSpdLmtBlink = mSpdLmtBlink + 1
@@ -294,7 +294,7 @@ function spdLmtG27MethodEvent(idx)
mG27Leds = 0
end
- elseif mSpdLimitMethod >= 2 then
+ elseif mSpdLimitG27Method >= 2 then
-- speedlimiter alternate led blinking, method 2 to n
if GetTicks() > mOldTickCount then
mSpdLmtBlink = mSpdLmtBlink + 1
@@ -330,17 +330,17 @@ end
-- Fanatec speed/pit limiter Methods
function spdLmtFanatecMethodEvent(idx)
- mSpdLimitMethod = idx
+ mSpdLimitFanatecMethod = idx
mFanatecSpdLmtText = " "
-- call custom script
- local result = custom_spdLmtFanatecMethodEvent(mSpdLimitMethod)
+ local result = custom_spdLmtFanatecMethodEvent(mSpdLimitFanatecMethod)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
-- if result >= 2 continue
-- call global custom script
- result = global_custom_spdLmtFanatecMethodEvent(mSpdLimitMethod)
+ result = global_custom_spdLmtFanatecMethodEvent(mSpdLimitFanatecMethod)
-- if result = 0 bypass the script below and return 0
-- if result = 1 bypass the script below and return 1
if result <= 1 then return result end
@@ -359,15 +359,22 @@ function spdLmtFanatecMethodEvent(idx)
-- init table
initLedTable(mRPMLedTable, 0)
- SetFanatecLed("mRPMLedTable")
+ SetRPMLed("mRPMLedTable")
- if mNoBlink or mSpdLimitMethod == 0 then
+ if mNoBlink or mSpdLimitFanatecMethod == 0 then
-- speedlimiter first rpm led NOT blinking
SetFanatecDigitsAllowed(true)
mRPMLedTable["RPM0"]= 1
- SetFanatecLed("mRPMLedTable")
+ SetRPMLed("mRPMLedTable")
+ if mLimiterChar then
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ else
+ SetFanatecDigitsAllowed(true)
+ end
- elseif mSpdLimitMethod == 1 then
+ elseif mSpdLimitFanatecMethod == 1 then
-- speedlimiter first rpm led blinking
if GetTicks() > mOldTickCount then
mSpdLmtBlink = mSpdLmtBlink + 1
@@ -380,28 +387,23 @@ function spdLmtFanatecMethodEvent(idx)
-- one led
mRPMLedTable["RPM0"]= 1
- SetFanatecDigitsAllowed(true)
-
- -- if not mSpdLmtRPMLedOnly then
- -- SetFanatecDigitsAllowed(false)
- -- if mLimiterChar then
- -- SetFanatecGear("L", false)
- -- else
- -- SetFanatecDigits( "---" )
- -- end
- -- end
+ if mLimiterChar then
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ end
end
if mSpdLmtBlink > (mBlinkTime / 2) then
mRPMLedTable["RPM0"]= 0
- -- if not mSpdLmtRPMLedOnly then
- -- SetFanatecDigitsAllowed(true)
- -- SetFanatecDigits( " " )
- -- end
+ if mLimiterChar then
+ oldGear = 110
+ SetFanatecDigitsAllowed(true)
+ end
end
- SetFanatecLed("mRPMLedTable")
+ SetRPMLed("mRPMLedTable")
- elseif mSpdLimitMethod == 2 then
+ elseif mSpdLimitFanatecMethod == 2 then
-- speedlimiter all rpm led blinking
if GetTicks() > mOldTickCount then
mSpdLmtBlink = mSpdLmtBlink + 1
@@ -410,30 +412,26 @@ function spdLmtFanatecMethodEvent(idx)
mSpdLmtBlink = 0
end
if mSpdLmtBlink <= (mBlinkTime / 2) then
-
initLedTable(mRPMLedTable, 1)
- SetFanatecDigitsAllowed(true)
- -- if not mSpdLmtRPMLedOnly then
- -- SetFanatecDigitsAllowed(false)
- -- if mLimiterChar then
- -- SetFanatecGear("L", false)
- -- else
- -- SetFanatecDigits( "---" )
- -- end
- -- end
+ if mLimiterChar then
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ end
end
if mSpdLmtBlink > (mBlinkTime / 2) then
initLedTable(mRPMLedTable, 0)
- -- if not mSpdLmtRPMLedOnly then
- -- SetFanatecDigitsAllowed(true)
- -- SetFanatecDigits( " " )
- -- end
+
+ if mLimiterChar then
+ oldGear = 110
+ SetFanatecDigitsAllowed(true)
+ end
end
- SetFanatecLed("mRPMLedTable")
+ SetRPMLed("mRPMLedTable")
- elseif mSpdLimitMethod == 3 or mSpdLimitMethod > 6 then
+ elseif mSpdLimitFanatecMethod == 3 or mSpdLimitFanatecMethod > 6 then
-- speedlimiter alternate RPM blinking
if GetTicks() > mOldTickCount then
mSpdLmtBlink = mSpdLmtBlink + 1
@@ -451,13 +449,12 @@ function spdLmtFanatecMethodEvent(idx)
mRPMLedTable[led] = 0
end
end
- if not mSpdLmtRPMLedOnly then
- SetFanatecDigitsAllowed(false)
- if mLimiterChar then
- SetFanatecGear("L", false)
- else
- SetFanatecDigits( "---" )
- end
+ SetFanatecDigitsAllowed(false)
+ if mLimiterChar then
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ else
+ SetFanatecDigits( "---" )
end
end
@@ -471,15 +468,12 @@ function spdLmtFanatecMethodEvent(idx)
end
end
- if not mSpdLmtRPMLedOnly then
- SetFanatecDigitsAllowed(true)
- --SetFanatecDigits( " " )
- end
+ SetFanatecDigitsAllowed(true)
end
- SetFanatecLed("mRPMLedTable")
+ SetRPMLed("mRPMLedTable")
- elseif mSpdLimitMethod == 4 or mSpdLimitMethod == 5 then
+ elseif mSpdLimitFanatecMethod == 4 or mSpdLimitFanatecMethod == 5 then
-- speedlimiter no led digits only
if GetTicks() > mOldTickCount then
mSpdLmtBlink = mSpdLmtBlink + 1
@@ -491,24 +485,31 @@ function spdLmtFanatecMethodEvent(idx)
if mSpdLmtBlink <= (mBlinkTime / 2) then
initLedTable(mRPMLedTable, 0)
- if mSpdLimitMethod == 4 then
- SetFanatecDigitsAllowed(true)
- else
+
+ if mLimiterChar then
SetFanatecDigitsAllowed(false)
- SetFanatecDigits( " " )
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ else
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( "---" )
end
end
if mSpdLmtBlink > (mBlinkTime / 2) then
- SetFanatecDigitsAllowed(false)
- SetFanatecDigits( "---" )
+ if mSpdLimitFanatecMethod == 4 then
+ SetFanatecDigitsAllowed(true)
+ else
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " " )
+ end
initLedTable(mRPMLedTable, 0)
end
- SetFanatecLed("mRPMLedTable")
+ SetRPMLed("mRPMLedTable")
- elseif mSpdLimitMethod == 6 then
+ elseif mSpdLimitFanatecMethod == 6 then
-- speedlimiter freezed rpm + digits blinking
if GetTicks() > mOldTickCount then
mSpdLmtBlink = mSpdLmtBlink + 1
@@ -520,10 +521,14 @@ function spdLmtFanatecMethodEvent(idx)
if mSpdLmtBlink <= (mBlinkTime / 2) then
initLedTable(mRPMLedTable, 1)
- --if not mSpdLmtRPMLedOnly then
- SetFanatecDigitsAllowed(true)
- --SetFanatecDigits( " " )
- --end
+
+ if mLimiterChar then
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ else
+ SetFanatecDigitsAllowed(true)
+ end
end
if mSpdLmtBlink > (mBlinkTime / 2) then
@@ -533,8 +538,474 @@ function spdLmtFanatecMethodEvent(idx)
initLedTable(mRPMLedTable, 1)
end
- SetFanatecLed("mRPMLedTable")
+ SetRPMLed("mRPMLedTable")
+
+ else
+ return 1
+ end
+
+ -- timebase
+ if GetTicks() > mOldTickCount then
+ mOldTickCount = GetTicks() + 20
+ end
+ return 1
+end
+
+-- SIM RACE Deluxe speed limiter Methods
+function spdLmtSRDlxMethodEvent(idx)
+ mSpdLimitSRDlxMethod = idx
+ mLeftSpdLmtText = " "
+ mRightSpdLmtText = " "
+ -- call custom script
+ local result = custom_spdLmtSRDlxMethodEvent(mSpdLimitSRDlxMethod)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_spdLmtSRDlxMethodEvent(mSpdLimitSRDlxMethod)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ local led = ""
+
+ -- check if initialized
+ if isGlobalInitialized == 0 then
+ isGlobalInitialized = 1
+ -- init them
+ InitGlobals()
+ end
+ -- get global prefs
+ GetSLIMaxInfo()
+
+ -- init table
+ initLedTable(mRPMLedTable, 0)
+ SetRPMLed("mRPMLedTable")
+
+ if mNoBlink or (mSpdLimitSRDlxMethod == 0) then
+ -- speedlimiter led NOT blinking
+ SetWarnLed(mSpeedLimiterLED, 1)
+
+ elseif mSpdLimitSRDlxMethod == 1 then
+ -- speedlimiter led blinking, method 1
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+
+ elseif mSpdLimitSRDlxMethod == 2 then
+ -- speedlimiter led + RPM blinking, method 2
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ initLedTable(mRPMLedTable, 1)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ initLedTable(mRPMLedTable, 0)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
+
+ elseif mSpdLimitSRDlxMethod == 3 then
+ -- speedlimiter led + alternate RPM blinking, method 3
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit("L")
+ end
+ for i = 0,12 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 1
+ else
+ mRPMLedTable[led] = 0
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit(" ")
+ end
+ for i = 0,13 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 0
+ else
+ mRPMLedTable[led] = 1
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
+
+ elseif mSpdLimitSRDlxMethod == 4 then
+ -- speedlimiter led + RPM + digits blinking, method 4
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+
+ if mLimiterChar then SetGearDigit("L") end
+ SetDigitsAllowed(true)
+
+ for i = 0,2 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ for i = 10,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+
+ SetDigitsAllowed(false)
+
+ SetLeftDigits (mLeftSpdLmtText)
+ SetRightDigits (mRightSpdLmtText)
+
+ for i = 0,2 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ for i = 10,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
+
+ elseif mSpdLimitSRDlxMethod == 5 or mSpdLimitSRDlxMethod == 6 then
+ -- speedlimiter led + digits blinking, method 5
+ -- speedlimiter led + RPM fixed + Digits blinking, method 6
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+
+ SetDigitsAllowed (true)
+
+ local state = 0
+ if mSpdLimitSRDlxMethod == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+
+ SetLeftDigits ( mLeftSpdLmtText)
+ SetRightDigits ( mRightSpdLmtText)
+
+ SetDigitsAllowed(false)
+
+ local state = 0
+ if mSpdLimitSRDlxMethod == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
+
+ else
+ return 1
+ end
+
+ -- timebase
+ if GetTicks() > mOldTickCount then
+ mOldTickCount = GetTicks() + 20
+ end
+ return 1
+end
+-- SIM RACE F1 speed limiter Methods
+function spdLmtSRF1MethodEvent(idx)
+ mSpdLimitSRF1Method = idx
+ mLeftSpdLmtText = " "
+ mRightSpdLmtText = " "
+ -- call custom script
+ local result = custom_spdLmtSRF1MethodEvent(mSpdLimitSRF1Method)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_spdLmtSRF1MethodEvent(mSpdLimitSRF1Method)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ local led = ""
+
+ -- check if initialized
+ if isGlobalInitialized == 0 then
+ isGlobalInitialized = 1
+ -- init them
+ InitGlobals()
+ end
+ -- get global prefs
+ GetSLIMaxInfo()
+
+ -- init table
+ initLedTable(mRPMLedTable, 0)
+ SetRPMLed("mRPMLedTable")
+
+ if mNoBlink or (mSpdLimitSRF1Method == 0) then
+ -- speedlimiter led NOT blinking
+ SetWarnLed(mSpeedLimiterLED, 1)
+
+ elseif mSpdLimitSRF1Method == 1 then
+ -- speedlimiter led blinking, method 1
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+
+ elseif mSpdLimitSRF1Method == 2 then
+ -- speedlimiter led + RPM blinking, method 2
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ initLedTable(mRPMLedTable, 1)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ initLedTable(mRPMLedTable, 0)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
+
+ elseif mSpdLimitSRF1Method == 3 then
+ -- speedlimiter led + alternate RPM blinking, method 3
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit("L")
+ end
+ for i = 0,14 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 1
+ else
+ mRPMLedTable[led] = 0
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit(" ")
+ end
+ for i = 0,15 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 0
+ else
+ mRPMLedTable[led] = 1
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
+
+ elseif mSpdLimitSRF1Method == 4 then
+ -- speedlimiter led + RPM + digits blinking, method 4
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+
+ if mLimiterChar then SetGearDigit("L") end
+ SetDigitsAllowed(true)
+
+ for i = 0,4 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+
+ SetDigitsAllowed(false)
+
+ SetLeftDigits (mLeftSpdLmtText)
+ SetRightDigits (mRightSpdLmtText)
+
+ for i = 0,4 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
+
+ elseif mSpdLimitSRF1Method == 5 or mSpdLimitSRF1Method == 6 then
+ -- speedlimiter led + digits blinking, method 5
+ -- speedlimiter led + RPM fixed + Digits blinking, method 6
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+
+ SetDigitsAllowed (true)
+
+ local state = 0
+ if mSpdLimitSRF1Method == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+
+ SetLeftDigits ( mLeftSpdLmtText)
+ SetRightDigits ( mRightSpdLmtText)
+
+ SetDigitsAllowed(false)
+
+ local state = 0
+ if mSpdLimitSRF1Method == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
+
+
else
return 1
end
diff --git a/scripts/srf1emu_iracing.lua b/scripts/srf1emu_iracing.lua
new file mode 100644
index 0000000..e50287c
--- /dev/null
+++ b/scripts/srf1emu_iracing.lua
@@ -0,0 +1,11 @@
+-- iRacing Custom Scripts - SLIMax Manager Scripts v1.9
+-- Copyright ©2011-2013 by Zappadoc - All Rights Reserved.
+-- last change by Zappadoc - 2013-08
+
+-- ================================
+-- add the short desciption of your script(s) in mScript_Info global var
+mScript_Info = "A useful iRacing COMBO SETUP to select automatically the good settings for each iracing car you drive (shiftlights, max gears, osp, et.)."
+
+-- ================================
+-- load common scripts file
+require "scripts/zdoc_scripts/iracing_common_scripts" \ No newline at end of file
diff --git a/scripts/villota_scripts/villota_custom_functions.lua b/scripts/villota_scripts/villota_custom_functions.lua
deleted file mode 100755
index 0a39b78..0000000
--- a/scripts/villota_scripts/villota_custom_functions.lua
+++ /dev/null
@@ -1,158 +0,0 @@
--- Custom Scripts Template SLIMax Manager Scripts v2.0
--- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2012-12-03
-
-
--- villota77's script for F1 2012 - v1.3.2
-
--- This script tries to imitate the way KERS and delta time info is shown in real F1 steering wheel displays
--- (1) KERS is shown in the left display as a pure number (in percentage)
--- (2) Delta time ("qualy time") with respect to best (or last) lap is shown in the right display
--- in X.XX format (if it is positive - note there is not a "+" sign in SLIPro)
--- or -X.XX format (if it is negative)
--- (3) Delta-time info is refreshed every 1 second so you don't have digits flickering
--- (4) At the end of the lap, the right display will freeze and show deltatime (to best lap) during a number of seconds chosen in SLIMaxMng
---- (General Options - LAPTIMEDISPLAYDELAY). Then it will resume showing real-time data.
-
-
-function ev_ShowTime(lptime, T, Ndig, deltaflag)
- local ticks = GetTicks()
- -- show time every T milliseconds with Ndig decimal digits
-
- if ev_old_time == nil or (ticks - ev_old_time) > T then
- -- global to backup ticks (ms)
- ev_old_time = ticks
-
- local hr = 0
- local mn = 0
- local sc = 0
- local ms = 0
- local hd = 0
- local rpanel = ""
- local prefix = " "
-
- if lptime < 0 then
- prefix = "-"
- end
- -- explod time
- hr, mn, sc, hd, ms = timeDispatcher(lptime)
-
- if deltaflag == 1 then
- --display delta time
- if lptime == -1 or (mn + sc + ms) == 0.0 then
- rPanel = " -.-- "
- elseif mn > 0 then
- rPanel = string.format( " %s%1d.%02d ", prefix, mn, sc)
- else
- if Ndig == 2 then
- rPanel = string.format( " %s%1d.%02d ", prefix, sc, hd)
- else
- rPanel = string.format( " %s%1d.%03d", prefix, sc, ms)
- end
- end
-
- elseif deltaflag == 0 then
- --display laptime
- if lptime == -1 or (mn + sc + ms) == 0.0 then
- rPanel = "-:--.---"
- elseif mn < 10 then
- rPanel = string.format( "%1d:%02d.%03d", mn, sc, ms)
- elseif hr > 0 then
- rPanel = string.format( " %02d.%02d ", hr, mn)
- else
- rPanel = string.format( " %02d.%02d.%01d", mn, sc, ms)
- end
- end
- end
-
- SetRightDigits( rPanel )
- -- return 1 to bypass std behavior
- return 1
-end
-
-
-function villota_custom_leftDigitsEvent(swFunction)
-
- -- get current simulation name
- local sim = GetContextInfo("simulation")
-
- if sim == "f1_2012.exe" then
-
- local lPanel = ""
-
- -- is OSP Tracking ON
- local ospt = GetContextInfo("osptracking")
- if ospt then return 2 end
-
- -- check if quick info button is down
- local qi = GetContextInfo("quickinfobutton")
- if qi then return 2 end
-
- if swFunction == 33 then
- -- 33: KERSpercentage, wothout prefix
- local kersp = GetCarInfo("kers")
- lPanel = string.format(" %3d ", round((kersp/1000)/4))
- SetLeftDigits( lPanel )
- return 1
-
- end
-
- end
- return 2
-end
-
-function villota_custom_rightDigitsEvent(swFunction)
-
- -- get current simulation name
- local sim = GetContextInfo("simulation")
- if sim == "f1_2012.exe" or sim == "rFactor.exe" or sim == "rFactor2.exe" or sim == "LFS.exe" or sim == "GTR2.exe" then
-
- local delta = 0.0
-
- -- is OSP Tracking ON
- local ospt = GetContextInfo("osptracking")
- if ospt then return 2 end
-
- -- check if quick info button is down
- local qi = GetContextInfo("quickinfobutton")
- if qi then return 2 end
-
- local dltime = GetContextInfo( "displaylaptime" )
- if dltime == true then
- --freeze last delta time in display
- local lpt_last = GetTimeInfo("lastlaptime")
- local lpt_best = GetTimeInfo("bestlaptime")
- if ev_old_bestLapTime == nil then ev_old_bestLapTime = lpt_best end
- ev_final_delta_best = lpt_last - ev_old_bestLapTime
- if ev_final_delta_best == 0 then
- return 2
- else
- return ev_ShowTime(ev_final_delta_best, 50, 3, 1)
- end
- else
- --update best time if last laptime was better
- if ev_final_delta_best ~= nil and ev_final_delta_best < 0 then
- ev_old_bestLapTime = lpt_last
- end
- end
-
- if swFunction == 11 then
- -- 11: real time best laptime difference DELTA time
- -- real time diff vs your best
-
- delta = GetTimeInfo("realdiffbest")
- return ev_ShowTime(delta, 1000, 2, 1)
-
- elseif swFunction == 12 then
- -- 12: real time last laptime difference DELTA time
- -- real time diff vs your last
-
- delta = GetTimeInfo("realdifflast")
- return ev_ShowTime(delta, 1000, 2, 1)
- end
-
- end
- return 2
-end
-
-
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
diff --git a/scripts/zdoc_scripts/iracing_stuff.lua b/scripts/zdoc_scripts/iracing_stuff.lua
index 42a708d..ee942d6 100755..100644
--- a/scripts/zdoc_scripts/iracing_stuff.lua
+++ b/scripts/zdoc_scripts/iracing_stuff.lua
@@ -1,18 +1,19 @@
--- Custom SLIMax Manager Scripts for iRacing v3
+-- Custom SLIMax Manager Scripts for iRacing v3.2.1
-- Copyright ©2012-2013 by Zappadoc
--- _last change by Zappadoc - 2013-02
+-- _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(devType)
+function iRacing_DebugCarInfo(deviceType)
-- see debug console window
-- get car name
- local dev = GetDeviceType(devType)
+ 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 .. "\nMaxGear:" .. mxG .. "\nOSP Factor:" .. ospf .. "\n");
+ print("\n----------\nDevice:"..dev.."\nSetup car:" .. cNm .. "(" .. rdz .. ")" .. "\nMaxGear:" .. mxG .. "\nOSP Factor:" .. ospf .. "\n");
end
function iRacing_InitGearEvent(gear)
@@ -44,6 +45,10 @@ function iRacing_CarSetup(cGear)
mxG = 6
ospf = 150
+ elseif cNm == "kiaoptima" then
+ mxG = 5
+ ospf = 150
+
elseif cNm == "formulamazda" then
mxG = 6
ospf = 60
@@ -174,7 +179,7 @@ function FixRPMSpeedlimiter()
-- init table
initLedTable(mRPMLedTable, 0)
SetRPMLed("mRPMLedTable")
- for i = 0,12 do
+ for i = 0,14 do
led = led.format("RPM%d",i)
mRPMLedTable[led] = 1
end
@@ -182,7 +187,7 @@ function FixRPMSpeedlimiter()
end
-function iRacing_spdLmtMethodEvent(idx, devType)
+function iRacing_spdLmtMethodEvent(idx, deviceType)
local led = ""
-- get car name
@@ -298,6 +303,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
-- 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
@@ -306,12 +315,20 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -320,13 +337,32 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -334,6 +370,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -341,6 +381,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -348,6 +392,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -355,6 +403,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -362,6 +414,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -369,6 +425,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -376,6 +436,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -383,6 +447,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -390,6 +458,10 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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
@@ -397,7 +469,11 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
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, 7.9, 8.15, 8.2, 8.25, 8.3, 8.35, 8.5, 8.8, 8.98 )
+ 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
@@ -422,7 +498,11 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
else
-- default
if dev == "FANATEC" then
- ProgressiveFanatec(rpm, 4.5, 5, 6.5, 7, 7.5, 8, 8.5, 8.8, 8.98 )
+ 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
@@ -432,21 +512,21 @@ function iRacing_shiftLightsMethodEvent(idx, dev)
SetRPMLed(tName)
end
-function iRacing_ospMethodEvent(idx, devType)
+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 devType == "FANATEC" then
- -- mOSPMethod = 0
- --else
+ if deviceType == "FANATEC" then
+ mOSPMethod = 1
+ else
mOSPMethod = 3
- --end
+ end
-- else
-- -- default
- -- if devType == "FANATEC" then
+ -- if deviceType == "FANATEC" then
-- mOSPMethod = 1
-- end
end