summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/controls.lua253
-rwxr-xr-xscripts/devhook.lua40
-rwxr-xr-xscripts/enter_exit_session.lua37
-rwxr-xr-xscripts/gear.lua65
-rwxr-xr-xscripts/global.lua442
-rwxr-xr-xscripts/global_custom_scripts.lua159
-rwxr-xr-xscripts/led.lua45
-rwxr-xr-xscripts/osp.lua159
-rwxr-xr-xscripts/shiftlights.lua333
-rwxr-xr-xscripts/slidevice.lua23
-rwxr-xr-xscripts/sliemu_iracing_basic.lua11
-rwxr-xr-xscripts/slim_iracing_basic.lua11
-rwxr-xr-xscripts/slimax_script_readme.txt541
-rwxr-xr-xscripts/slipro.lua669
-rwxr-xr-xscripts/slipro_f1_2012_villota.lua102
-rwxr-xr-xscripts/slipro_gtr2_villota.lua102
-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
-rwxr-xr-xscripts/speedlimiter.lua238
-rwxr-xr-xscripts/villota_scripts/villota_custom_functions.lua158
-rwxr-xr-xscripts/zdoc_scripts/iracing_common_scripts.lua136
-rwxr-xr-xscripts/zdoc_scripts/iracing_stuff.lua355
-rwxr-xr-xslipro_gus.sli84
25 files changed, 4280 insertions, 0 deletions
diff --git a/scripts/controls.lua b/scripts/controls.lua
new file mode 100755
index 0000000..c8bf526
--- /dev/null
+++ b/scripts/controls.lua
@@ -0,0 +1,253 @@
+-- SLIMax Mgr Lua Script v2
+-- Copyright (c)2011-2013 by EK and Zappadoc - All Rights Reserved.
+-- Use this script to control any button or switch
+
+-- param deviceIdx = (see mDeviceType table)
+-- 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
+-- return 0 to give the control to SLIMax Mgr
+-- return 1 to force the update of device
+function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
+ -- call custom script
+ local result = custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
+ -- 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)
+ -- 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 loopFlag = false
+ local dev = ""
+ dev = mDeviceType[deviceIdx]
+ if dev == nil then dev = "none" end
+ -- switches and buttons
+ -- ctrl change event
+ local state = 0
+ local leftStr = ""
+ local rightStr = ""
+
+ local oldTcks = GetTicks()
+
+ local delay = 600
+ if funcIndex ~= -1 then
+ if IsSLIFunction("maxgear", funcIndex) and mMaxGearFeedbackAllowed then
+ -- max gear switch
+ -- value from 4 to 7
+ local mxgear = 0
+ mxgear = GetCarInfo("maxgear")
+
+ leftStr = " GEAR "
+ rightStr = rightStr.format( "MAX %1d", mxgear)
+
+ -- set digits
+ UpdateSLIProDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("brightness", funcIndex) and mBrightnessFeedbackAllowed then
+ -- brightness feedback (switch or buttons)
+ BrightnessFeedBack(dev)
+
+ leftStr = "888888"
+ rightStr = "888888"
+
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("ospfactor", funcIndex) and mOSPFeedbackAllowed then
+ -- OSP Factor feedback
+ leftStr = "OSP: "
+
+ local ospf = GetContextInfo("ospfactor")
+ rightStr = rightStr.format(" %03d ", ospf)
+
+ -- set digits
+ UpdateSLIProDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("speedmetric", funcIndex) and mUnitFeedbackAllowed then
+ -- metric KPH or MPH
+ local spdm = false
+ spdm = GetContextInfo("speedmetric")
+
+ leftStr = "SPD: "
+ rightStr = " KPH "
+ if spdm then rightStr = " MPH " end
+
+ -- set digits
+ UpdateSLIProDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ 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)
+
+ -- set digits
+ UpdateSLIProDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ 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)
+
+ -- set digits
+ UpdateSLIProDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("lowfuel", funcIndex) and mLowFuelFeedbackAllowed then
+ -- lowfuel feedback
+ -- get the option
+ local info = false
+ info = GetContextInfo("lowfuel")
+
+ -- set digits
+ leftStr = leftStr.format(" FUEL ", ctrlPos)
+ rightStr = rightStr.format("LPS %02d", info)
+
+ UpdateSLIProDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+ end
+ else
+ if ctrlType == 0 then
+ -- switch
+
+ if mDemoMapToKeyAllowed and ctrlPos == mDemoMapToKeySwitch then
+ -- demo script
+ -- mapping a keystroke (see global.lua to set the targeted switch)
+ local key = ""
+ if value == 2 then key = "v" end
+ -- if value == 3 then key = "K" end
+ -- if value == 4 then key = "v" end
+ -- if value == 5 then key = "F5" end
+ if key ~= "" then
+ -- params: key, delay, modifier
+ SetKeystroke(key, 100, "")
+ end
+ end
+
+ if mSwitchFeedbackAllowed then
+ -- general switch feedback (see global.lua to activate)
+ leftStr = leftStr.format("S%1d : ", ctrlPos)
+ rightStr = rightStr.format(" %02d ", value)
+
+ -- set digits
+ UpdateSLIProDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+ end
+ elseif ctrlType == 1 then
+ if ctrlPos == mDumpLapButton and dev == "SLI-PRO" and value>0 and mDumpLapAllowed then
+ -- sample script using button of SLI-PRO to
+ -- toggle telemetry dumplastlap flag (true or false)
+ -- telemetry logs are stored in telemetry directory
+ -- after each completed lap
+ local dlap = GetContextInfo("dumplastlap")
+ local flag = not dlap;
+ TelemetryTools("dumplastlap", flag);
+ -- set digits
+ leftStr = "tELENN"
+ if flag then
+ rightStr = " SAVE "
+ else
+ rightStr = " FALSE"
+ end
+ UpdateSLIProDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+ end
+ end
+ end
+
+ if state >= 1 then
+ -- loop until timeout
+ local newtcks = GetTicks()
+ loopFlag = true
+ while(oldTcks > newtcks and loopFlag ) do
+ SLISleep(10)
+ newtcks = GetTicks()
+ SetLeftDigits(leftStr)
+ SetRightDigits(rightStr)
+ SLISendReport(0)
+ end
+
+ -- cleanup device
+ oldTcks = 0
+ state = 0
+ toggleAllLed(0)
+ UpdateSLIProDigits(" ", " ")
+ SLISendReport(0)
+
+ -- allow Mgr to display info on digits
+ SetDigitsAllowed(true)
+ end
+
+ -- skip
+ return 0
+end
+
+-- set leds, digits, parts to cleanup and timeout
+function UpdateSLIProDigits(leftInfo, rightInfo)
+ -- do not refresh digits until timeout
+ SetDigitsAllowed(false)
+
+ -- set digits string
+ SetLeftDigits(leftInfo)
+ SetRightDigits(rightInfo)
+end
+
+-- brightness feedback function
+function BrightnessFeedBack(device)
+ -- set all leds
+ toggleAllLed(1)
+
+ if device == "SLI-PRO" then
+ -- SLI-PRO Device
+ -- set digits
+ UpdateSLIProDigits("888888", "888888")
+ end
+end
diff --git a/scripts/devhook.lua b/scripts/devhook.lua
new file mode 100755
index 0000000..90a8099
--- /dev/null
+++ b/scripts/devhook.lua
@@ -0,0 +1,40 @@
+-- SLIMax Mgr Lua Script v2
+-- Copyright (c)2011-2013 by EK and Zappadoc - All Rights Reserved.
+-- Use this script to bypass any previous functions and show what
+-- you want onto your device.
+
+
+-- param = device type (integer - see mDeviceType table)
+-- 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)
+ -- call custom script
+ local result = custom_deviceReport(devType)
+ -- 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)
+ -- 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
+
+
+ -- sim paused?
+ local paused = GetContextInfo("paused")
+ -- limiter ON?
+ local spdLmt = GetCarInfo("speedlimiter")
+ if paused or spdLmt == 0 then
+ -- reset value
+ SetDigitsAllowed(true)
+ end
+
+
+ -- skip and give the control to Mgr
+ return 0
+
+end
+
diff --git a/scripts/enter_exit_session.lua b/scripts/enter_exit_session.lua
new file mode 100755
index 0000000..d720070
--- /dev/null
+++ b/scripts/enter_exit_session.lua
@@ -0,0 +1,37 @@
+-- SLIMax Mgr Lua Script v2
+-- Copyright (c)2011-2013 by EK and Zappadoc - All Rights Reserved.
+-- Event received when the car enter and exit the session.
+
+-- param = device type (integer - see mDeviceType table)
+-- enter session
+function enterSessionEvent(devType)
+ -- call custom script
+ local result = custom_enterSessionEvent(devType)
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_enterSessionEvent(devType)
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- do nothing
+ return 1
+end
+
+-- param = device type (integer - see mDeviceType table)
+-- exit session
+function exitSessionEvent(devType)
+ -- call custom script
+ local result = custom_exitSessionEvent(devType)
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_exitSessionEvent(devType)
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- do nothing
+ return 1
+end
diff --git a/scripts/gear.lua b/scripts/gear.lua
new file mode 100755
index 0000000..d7cb61e
--- /dev/null
+++ b/scripts/gear.lua
@@ -0,0 +1,65 @@
+-- SLIMax Mgr Lua Script v2
+-- Copyright (c)2011-2013 by EK and Zappadoc - All Rights Reserved.
+-- gear event
+-- last change by Zappadoc - 2012-04-08
+
+-- SLI-M, SLI-PRO Gear Event
+function gearEvent(gear)
+ -- get the rpm limit already computed by my OSP method
+ -- using OSP Factor parameter
+ -- value used in OSP, Shiftlights, car setup,... and can be overwritten
+ gOSPLimit = 0
+ gOSPLimit = GetContextInfo("osplimitrpm")
+ if gOSPLimit == nil then gOSPLimit = 0 end
+
+ -- get the red zone already computed by my SLIMax Mgr II
+ -- value used in Shiftlights and can be overwritten
+ gRedZone = 0
+ gRedZone = GetCarInfo("redzone")
+ if gRedZone == nil then gRedZone = 18000 end
+
+ -- call custom script
+ local result = custom_gearEvent(gear)
+ if result <= 1 then return result end
+
+ -- call global custom script
+ result = global_custom_gearEvent(gear)
+ if result <= 1 then return result end
+
+ local g = gear
+ if oldGear == nil then oldGear = GetContextInfo("neutral") end
+
+ -- get 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")
+
+ -- optimize display, call if changed
+ if oldGear ~= g or g == 0 then
+ -- set neutral, reverse or current gear
+ if g == 0 then
+ -- if neutral and using custom OSP record then add a dot to gear digit
+ if ospcustom_on then n = n + 128 end
+ SetGearDigit(string.char(n))
+ elseif g < 0 then
+ SetGearDigit(r)
+ else
+ -- if gear = 'E' give the hand to SLIMax Manager II
+ if g == 69 then
+ return 0
+ end
+
+ SetGearDigit(string.char(g))
+ end
+
+
+
+ -- print( string.format("Gear: %d\n", gear))
+ end
+ -- backup gear state
+ oldGear = g
+
+ return 1
+end \ No newline at end of file
diff --git a/scripts/global.lua b/scripts/global.lua
new file mode 100755
index 0000000..2d6cf3e
--- /dev/null
+++ b/scripts/global.lua
@@ -0,0 +1,442 @@
+-- SLIMax Mgr Lua Script v2.4
+-- PART OF SLIMAX Manager pkg
+-- Copyright (c)2011-2013 by EK and Zappadoc - All Rights Reserved.
+-- changed by Zappadoc - 2012-11-08
+
+-- see slimax_script_readme.txt for implementation
+
+-- ============================================================
+-- GLOBAL VAR
+-- ============================================================
+-- scripts settings
+mCustomScriptsFileName = ""
+
+-- new in: 2.2
+-- init left and right digits panel text
+mLeftSpdLmtText = " "
+mRightSpdLmtText = " "
+
+-- 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 }
+
+-- true if you want to display switch pos and value
+mSwitchFeedbackAllowed = false
+
+-- mapping to keystroke demo script
+-- see the support forum for more info on key mapping
+mDemoMapToKeyAllowed = false
+mDemoMapToKeySwitch = 5
+
+-- Low Fuel status
+mLowFuelFeedbackAllowed = true
+
+-- Left and Right Digits status
+mLeftDigitsFeedbackAllowed = false
+mRightDigitsFeedbackAllowed = false
+
+-- display KPH or KMH
+mUnitFeedbackAllowed = true
+
+-- show the current OSP Factor
+mOSPFeedbackAllowed = true
+
+-- cool global brightness feedback
+mBrightnessFeedbackAllowed = true
+
+-- show the current value of maxgear option
+mMaxGearFeedbackAllowed = true
+
+-- activate or deactivate lap dump telemetry
+-- using button 9 by default
+mDumpLapAllowed = false
+mDumpLapButton = 9
+
+-- delta time delay
+mDeltaTimeBackup = 0
+mDeltaTimeOldTicks = 0
+mDeltaTimeDelay = 700
+
+-- ============================================================
+
+-- init globals flag
+isGlobalInitialized = 0
+
+-- 13 RPM leds
+mRPMLedTable = {
+ RPM0=0,
+ RPM1=0,
+ RPM2=0,
+ RPM3=0,
+ RPM4=0,
+ RPM5=0,
+ RPM6=0,
+ RPM7=0,
+ RPM8=0,
+ RPM9=0,
+ RPM10=0,
+ RPM11=0,
+ RPM12=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
+
+
+ -- 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
+
+
+-- 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
+end
+
+-- Init all globals
+function InitGlobals()
+ -- default blink time delay
+ mBlinkTime = 32
+ mOSPBlinkTime = 8
+
+ -- ticks stuff
+ mOSPBlink = 0
+ mSpdLmtBlink = 0
+ mOldTickCount = 0
+ mOldOSPTickCount = 0
+
+ gRedZone = 0
+ gOSPLimit = 0
+ mBU0710Leds = 0
+end
+
+-- set RPM threshold value in percentage ( SLIMax Manager 2.1 )
+function SetRPMPercentValue(index, value)
+ if index <1 or index>13 then
+ return
+ end
+ if value <0 or value >100 then
+ return
+ end
+
+ RPM_PERCENT_VALUES[index] = value
+end
+
+-- set RPM threshold value ( SLIMax Manager 2.1 )
+function SetRPMAbsoluteValue(index, value)
+ if index <1 or index>13 then
+ return
+ end
+ if value <0 or value >20000 then
+ return
+ end
+
+ RPM_ABSOLUTE_VALUES[index] = value
+end
+
+-- get all global preferences set in general_default.sli
+function GetSLIMaxInfo()
+ -- get RPM Only flag
+ mSpdLmtRPMLedOnly = GetContextInfo("spdlmtrpmledonlyflag")
+ if mSpdLmtRPMLedOnly == nil then mSpdLmtRPMLedOnly = false end
+
+ -- get blink delay value*
+ mBlinkTime = GetContextInfo("blinktime")
+ if mBlinkTime == nil then mBlinkTime = 32 end
+ if mBlinkTime < 1 or mBlinkTime > 48 then mBlinkTime = 32 end
+
+ -- get osp blink delay value
+ mOSPBlinkTime = GetContextInfo("ospblinktime")
+ if mOSPBlinkTime == nil then mOSPBlinkTime = 32 end
+ if mOSPBlinkTime < 1 or mOSPBlinkTime > 48 then mOSPBlinkTime = 32 end
+
+ -- get current speed Limiter LED index
+ mSpeedLimiterLED = GetContextInfo("ledspeedlimiterindex")
+ if mSpeedLimiterLED == nil then mSpeedLimiterLED = 5 end
+ if mSpeedLimiterLED < 1 or mSpeedLimiterLED > 6 then mSpeedLimiterLED = 5 end
+
+ -- get current osp LEDs index
+ mOSPLED1 = GetContextInfo("ospled1")
+ if mOSPLED1 == nil then mOSPLED1 = 1 end
+ if mOSPLED1 < 1 or mOSPLED1 > 11 then mOSPLED1 = 1 end
+
+ mOSPLED2 = GetContextInfo("ospled2")
+ if mOSPLED2 == nil then mOSPLED2 = 1 end
+ if mOSPLED2 < 1 or mOSPLED2 > 11 then mOSPLED2 = 1 end
+
+ -- blinking allowed?
+ mNoBlink = GetContextInfo("noblinkflag")
+ if mNoBlink == nil then mNoBlink = false end
+
+ -- get limiter char flag
+ mLimiterChar = GetContextInfo("limitercharflag")
+ if mLimiterChar == nil then mLimiterChar = false end
+
+ -- is OSP with first gear allowed?
+ mOSPWithFirstGear = GetContextInfo("ospwithfirstgear")
+ if mOSPWithFirstGear == nil then mOSPWithFirstGear = false end
+
+end
+
+-- get cpu ticks
+ function GetTicks()
+ local tcks = GetContextInfo("ticks")
+ if tcks == nil then tcks = 0 end
+ return tcks
+end
+
+-- reset table function
+function initLedTable(ibl, value)
+ if ibl ~= nil then
+ for k, v in pairs(ibl) do
+ ibl[k] = value
+ end
+ end
+end
+
+-- toggle all led state
+function toggleAllLed(val)
+ initLedTable(mRPMLedTable, val)
+ for i = 1, 6 do SetWarnLed(i, val) end
+ for i = 1, 5 do SetExtLed(i, val) end
+ SetRPMLed("mRPMLedTable")
+end
+
+-- The following function rounds a number
+-- lua doesn't return the same rounded value as C/C++
+function round(num)
+ if num == nil then num = 0 end
+ local i = 0
+ if num >= 0 then
+ i = math.floor(num+.5)
+ else
+ i = math.ceil(num-.5)
+ end
+ return i
+end
+
+-- The following function calculate hr, mn, sec, hd, ms
+-- param: time in meter/sec
+function timeDispatcher( tt)
+ if tms == nil then tms = 0 end
+ local tms = math.abs(tt)
+ local t_hr = 0
+ local t_mn = 0
+ local t_sc = 0
+ local t_ms = 0
+ local t_hd = 0
+
+ if tms > 0 then
+ t_hr, n = math.modf(tms/3600)
+ t_mn, c = math.modf(n*60)
+ t_sc, s = math.modf(c*60)
+ t_hd, h = math.modf(s*100)
+ t_ms, m = math.modf(s*1000)
+ end
+-- print( tt, t_hr, t_mn, t_sc, t_hd, t_ms)
+ return t_hr, t_mn, t_sc, t_hd, t_ms
+end
+
+-- return speed in KPH or MPH
+function speed(spd, selector)
+ if spd == nil then spd = 0 end
+ if selector then
+ -- MPH
+ return ( spd * 2.237)
+ else
+ return (spd * 3.6)
+ end
+end
+
+-- Fahrenheit to Celsius
+function FtoC(f)
+ return ((f - 32) * (5/9))
+end
+
+-- Celsius to Fahrenheit
+function CtoF(c)
+ return (c * (9/5) + 32)
+end
+
+-- Kelvin to Celsius
+function KtoC(k)
+ return ( k - 273.313)
+end
+
+-- liters to gallons
+function LtoG(liters)
+ return (liters * 0.264172052 )
+end
+
+-- gallons to liters
+function GtoL(gallons)
+ return (gallons * 3.78541178 )
+end
+
+-- return fuel in liters or gallons
+function GetFuel(fl, selector)
+ if fl == nil then fl = 0 end
+ if selector then
+ -- gallons
+ return LtoG( fl)
+ else
+ return fl
+ end
+end
+
+-- return celcius or fahrenheit
+function GetTemp(tmp, selector)
+ if tmp == nil then tmp = 0 end
+ if selector then
+ -- gallons
+ return CtoF( tmp)
+ else
+ return tmp
+ end
+end
+
+-- set delta time delay in ms
+function SetDeltaTimeDelay(delay)
+ if delay == nil or delay < 0 or delay > 5000 then delay = 700 end
+ mDeltatimeDelay = delay
+end
+
+-- get current gear (even when engine/ignition is off)
+function GetCurrentGear()
+ local g = GetCarInfo("gear")
+ -- get 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
+ -- 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
+ end
+
+ return result
+end
+
+
+--==============================================
+require "scripts/slidevice"
diff --git a/scripts/global_custom_scripts.lua b/scripts/global_custom_scripts.lua
new file mode 100755
index 0000000..55ae244
--- /dev/null
+++ b/scripts/global_custom_scripts.lua
@@ -0,0 +1,159 @@
+-- Global Custom SLIMax Manager Scripts v2.2
+-- Copyright ©2011-2013 by Zappadoc - All Rights Reserved.
+-- last change by Zappadoc - 2012-11
+
+-- add you global custom functions and globals variables here
+-- patch the std SLIMax Events with your global custom scripts if needed
+-- see the scripting section of the forum for more info...
+
+-- IMPORTANT:
+-- this script will not be deleted by uninstalling the software
+
+-- ================================
+-- CONSTANTS
+
+
+-- ================================
+-- additional lua extension module dll
+
+
+-- ================================
+-- additional scripts file
+
+-- ================================
+-- custom globals
+
+
+-- ================================
+-- custom functions
+
+-- ================================
+-- custom events
+
+function global_custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
+ -- type your custom controls script here (manage buttons, switches and encoders)
+ return 2
+end
+
+function global_custom_deviceReport(devType)
+ -- type your script here (just before sending report to the device )
+ return 2
+end
+
+function global_custom_ospMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+ return 2
+end
+
+function global_custom_shiftLightsMethodEvent(idx)
+ -- type your custom shiftlights method here
+ return 2
+end
+
+function global_custom_shiftLightsBU0710Event(idx)
+ -- type your custom shiftlights method for BU0710 device only here
+ return 2
+end
+
+function global_custom_leftDigitsEvent(swPosition)
+ -- type your custom script related to left SLI-PRO digits panel here
+ return 2
+end
+
+function global_custom_rightDigitsEvent(swPosition)
+ -- type your custom script related to right SLI-PRO digits panel here
+ return 2
+end
+
+function global_custom_spdLmtMethodEvent(idx)
+ if idx > 2 then
+ -- reinit RPM leds only if method > 2
+ initLedTable(mRPMLedTable, 0)
+ SetRPMLed("mRPMLedTable")
+ end
+
+ -- continue with standard behaviour
+ return 2
+end
+
+function global_custom_gearEvent(gear)
+ -- type your custom gear event script here
+ -- check if gear == 'E' (see ascii table )
+ if gear == 69 then
+
+ -- toggle OFF in this example
+ toggleAllLed(0)
+
+ -- control gear digit display
+ SetGearDigit(GetCurrentGear())
+
+ -- control left panel (6 chars max)
+ -- nothing display in this example
+ local ldigits = " "
+ SetLeftDigits( ldigits )
+ -- control right panel (6 chars max)
+ -- nothing display in this example
+ local rdigits = " "
+ SetRightDigits( rdigits )
+
+ -- refresh SLI board
+ SLISendReport(1)
+
+ -- return 1 to bypass std behavior
+ return 1
+ end
+
+ return 2
+end
+
+function global_custom_enterSessionEvent(devType)
+ initLedTable(mRPMLedTable,0)
+ SetRPMLed("mRPMLedTable")
+
+ for j = 1, 0 do
+ for i = 0, 12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = j
+ SetRPMLed("mRPMLedTable")
+ print( string.format("rpm%d : %d", i, j))
+ win.Sleep(200)
+ end
+ end
+
+ return 2
+end
+
+function global_custom_exitSessionEvent(devType)
+ -- type your custom script on session ending, here
+ local ldigits = " exit "
+ SetLeftDigits( ldigits )
+ local rdigits = " exit "
+ SetRightDigits( rdigits )
+
+ -- refresh SLI board
+ SLISendReport(1)
+
+ return 1
+end
+
+function global_custom_ledEvent(idx, ledFunction, state)
+ return 2
+end
+
+
+-- ================================
+-- local custom events PLACEHOLDERS
+-- DO NOT CHANGE THE SCRIPT BELOW
+-- ================================
+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_shiftLightsMethodEvent(idx) return 2 end
+function custom_shiftLightsBU0710Event(idx) return 2 end
+function custom_leftDigitsEvent(swPosition) return 2 end
+function custom_rightDigitsEvent(swPosition) return 2 end
+function custom_spdLmtMethodEvent(idx) return 2 end
+function custom_gearEvent(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
diff --git a/scripts/led.lua b/scripts/led.lua
new file mode 100755
index 0000000..0e5cd1b
--- /dev/null
+++ b/scripts/led.lua
@@ -0,0 +1,45 @@
+-- Part of SLIMax Mgr II - Lua Script v2.2
+-- 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
+-- params:
+-- idx = led index (assigned in settings)
+-- state = the std state of the led; activated if > 0
+-- ledFunction: the corresponding function
+-- 1=LowFuel
+-- 2=TC
+-- 3=ABS
+-- 4=Green Flag
+-- 5=Yellow flag
+-- 6=Red Flag
+-- 7=Over Heating
+-- 8=Damage
+-- 9=Pit request
+-- 10=Power
+-- 11=Rev Limit
+-- 12=HeadLights
+-- 13=Blue Flag
+-- 14=DRS
+-- 15=Safe Prefs
+
+function ledEvent(idx, ledFunction, state)
+ -- call custom script
+ local result = custom_ledEvent(idx, ledFunction, state)
+ -- 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_ledEvent(idx, ledFunction, state)
+ -- 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
+
+ -- return 0 to use std behaviors
+ return 0
+end
+ \ No newline at end of file
diff --git a/scripts/osp.lua b/scripts/osp.lua
new file mode 100755
index 0000000..03cea73
--- /dev/null
+++ b/scripts/osp.lua
@@ -0,0 +1,159 @@
+-- SLIMax Mgr Lua Script v2.1
+-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
+-- Use this script to build all Optimal ShiftPoints methods (OSP)
+-- last change by Zappadoc - 2012-12-17
+
+function SetOSPFeedback(state)
+ if mOSPLED1 > 6 then
+ SetExtLed( (mOSPLED1 - 6), state)
+ else
+ SetWarnLed(mOSPLED1, state)
+ end
+ if mOSPLED2 > 6 then
+ SetExtLed( (mOSPLED2 - 6), state)
+ else
+ SetWarnLed(mOSPLED2, state)
+ end
+end
+
+-- SLI-M, SLI-PRO OSP Methods Event
+function ospMethodEvent(idx)
+ mOSPMethod = 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_ospMethodEvent(mOSPMethod)
+ -- 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_ospMethodEvent(mOSPMethod)
+ -- 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 mOSPMethod <= 3 then
+ -- methods 1 to 3
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ if mOSPMethod ~= 3 then
+ -- if not method 3
+ SetOSPFeedback(1)
+ end
+ if (mOSPMethod == 1) or (mOSPMethod == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 9,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ SetOSPFeedback(0)
+
+ if (mOSPMethod == 1) or (mOSPMethod == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 9,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ end
+
+ if mOSPMethod == 2 then
+ -- add blue leds not blinking if method 2
+ for i = 9,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ else
+ -- bypass (give control to manager)
+ return 0
+ 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
new file mode 100755
index 0000000..95e93f3
--- /dev/null
+++ b/scripts/shiftlights.lua
@@ -0,0 +1,333 @@
+-- SLIMax Mgr Lua Script v2.3
+-- Copyright (c)2011-2013 by EK and Zappadoc - All Rights Reserved.
+-- Use this script to build all shiftlights methods
+-- last change by Zappadoc - 2012-10-28
+
+-- ==============================================================================
+-- utilities functions and methods
+-- ==============================================================================
+-- SLI-M and SLI-PRO functions
+
+-- shiftlights method from side to center
+function SideToCenterSLI(rpm, redzone, p1, p2, p3, p4 ,p5 ,p6 ,p7)
+
+ local rz = redzone / 100
+
+ -- side to center custom
+ if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end -- G
+ if rpm > (rz*p1) then mRPMLedTable.RPM12 = 1 end -- B
+
+ if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end -- G
+ if rpm > (rz*p2) then mRPMLedTable.RPM11 = 1 end -- B
+
+ if rpm > (rz*p3) then mRPMLedTable.RPM2 = 1 end -- G
+ if rpm > (rz*p3) then mRPMLedTable.RPM10 = 1 end -- B
+
+ if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end -- G
+ if rpm > (rz*p4) then mRPMLedTable.RPM9 = 1 end -- B
+
+ if rpm > (rz*p5) then mRPMLedTable.RPM8 = 1 end -- R
+ if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end -- R
+
+ if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end -- R
+ if rpm > (rz*p6) then mRPMLedTable.RPM7 = 1 end -- R
+
+ if rpm > (rz*p7) then mRPMLedTable.RPM6 = 1 end -- R
+
+end
+
+-- progressive method
+function ProgressiveSLI(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
+ local rz = redzone / 13
+ -- 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
+end
+
+-- alternate green, red and blue method
+function AlternateSLI(rpm, redzone, step1, step2, step3)
+
+ local rz = redzone / 13
+ if rpm > (rz*step1) then
+ mRPMLedTable.RPM0 = 1 -- G
+ mRPMLedTable.RPM1 = 1 -- G
+ mRPMLedTable.RPM2 = 1 -- G
+ mRPMLedTable.RPM3 = 1 -- G
+ end
+ if rpm > (rz*step2) then
+ mRPMLedTable.RPM4 = 1 -- R
+ mRPMLedTable.RPM5 = 1 -- R
+ mRPMLedTable.RPM6 = 1 -- R
+ mRPMLedTable.RPM7 = 1 -- R
+ mRPMLedTable.RPM8 = 1 -- R
+ end
+ if rpm > (rz*step3) then
+ mRPMLedTable.RPM9 = 1 -- B
+ mRPMLedTable.RPM10 = 1 -- B
+ mRPMLedTable.RPM11 = 1 -- B
+ mRPMLedTable.RPM12 = 1 -- B
+ end
+end
+
+function PercentageSLI(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
+ 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 -- 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 -- 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 -- B
+ 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
+ -- print("RPM:".. rpm .. " Percentage:" .. onePercent .. " RZ:" .. gRedZone .. " P13:" .. mRPMLedTable.RPM12.. "\n")
+end
+
+-- fixed rpm method, set rpm for each led (NOT RECOMMENDED)
+function RpmSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
+ 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 -- Y
+ if p4>0 and rpm >= p4 then mRPMLedTable.RPM3 = 1 end -- Y
+ if p5>0 and rpm >= p5 then mRPMLedTable.RPM4 = 1 end -- R
+ if p6>0 and rpm >= p6 then mRPMLedTable.RPM5 = 1 end -- R
+ if p7>0 and rpm >= p7 then mRPMLedTable.RPM6 = 1 end -- G
+ if p8>0 and rpm >= p8 then mRPMLedTable.RPM7 = 1 end -- G
+ if p9>0 and rpm >= p9 then mRPMLedTable.RPM8 = 1 end -- Y
+ if p10>0 and rpm >= p10 then mRPMLedTable.RPM9 = 1 end -- Y
+ if p11>0 and rpm >= p11 then mRPMLedTable.RPM10 = 1 end -- R
+ if p12>0 and rpm >= p12 then mRPMLedTable.RPM11 = 1 end -- R
+ if p13>0 and rpm >= p13 then mRPMLedTable.RPM12 = 1 end -- R
+end
+
+-- progressive method but with rpm value for eah led
+function ProgressiveFixedSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)
+ -- 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
+end
+-- --------------------------------------------
+-- BU0710 functions
+
+-- progressive method for BU0710
+function ProgressiveBU0710(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
+ local rz = redzone / 10.0
+ if rpm > (rz * p1) then mBU0710Leds = 0x1 end -- G
+ if rpm > (rz * p2) then mBU0710Leds = 0x2 end -- G
+ if rpm > (rz * p3) then mBU0710Leds = 0x3 end -- G
+ if rpm > (rz * p4) then mBU0710Leds = 0x4 end -- Y
+ if rpm > (rz * p5) then mBU0710Leds = 0x5 end -- Y
+ if rpm > (rz * p6) then mBU0710Leds = 0x6 end -- Y
+ if rpm > (rz * p7) then mBU0710Leds = 0x7 end -- R
+ if rpm > (rz * p8) then mBU0710Leds = 0x8 end -- R
+ if rpm > (rz * p9) then mBU0710Leds = 0x9 end -- R
+ if rpm > (rz * p10) then mBU0710Leds = 0xA end -- R
+ if rpm > (rz * p11) then mBU0710Leds = 0xB end -- RRRR
+end
+
+-- percentage method for BU0710
+function PercentageBU0710(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
+ local onePercent = redzone / 100
+ if rpm > (p1 * onePercent) then mBU0710Leds = 0x1 end -- G
+ if rpm > (p2 * onePercent) then mBU0710Leds = 0x2 end -- G
+ if rpm > (p3 * onePercent) then mBU0710Leds = 0x3 end -- G
+ if rpm > (p4 * onePercent) then mBU0710Leds = 0x4 end -- Y
+ if rpm > (p5 * onePercent) then mBU0710Leds = 0x5 end -- Y
+ if rpm > (p6 * onePercent) then mBU0710Leds = 0x6 end -- Y
+ if rpm > (p7 * onePercent) then mBU0710Leds = 0x7 end -- R
+ if rpm > (p8 * onePercent) then mBU0710Leds = 0x8 end -- R
+ if rpm > (p9 * onePercent) then mBU0710Leds = 0x9 end -- R
+ if rpm > (p10 * onePercent) then mBU0710Leds = 0xA end -- R
+ if rpm > (p11 * onePercent) then mBU0710Leds = 0xB end -- RRRR
+end
+
+-- fixed rpm method for BU0710 (NOT RECOMMENDED)
+function RpmBU0710(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
+ if rpm > p1 then mBU0710Leds = 0x1 end -- G
+ if rpm > p2 then mBU0710Leds = 0x2 end -- G
+ if rpm > p3 then mBU0710Leds = 0x3 end -- G
+ if rpm > p4 then mBU0710Leds = 0x4 end -- Y
+ if rpm > p5 then mBU0710Leds = 0x5 end -- Y
+ if rpm > p6 then mBU0710Leds = 0x6 end -- Y
+ if rpm > p7 then mBU0710Leds = 0x7 end -- R
+ if rpm > p8 then mBU0710Leds = 0x8 end -- R
+ if rpm > p9 then mBU0710Leds = 0x9 end -- R
+ if rpm > p10 then mBU0710Leds = 0xA end -- R
+ if rpm > p11 then mBU0710Leds = 0xB end -- RRRR
+end
+
+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
+-- ==============================================================================
+
+ -- SLI-M, SLI-PRO ShiftLights Methods Event
+function shiftLightsMethodEvent(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)
+ -- 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)
+ -- 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 idx == 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
+ -- alternate method 1
+ AlternateSLI(rpm, gRedZone, 11.0, 12.0, 12.9)
+
+ elseif idx == 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
+ -- 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
+ -- side to center method 4
+ SideToCenterSLI(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5 )
+
+ elseif idx == 5 then
+ -- KERS + RPM
+
+ -- get kers value
+ local k_percent = GetKersPercent()
+
+ -- without first 4 green leds
+ AlternateSLI(rpm, gRedZone, 100, 11.6, 12.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 >= 25 then mRPMLedTable.RPM1 = 1 end
+ if k_percent >= 50 then mRPMLedTable.RPM2 = 1 end
+ if k_percent >= 75 then mRPMLedTable.RPM3 = 1 end
+
+ elseif idx == 6 then
+ -- Revers KERS + RPM
+
+ -- get kers value
+ local k_percent = GetKersPercent()
+
+ -- without first 4 green leds
+ AlternateSLI(rpm, gRedZone, 0, 11.6, 12.9)
+
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+
+ if k_percent > 0 then mRPMLedTable.RPM3 = 0 end
+ if k_percent >= 25 then mRPMLedTable.RPM2 = 0 end
+ if k_percent >= 50 then mRPMLedTable.RPM1 = 0 end
+ if k_percent >= 75 then mRPMLedTable.RPM0 = 0 end
+
+ else
+ return 0
+ end
+
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
+end
+
+-- BU0710 ShiftLights Methods Event
+function shiftLightsBU0710Event(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)
+ -- 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)
+ -- 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 rpm = GetCarInfo("rpm")
+ if rpm == nil then rpm = 0 end
+
+ -- init leds (see global.lua)
+ mBU0710Leds = 0
+
+ if (idx <= 1) or (idx >= 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
+ -- percentage method 2
+ PercentageBU0710(rpm, gRedZone, 84, 88, 90, 92, 93, 94, 95, 96, 97, 98, 99 )
+
+ elseif (idx == 3) then
+ -- abs method 3 (not recommended)
+ RpmBU0710(rpm, 15823, 16354, 16410, 16675, 17252, 17545, 17823, 18354, 18510, 18655, 18675 )
+
+ else
+ return 0
+ end
+ SetBU0710Led(mBU0710Leds)
+ return 1
+end \ No newline at end of file
diff --git a/scripts/slidevice.lua b/scripts/slidevice.lua
new file mode 100755
index 0000000..08da886
--- /dev/null
+++ b/scripts/slidevice.lua
@@ -0,0 +1,23 @@
+-- Load SLIMax Mgr Lua Scripts v2.1
+-- Copyright (c)2011-2013 by Zappadoc - All Rights Reserved.
+-- changed by Zappadoc - 2012-11-10
+-- main device script
+
+require "scripts/led"
+require "scripts/enter_exit_session"
+require "scripts/gear"
+require "scripts/slipro"
+require "scripts/shiftlights"
+require "scripts/speedlimiter"
+require "scripts/osp"
+require "scripts/controls"
+require "scripts/devhook"
+require "scripts/global_custom_scripts"
+
+-- load the custom scripts if exists
+scr = GetCustomScripts("scriptname")
+-- print ( scr )
+if scr ~= nil and scr ~= "" then
+ mCustomScriptsFileName = scr
+ require(mCustomScriptsFileName)
+end
diff --git a/scripts/sliemu_iracing_basic.lua b/scripts/sliemu_iracing_basic.lua
new file mode 100755
index 0000000..336a7f2
--- /dev/null
+++ b/scripts/sliemu_iracing_basic.lua
@@ -0,0 +1,11 @@
+-- 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_basic.lua b/scripts/slim_iracing_basic.lua
new file mode 100755
index 0000000..336a7f2
--- /dev/null
+++ b/scripts/slim_iracing_basic.lua
@@ -0,0 +1,11 @@
+-- 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
new file mode 100755
index 0000000..8e5fc44
--- /dev/null
+++ b/scripts/slimax_script_readme.txt
@@ -0,0 +1,541 @@
+SLIMax Manager II 2.2.4.5 Scripting Information - PART OF SLIMax Manager pkg
+Copyright (c)2011-2013 by EK & Zappadoc - All Rights Reserved.
+updated 2013-01-16 by Zappadoc
+
+** ALL INFORMATION BELOW ARE SUBJECT TO CHANGE WITHOUT NOTICE **
+
+=================================
+Script Engine based on Lua 5.1.4
+
+License for Lua 5.1.4 and later versions
+Copyright © 1994–2011 Lua.org, PUC-Rio.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+=================================
+Lua website
+http://www.lua.org/
+
+Reference manual (v5.1):
+http://www.lua.org/manual/5.1/
+
+
+=================================
+Events received from SLIMax Manager
+=================================
+
+function custom_initEvent(scriptFile)
+param = custom script file name
+Notes: this event is triggered at startup or when loading your custom script,
+this is the good opportunity to init your preferences and global vars
+
+All event functions below must return 1 if the event has been fully managed or
+0 (zero) to skip and give control to SLIMax Mgr
+
+---------------------------------------------
+function shiftLightsMethodEvent(idx) and custom_shiftLightsMethodEvent
+function shiftLightsBU0710Event(idx) and custom_shiftLightsBU0710Event
+param = current method index
+Notes: shiftlights method event, computes all shiftlights methods
+(see shiftlights.lua script)
+
+---------------------------------------------
+function ospMethodEvent(idx) and custom_ospMethodEvent
+param = current method index
+Notes: OSP method event, computes all Optimal Shift-Points methods
+(see osp.lua script)
+
+---------------------------------------------
+function spdLmtMethodEvent(idx) and custom_spdLmtMethodEvent
+param = current method index
+Notes: speedlimiter method event, computes all speedlimiter methods
+(see speedlimiter.lua script)
+
+---------------------------------------------
+function leftDigitsEvent(swPosition) and custom_leftDigitsEvent
+function rightDigitsEvent(swPosition) and custom_rightDigitsEvent
+param = switch position
+Notes: SLI-PRO Left and Right Panel functions events, computes data to be
+displayed on left and rights digits of SLI-PRO device
+(see slipro.lua script)
+
+---------------------------------------------
+function controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex) and custom_controlsEvent
+params = see the script
+Notes: Controls Event, Manage buttons and switches. (see controls.lua script)
+
+---------------------------------------------
+function deviceReport(devType) and custom_deviceReport
+param = the current targeted SLI device
+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 gearEvent(gear) and custom_gearEvent
+param = current seleted gear ( -1 = reverse, 0 = neutral, 1 ... 7)
+Notes: gear event, show the current selected gear on central digit
+(see gear.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)
+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
+2=TC
+3=ABS
+4=Green Flag
+5=Yellow flag
+6=Red Flag
+7=Over Heating
+8=Damage
+9=Pit request
+10=Power
+11=Rev Limit
+12=HeadLights
+13=Blue Flag
+14=DRS
+15=Safe Prefs
+Notes: patch std led behaviors (i.e. tc, abs, lowfuel,
+ dammage, rev limit, drs, pit request, flags, ... )
+IMPORTANT: your script must be optimized as the function is
+called several time by second to report all activated leds
+(see led.lua script)
+
+-----------------------------------------------
+All functions starting with custom_ can created
+to change std behaviors and can be associated
+with your custom settings.
+(see COMBO SETUP in forum)
+-----------------------------------------------
+
+
+============================================
+functions to change SLIMax Manager information
+============================================
+
+---------------------------------------------
+SetBU0710Led(int)
+param integer = number from 0 to 10
+set leds of BU0710 device (e.g. see shiftlights.lua script)
+
+---------------------------------------------
+SetGeadDigit(string)
+param string = one char string (i.e. "r" or "n" or "1")
+set gear digit of current targeted SLI device (e.g. 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 (e.g. 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)
+
+---------------------------------------------
+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)
+
+---------------------------------------------
+SetOSPStatus(boolean)
+param boolean = true or false
+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 ==========
+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)
+
+---------------------------------------------
+SetDigitsAllowed(boolean)
+param boolean = true or false
+by default the 6 + 6 SLI-PRO 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)
+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
+
+SPECIAL KEYCODE TABLE:
+ BACKSPACE
+ DEL
+ INSERT
+ PRTSCREEN
+ END
+ HOME
+ SCROLL
+ PGDOWN
+ PGUP
+ PAUSE
+ UP
+ DOWN
+ LEFT
+ RIGHT
+ F1
+ F10
+ F11
+ F12
+ F13
+ F14
+ F15
+ F16
+ F2
+ F3
+ F4
+ F5
+ F6
+ F7
+ F8
+ F9
+ NUMLOCK
+ NUMPAD0
+ NUMPAD1
+ NUMPAD2
+ NUMPAD3
+ NUMPAD4
+ NUMPAD5
+ NUMPAD6
+ NUMPAD7
+ NUMPAD8
+ NUMPAD9
+ ENTER
+ ESC
+ TAB
+ ARROWUP
+ ARROWDOWN
+ ARROWLEFT
+ ARROWRIGHT
+
+Modifier:
+
+SHIFT
+CONTROL
+ALT
+
+-----------------------------------------------------------------------------------
+TelemetryTools(selector, value)
+Param "value" boolean activate or deactivate the function
+Param "selector" (string), this string contains the following value:
+"dumplastlap" if it's activated it creates a telemetry log after each lap
+
+-----------------------------------------------------------------------------------
+SLISleep(ms)
+
+-----------------------------------------------------------------------------------
+SLISendReport()
+
+-----------------------------------------------------------------------------------
+SetGlobalBrightness(int)
+
+-----------------------------------------------------------------------------------
+SetABSBrightLevel(int)
+
+-----------------------------------------------------------------------------------
+SetTCBrightLevel(int)
+
+---------------------------------------------
+SetMaxGear(int)
+param integer = from 4 to 7
+Set the number of gears available
+
+---------------------------------------------
+SetDeltaTimeDelay(int)
+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 )
+
+=========================================
+functions to get SLI Manager Information
+=========================================
+
+GetContextInfo("selector")
+GetCarInfo("selector")
+GetTimeInfo("selector")
+GetPartialTimeInfo("selector", index)
+IsSLIFunction("selector", function_index)
+
+-----------------------------------------------------------------------------------
+GetContextInfo("selector")
+returns contextual info (internal function)
+Param "selector" (string), this string contains the following value:
+
+IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
+
+"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')
+"sessiontype" see here: http://www.eksimracing.com/forum/index.php?topic=891.msg4560#msg4560
+"ticks" return system tick count (int)
+"speedmetric" return display unit true if imperial/MPH and false if metric/KMH
+"simulation" return current simulation name (string) if available
+"paused" return true if simulation is paused if available
+"pluginactive" return 1 if a plugin has been activated
+"pluginready" return true if plugin is ready to send data from simulation
+"devicetype" return current targeted SLI USB device (integer - see mDeviceType global)
+"tracksize" return current track size (meter) if available
+"lapdistance" return the traveled distance of the car (meter) if available
+"trackame" return current track name if available
+"carname" return current car name if available
+"position" return current car position if available
+"laps" return laps completed (current lap) if available
+"lapscount" return total lap (race) if available
+"partialcount" or "sectorcount" number total of partial time
+"blinktime" blinking delay (default 32)
+"ospblinktime" blinking delay (default 8 )
+"spdlmtrpmledonlyflag" rpm leds only when speedlimiter active? (boolean)
+"noblinkflag" blinking allowed or not? (boolean)
+"limitercharflag" limiter char must be showed? (boolean)
+"ledspeedlimiterindex" return the current speedlimiter index (position) led (default 4 of value from 1 to 6)
+"displaylaptime" lap time need to be showed or not (boolean)
+"quickinfobutton" quick-info button is pressed or not (boolean)
+"quickinfoleft" quick-info left panel index (position) function (integer)
+"quickinforight" quick-info right panel index (position) function (integer)
+"osptracking" osp tracking button activated or not (boolean)
+"ospfactor" current osp factor (float)
+"ospwithfirstgear" osp at first gear allowed (boolean)
+"osplimitrpm" OSP rpm limit, result from my own OSP curve (integer)
+"ospled1" OSP led 1 index (position) (integer)
+"ospled2" OSP led 2 index (position) (integer)
+"yellowflag" return status of flags
+"greenflag"
+"redflag"
+"blueflag"
+"lastgearnorpm" return true if no shiftlights (RPM) on last gear
+"rightdigits" return current position of right panel (int)
+"leftdigits" return current position of left panel (int)
+"globalbrightness" return current global brightness value
+"lowfuel" return low fuel status
+"dumplastlap" return status of telemetry report (true = activated)
+
+-----------------------------------------------------------------------------------
+GetCarInfo("selector")
+returns car info (internal function)
+Param "selector" (string), this string contains the following value:
+
+IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
+"kers" return kers value
+"kers max" return max kers energy
+"drs" return ON or OFF status
+"brakebiais" return current brake biais status
+"rawspeed" return current car speed (meter/sec)
+"speed" return current car speed in kph or mph depending the current display unit (metric or imperial)
+"gear" return current car gear (-1 reverse; 0 = neutral; 1 = gear1,...)
+"maxgear" return the current gear max of engine
+"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
+"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)
+"abs" return abs level (integer)
+"tractioncontrol" return TC level (integer)
+"speedlimiter" return spd lmt status (integer)
+"headlights"
+"overheating"
+"detachedparts" return true if car is damaged
+
+"wheeltempfrontleft", return front left average temp (celsius)
+"wheeltempfrontright", return front right average temp (celsius)
+"wheeltemprearleft", return rear left average temp (celsius)
+"wheeltemprearright", return rear right average temp (celsius)
+
+"wheelpressfrontleft", return front left average pressure (kpa)
+"wheelpressfrontright", return front right average pressure (kpa)
+"wheelpressrearleft", return rear left average pressure (kpa)
+"wheelpressrearright", return rear right pressure (kpa)
+
+"braketempfrontleft", return front left temp (celsius)
+"braketempfrontright", return front right temp (celsius)
+"braketemprearleft", return rear left temp (celsius)
+"braketemprearright", return rear right temp (celsius)
+
+-----------------------------------------------------------------------------------
+GetTimeInfo("selector")
+returns time info (internal function)
+Param "selector" (string), this string contains the following value:
+return float value
+
+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
+"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
+"sector2" return current sector 2 if available
+"bestsector1" return best sector 1 if available
+"bestsector2" return best sector 2 if available
+"lastsector1" return last sector 1 if available
+"lastsector2" return last sector 2 if available
+"timeremaining" return session time remaining if available
+"systemtime" return current PC time if available
+
+-----------------------------------------------------------------------------------
+GetPartialTimeInfo("selector", index)
+returns partial time info
+(internal function)
+Param index (number) contains the targeted sector
+Param "selector" (string), contains the following value:
+return float value
+see GetContextInfo() to get the total number of partials
+
+IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
+
+"currentpartial" return current partial time if available
+"bestpartial" return best partial time of this sector if available
+"optimalpartial" return optimal partial time of this sector if available
+"sessionbest" return session best partial time of this sector
+"sessionoptimal" return session optimal partial time of this sector
+"diffbestpartial" return diff from best if available
+"diffoptimalpartial" return diff from optimal if available
+"diffsessionbest" return diff from session best if available
+"diffsessionoptimal" return diff from session optimal if available
+
+-----------------------------------------------------------------------------------
+IsSLIFunction("selector", function_index)
+returns boolean
+(internal function)
+return boolean value, true if function name matches the function index
+Param index (number) contains the targeted function index returned by controlsEvent()
+Param "selector" (string), contains the following value:
+see controls.lua scripts for more info.
+
+"brightness"
+"quickinfo"
+"speedmetric"
+"lastgearnorpm"
+"osptracking"
+"safeprefs"
+"laptimedelay"
+"blinktime"
+"lowfuel"
+"speedlimitermethod"
+"shiftlightsmethod"
+"ospmethod"
+"rightdigits"
+"leftdigits"
+"ospfactor"
+"drivingsetup"
+"maxgear"
+
+===============================
+ Script Developpment
+ globals and utilities
+===============================
+
+Script Warriors do not reinvent the wheel and keep your script clean, optimized and obviously reuse the standard behaviors if possible ... ;)
+
+-------------
+ GLOBALS
+-------------
+- A great optimization of OSP and Shiftlights scripts with 2 new globals has been added.
+gOSPLimit = limit/treshold computed by SLIMax Manager, the default value is set in gear.lua script. This value can be overwritten in your custom script, this way it lets you run the std OSP function (osp.lua) but with your own OSP curve. each gear of each car can have its own values.
+
+gRedZone = the default value is set in gear.lua script. This value can be overwritten in your custom script, this way it let's you run the std Shiftlights function but with your own red zone value. each gear of each car can have its own values.
+
+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
+
+mSpdLimitMethod to overwrite the method value, useful in custom_spdLmtMethodEvent() function to patch the current PIT LIMITER method with another one
+
+-----------------------
+ SHIFTLIGHTS UTILITIES
+-----------------------
+[NEW] shiftlights utilities functions in SLIMax Mananger II script API
+(see shiftlights.lua for example and usage)
+
+--------------------------------------------------------
+shiftlights utilities functions for SLI-M and SLI-PRO
+--------------------------------------------------------
+-- shiftlights method from side to center
+function SideToCenterSLI(rpm, redzone, p1, p2, p3, p4 ,p5 ,p6 ,p7)
+
+-- progressive method
+function ProgressiveSLI(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
+
+-- alternate green, red and blue method
+function AlternateSLI(rpm, redzone, step1, step2, step3)
+
+-- percentage method
+function percentageSLI(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
+
+-- fixed rpm method, set rpm for each led (NOT RECOMMENDED)
+function RpmSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
+
+-- progressive method but with rpm value for eah led
+function ProgressiveFixedSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)
+
+--------------------------------------------------------
+shiftlights utilities functions for BU0710
+--------------------------------------------------------
+-- progressive method for BU0710
+function ProgressiveBU0710(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
+
+-- percentage method for BU0710
+function percentageBU0710(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
+
+-- fixed rpm method for BU0710 (NOT RECOMMENDED)
+function RpmSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
+
+--------------------------------------------------------
+LEFT and RIGHT Functions utilities
+--------------------------------------------------------
+
+-- add a function name to left and right functions list
+-- typical usage FuncAddName(path, func):
+-- on left list:
+-- local err = FuncAddName("cfg/sli_left_functions.ecfg", "100.DSII KERS")
+-- or right list:
+-- local err = FuncAddName("cfg/sli_right_functions.ecfg", "100.DSII KERS")
+-- return 1 if ok
+
+
+-- same as above for removing the function name
+-- typical usage RemoveFuncName(path, func)
+-- return 1 if ok
+
+-- get the index of function
+-- typical usage: local idx = FuncGetPrefixIndex("100.DSII KERS")
+-- return value > 0 if ok
+
+-- get next function index available
+-- typical usage FuncGetNewIndex(path):
+-- on left list:
+-- local num_available = FuncGetNewIndex("cfg/sli_left_functions.ecfg")
+-- or right list:
+-- local num_available = FuncGetNewIndex("cfg/sli_right_functions.ecfg")
+-- return value >=100 (0 to 99 are reserved ) \ No newline at end of file
diff --git a/scripts/slipro.lua b/scripts/slipro.lua
new file mode 100755
index 0000000..14b9107
--- /dev/null
+++ b/scripts/slipro.lua
@@ -0,0 +1,669 @@
+-- SLIPRO Lua Script v2.5
+-- Copyright (c)2011-2013 by EK and Zappadoc - All Rights Reserved.
+-- Use this script to build all functions associated with
+-- left and right panels of SLIPRO device
+-- changed by Zappadoc - 2012-10-29
+
+-- ============================================================
+-- Left and Right Panel functions
+-- ============================================================
+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
+
+-- IN function of left panel
+-- param: recieve from SLI Manager the current switch position
+function leftDigitsEvent(swFunction)
+ swValue = swFunction + 1
+ -- call custom script
+ local result = custom_leftDigitsEvent(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_leftDigitsEvent(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
+
+ local lPanel = ""
+ local inf = ""
+ local unit = false
+ local spd = 0.0
+ -- get speed in kph or mph (use "rawspeed" to get value in meter/sec)
+ local spd = GetCarInfo("speed")
+ -- get current display unit metric or imperial
+ unit = GetContextInfo("speedmetric")
+ -- check if quick info button is down
+ local qi = false
+ qi = GetContextInfo("quickinfobutton")
+ if qi == nil or qi == 0 then qi = false end
+ if qi then
+ -- get index for left panel
+ local qiLeft = GetContextInfo("quickinfoleft")
+ if qiLeft == nil then qiLeft = 1 end
+ -- force position to match QI preference
+ swValue = qiLeft
+ end
+ -- 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
+ lPanel = string.format(" %3.0f ", spd )
+
+ elseif swValue == 2 then
+ -- fuel:speed
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ lPanel = string.format("%03d:%3d", round(fuel), spd)
+ elseif fuel >= 10 then
+ lPanel = string.format("F%02d:%3d", round(fuel), spd)
+ else
+ lPanel = string.format("F%1.1f:%3d", fuel, spd)
+ end
+ end
+ elseif swValue == 3 then
+ -- position:speed
+ inf = GetContextInfo("position")
+ if inf ~= nil then
+ if inf >= 100 then
+ lPanel = string.format("%03d:%3.0f", inf, spd)
+ else
+ lPanel = string.format("P%02d:%3.0f", inf, spd)
+ end
+ end
+ elseif swValue == 4 then
+ -- laps completed:speed
+ inf = GetContextInfo("laps")
+ if inf ~= nil then
+ -- if more then 99 laps
+ if inf >= 100 then
+ lPanel = string.format("%03d:%3.0f", inf, spd)
+ else
+ lPanel = string.format("L%02d:%3.0f", inf, spd)
+ end
+ end
+ elseif swValue == 5 then
+ -- sector:speed
+ inf = GetCarInfo("sector")
+ if inf ~= nil then
+ -- check if sector > 9
+ if inf >9 then
+ lPanel = string.format("S%02d:%3.0f", inf, spd)
+ else
+ lPanel = string.format("S%01d :%3.0f", inf, spd)
+ end
+ end
+ elseif swValue == 6 then
+ -- laps completed:total laps if available
+ inf = GetContextInfo("laps")
+ if inf ~= nil then
+ local tl = GetContextInfo("lapscount")
+ if tl < 1 then tl = 0 end
+ -- if more then 99 laps
+ if inf >= 100 or tl >= 100 then
+ lPanel = string.format("%03d:%03d", inf, tl)
+ else
+ lPanel = string.format("L%02d:t%02d", inf, tl)
+ end
+ end
+ elseif swValue == 7 then
+ -- water temp
+ inf = GetCarInfo("watertemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ lPanel = string.format("H2o:%2.1f", inf)
+ end
+ elseif swValue == 8 then
+ -- oil temp
+ inf = GetCarInfo("oiltemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ lPanel = string.format("OIL:%2.1f", inf)
+ end
+
+ elseif swValue == 9 then
+ -- wheels temp if available
+ inf = GetCarInfo("wheeltempfrontleft")
+ if inf ~= nil then
+ -- if rFactor convert Kelvin to Celsius (see global.lua)
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ lPanel = string.format("tFL:%3.0f", inf)
+ end
+ elseif swValue == 10 then
+ inf = GetCarInfo("wheeltempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ lPanel = string.format("tFr:%3.0f", inf)
+ end
+ elseif swValue == 11 then
+ inf = GetCarInfo("wheeltemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ lPanel = string.format("trL:%3.0f", inf)
+ end
+ elseif swValue == 12 then
+ inf = GetCarInfo("wheeltemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ lPanel = string.format("trr:%3.0f", inf)
+ end
+
+ elseif swValue == 13 then
+ -- wheels pressure if available
+ inf = GetCarInfo("wheelpressfrontleft")
+ if inf ~= nil then
+ -- convert to psi
+ lPanel = string.format("PFL:%2.1f", inf / 6.88)
+ end
+ elseif swValue == 14 then
+ inf = GetCarInfo("wheelpressfrontright")
+ if inf ~= nil then
+ lPanel = string.format("PFr:%2.1f", inf / 6.88)
+ end
+ elseif swValue == 15 then
+ inf = GetCarInfo("wheelpressrearleft")
+ if inf ~= nil then
+ lPanel = string.format("PrL:%2.1f", inf / 6.88)
+ end
+ elseif swValue == 16 then
+ inf = GetCarInfo("wheelpressrearright")
+ if inf ~= nil then
+ lPanel = string.format("Prr:%2.1f", inf / 6.88)
+ end
+
+ elseif swValue == 17 then
+ -- brakes temp if available
+ inf = GetCarInfo("braketempfrontleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ lPanel = string.format("BFL:%3.0f", inf)
+ end
+ elseif swValue == 18 then
+ inf = GetCarInfo("braketempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ lPanel = string.format("BFr:%3.0f", inf)
+ end
+ elseif swValue == 19 then
+ inf = GetCarInfo("braketemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ lPanel = string.format("BrL:%3.0f", inf)
+ end
+ elseif swValue == 20 then
+ inf = GetCarInfo("braketemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ lPanel = string.format("Brr:%3.0f", inf)
+ end
+ elseif swValue == 21 then
+ -- position
+ local pos = GetContextInfo("position")
+ lPanel = string.format(" P%02d ", pos )
+
+ elseif swValue == 22 then
+ -- logo
+ lPanel = "SLIMAX"
+
+ elseif swValue == 23 then
+ -- rpm
+ local rpm = GetCarInfo("rpm")
+ lPanel = string.format("%5d ", rpm)
+
+ elseif swValue == 24 then
+ -- track size
+ local trcksz = GetContextInfo("tracksize")
+ lPanel = string.format("%5d ", trcksz)
+
+ elseif swValue == 25 then
+ -- 25.fuel
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ lPanel = string.format(" F%03d ", round(fuel))
+ elseif fuel >= 10 then
+ lPanel = string.format(" F%02d ", round(fuel))
+ else
+ lPanel = string.format(" F%1.1f ", fuel)
+ end
+ end
+
+ elseif swValue == 26 then
+ -- 26.distance
+ local dist = GetContextInfo("lapdistance")
+ lPanel = string.format(" %5d", dist )
+
+ elseif swValue == 27 then
+ --27.lap completed
+ local laps = GetContextInfo("laps")
+ lPanel = string.format(" %3d ", laps )
+
+ elseif swValue == 28 then
+ --28.total laps
+ local lpcnt = GetContextInfo("lapscount")
+ lPanel = string.format(" %3d ", lpcnt )
+
+ elseif swValue == 29 then
+ --29.sector
+ local sect = GetCarInfo("sector")
+ -- check if sector > 9
+ if sect >9 then
+ lPanel = string.format(" S%02d ", sect)
+ else
+ lPanel = string.format(" S%01d ", sect)
+ end
+
+ elseif swValue == 30 then
+ --30.kers
+ local kers = GetCarInfo("kers")
+ lPanel = string.format(" E:%3d", round(kers/1000))
+
+ elseif swValue == 31 then
+ --31.kers max
+ local kmx = GetCarInfo("kersmax")
+ lPanel = string.format(" E:%03d", round(kmx/1000))
+
+ elseif swValue == 32 then
+ --32.drs
+ local drs = GetCarInfo("drs")
+ if drs == 1 then
+ lPanel = "DrS:ON "
+ else
+ lPanel = "DrS:OFF"
+ end
+
+ elseif swValue == 33 then
+ --33.kers percent
+ local kers = GetCarInfo("kers")
+ lPanel = string.format(" E:%3d", round((kers/1000)/4))
+
+ elseif swValue == 34 then
+ --33.kers percent:speed
+ local kers = GetCarInfo("kers")
+ lPanel = string.format("%3d:%3.0f", round((kers/1000)/4), spd)
+
+ else
+ lPanel = "-:--.---"
+ end
+ -- send string to sli manager
+ SetLeftDigits( lPanel )
+ return 1
+end
+
+-- IN function of right panel
+-- param: recieve from SLI Manager the current switch position
+function rightDigitsEvent(swFunction)
+ swValue = swFunction + 1
+ -- call custom script
+ local result = custom_rightDigitsEvent(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_rightDigitsEvent(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
+
+ local hr = 0
+ local mn = 0
+ local sc = 0
+ local ms = 0
+ local hd = 0
+ local rPanel = ""
+ local lpt = 0.0
+ local diffFlag = false
+ local unit = false
+
+ -- is OSP Tracking ON
+ local ospt = false
+ ospt = GetContextInfo("osptracking")
+ if ospt == nil then ospt = false end
+ if ospt then
+ swValue = 23
+ end
+
+ -- lap finished, display lap time a few seconds
+ local dlt = false
+ dlt = GetContextInfo("displaylaptime")
+ if dlt == nil then dlt = false end
+ if dlt then
+ swValue = 3
+ end
+
+ -- check if quick info button is down
+ local qi = false
+ qi = GetContextInfo("quickinfobutton")
+ if qi == nil or qi == 0 then qi = false end
+ if qi then
+ -- get index for right panel
+ local qiRight = GetContextInfo("quickinforight")
+ if qiRight == nil then qiRight = 1 end
+ swValue = qiRight
+ end
+ -- get current display unit metric or imperial
+ unit = GetContextInfo("speedmetric")
+
+ -- get sim name
+ local sim = GetContextInfo("simulation")
+ if sim ~= nil then
+ if swValue == 1 then
+ -- current lap time
+ lpt = GetTimeInfo("laptime")
+ elseif swValue == 2 then
+ -- best lap time (PB)
+ lpt = GetTimeInfo("bestlaptime")
+ elseif swValue == 3 then
+ -- last lap time
+ lpt = GetTimeInfo("lastlaptime")
+
+ elseif swValue >= 4 and swValue <= 10 and isAppIRacing(sim) then
+ -- iRacing partials
+ local ts = GetContextInfo("partialcount")
+ local sector = GetCarInfo("sector")
+ if ts ~= nil and ts > 0 then
+ if swValue == 4 then
+ lpt = GetPartialTimeInfo("currentpartial", sector)
+ elseif swValue == 5 then
+ lpt = GetPartialTimeInfo("bestpartial", sector)
+ elseif swValue == 6 then
+ lpt = GetPartialTimeInfo("sessionbest", sector)
+ elseif swValue == 7 then
+ diffFlag = true
+ lpt = GetPartialTimeInfo("diffbestpartial", sector)
+ elseif swValue == 8 then
+ diffFlag = true
+ lpt = GetPartialTimeInfo("diffsessionbest", sector)
+ elseif swValue == 9 then
+ diffFlag = true
+ lpt = GetPartialTimeInfo("diffoptimalpartial", sector)
+ elseif swValue == 10 then
+ diffFlag = true
+ lpt = GetPartialTimeInfo("diffsessionoptimal", sector)
+ end
+ else
+ lpt = 0.0
+ end
+
+ elseif swValue == 11 then
+ -- real time diff vs your best
+ diffFlag = true
+ lpt = GetTimeInfo("realdiffbest")
+
+ elseif swValue == 12 then
+ -- real time diff vs your last
+ diffFlag = true
+ lpt = GetTimeInfo("realdifflast")
+
+ elseif swValue == 13 then
+ -- current sector
+ local sector = GetCarInfo("sector")
+ if sector == 1 then
+ lpt = GetTimeInfo("sector1")
+ elseif sector == 2 then
+ lpt = GetTimeInfo("sector2")
+ else
+ -- sector 3
+ local s1 = GetTimeInfo("sector1")
+ local s2 = GetTimeInfo("sector2")
+ local lt = GetTimeInfo("laptime")
+ lpt = lt - (s1 + s2)
+ end
+ elseif swValue == 14 then
+ -- best sector 1
+ lpt = GetTimeInfo("bestsector1")
+ elseif swValue == 15 then
+ -- best sector 2
+ lpt = GetTimeInfo("bestsector2")
+ elseif swValue == 16 then
+ -- last sector 1
+ lpt = GetTimeInfo("lastsector1")
+ elseif swValue == 17 then
+ -- last sector 2
+ lpt = GetTimeInfo("lastsector2")
+ elseif swValue == 18 then
+ -- position
+ local pos = GetContextInfo("position")
+ if pos >= 100 then
+ rPanel = string.format(" P%03d ", pos )
+ else
+ rPanel = string.format(" P%02d ", pos )
+ end
+ SetRightDigits( rPanel )
+ return 1
+ elseif swValue == 19 then
+ -- logo
+ rPanel = "SLIMAX"
+ SetRightDigits( rPanel )
+ return 1
+ elseif swValue == 20 then
+ -- speed on right panel
+ local spd = GetCarInfo("speed")
+ rPanel = string.format(" %3d ", spd )
+ SetRightDigits( rPanel )
+ return 1
+ elseif swValue == 21 then
+ -- time remaining if available
+ lpt = GetTimeInfo("timeremaining")
+
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lpt)
+ if hr > 0 then
+ rPanel = string.format( "%02dh%02d ", hr, mn)
+ else
+ rPanel = string.format( " %02d.%02d ", mn, sc)
+ end
+ SetRightDigits( rPanel )
+ return 1
+ elseif swValue == 22 then
+ -- PC system time
+ lpt = GetTimeInfo("systemtime")
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lpt)
+ rPanel = string.format( " %02d.%02d ", hr, mn)
+ SetRightDigits( rPanel )
+ return 1
+ elseif swValue == 23 then
+ -- rpm:gear
+ local rpm = GetCarInfo("rpm")
+ if rpm == nil then
+ return 1
+ end
+ local gear = GetCarInfo("gear")
+ if gear ~= nil then
+ rPanel = string.format("%5d:%d", rpm, gear)
+ SetRightDigits( rPanel )
+ end
+ return 1
+ elseif swValue == 24 then
+ -- time elapsed if available
+ lpt = GetTimeInfo("timetotalelapsed")
+
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lpt)
+ if hr > 0 then
+ rPanel = string.format( "%02dh%02d ", hr, mn)
+ else
+ rPanel = string.format( " %02d.%02d ", mn, sc)
+ end
+ SetRightDigits( rPanel )
+ return 1
+ elseif swValue == 25 then
+ -- 25.fuel
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ rPanel = string.format(" F%03d ", round(fuel))
+ elseif fuel >= 10 then
+ rPanel = string.format(" F%02d ", round(fuel))
+ else
+ rPanel = string.format(" F%1.1f ", fuel)
+ end
+
+ SetRightDigits( rPanel )
+ return 1
+ end
+
+ elseif swValue == 26 then
+ -- 26.distance
+ local dist = GetContextInfo("lapdistance")
+ rPanel = string.format(" %5d", dist )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 27 then
+ --27.lap completed
+ local laps = GetContextInfo("laps")
+ rPanel = string.format(" %3d ", laps )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 28 then
+ --28.total laps
+ local lpcnt = GetContextInfo("lapscount")
+ rPanel = string.format(" %3d ", lpcnt )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 29 then
+ --29.sector
+ local sect = GetCarInfo("sector")
+ -- check if sector > 9
+ if sect >9 then
+ rPanel = string.format(" S%02d ", sect)
+ else
+ rPanel = string.format(" S%01d ", sect)
+ end
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 30 then
+ --30.kers
+ local kers = GetCarInfo("kers")
+ rPanel = string.format(" E%03d ", round(kers/1000) )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 31 then
+ --31.kers max
+ local kmx = GetCarInfo("kersmax")
+ rPanel = string.format(" E%03d ", round(kmx/1000) )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 32 then
+ --32.drs
+ rPanel = "DrS.OFF"
+ local drs = GetCarInfo("drs")
+ if drs >= 1 then
+ rPanel = "DrS. ON"
+ end
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 33 then
+ --33.kers percent
+ local kers = GetCarInfo("kers")
+ rPanel = string.format(" %3d ", round((kers/1000)/4))
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 34 then
+ --34 track size
+ local trcksz = GetContextInfo("tracksize")
+ rPanel = string.format("%5d ", trcksz)
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 35 then
+ --35 last sector 1, 2 and 3
+ local sector = GetCarInfo("sector")
+ if sector == 1 then
+ -- sector 3
+ local 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
+
+ else
+ -- none
+ rPanel = "-:--.---"
+ SetRightDigits( rPanel )
+ return 1
+ end
+ end
+
+ if lpt == nil then return 0 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 diffFlag then
+ --
+ if GetTicks() > (mDeltaTimeDelay + mDeltaTimeOldTicks ) then
+ mDeltaTimeOldTicks = GetTicks()
+ if lpt == -1 or (mn + sc + ms) == 0.0000 then
+ mDeltaTimeBackup = " --.---"
+ elseif mn > 0 then
+ mDeltaTimeBackup = string.format( "%s%2d.%02d.%01d", c, mn, sc, ms)
+ 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
+ end
+ -- send time to sli manager
+ SetRightDigits( rPanel )
+ return 1
+end
+
diff --git a/scripts/slipro_f1_2012_villota.lua b/scripts/slipro_f1_2012_villota.lua
new file mode 100755
index 0000000..7798966
--- /dev/null
+++ b/scripts/slipro_f1_2012_villota.lua
@@ -0,0 +1,102 @@
+-- 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
new file mode 100755
index 0000000..7919983
--- /dev/null
+++ b/scripts/slipro_gtr2_villota.lua
@@ -0,0 +1,102 @@
+-- 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_basic.lua b/scripts/slipro_iracing_basic.lua
new file mode 100755
index 0000000..336a7f2
--- /dev/null
+++ b/scripts/slipro_iracing_basic.lua
@@ -0,0 +1,11 @@
+-- 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
new file mode 100755
index 0000000..7919983
--- /dev/null
+++ b/scripts/slipro_lfs_villota.lua
@@ -0,0 +1,102 @@
+-- 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
new file mode 100755
index 0000000..7919983
--- /dev/null
+++ b/scripts/slipro_rfactor2_villota.lua
@@ -0,0 +1,102 @@
+-- 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
new file mode 100755
index 0000000..7919983
--- /dev/null
+++ b/scripts/slipro_rfactor_villota.lua
@@ -0,0 +1,102 @@
+-- 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
new file mode 100755
index 0000000..c3d217b
--- /dev/null
+++ b/scripts/speedlimiter.lua
@@ -0,0 +1,238 @@
+-- SLIMax Mgr Lua Script v2.1
+-- Copyright (c)2011-2013 by EK and Zappadoc - All Rights Reserved.
+-- Use this script to build all speed-limiter feedback methods
+-- last change by Zappadoc - 2012-10-06
+
+-- SLI-M, SLI-PRO speed limiter Methods
+function spdLmtMethodEvent(idx)
+ mSpdLimitMethod = idx
+ mLeftSpdLmtText = " "
+ mRightSpdLmtText = " "
+ -- call custom script
+ local result = custom_spdLmtMethodEvent(mSpdLimitMethod)
+ -- 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_spdLmtMethodEvent(mSpdLimitMethod)
+ -- 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 (mSpdLimitMethod == 0) then
+ -- speedlimiter led NOT blinking
+ SetWarnLed(mSpeedLimiterLED, 1)
+
+ elseif mSpdLimitMethod == 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 mSpdLimitMethod == 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 mSpdLimitMethod == 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 mSpdLimitMethod == 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 mSpdLimitMethod == 5 or mSpdLimitMethod == 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 mSpdLimitMethod == 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 mSpdLimitMethod == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
+
+ else
+ return 0
+ end
+
+ -- timebase
+ if GetTicks() > mOldTickCount then
+ mOldTickCount = GetTicks() + 20
+ end
+ return 1
+end
+
diff --git a/scripts/villota_scripts/villota_custom_functions.lua b/scripts/villota_scripts/villota_custom_functions.lua
new file mode 100755
index 0000000..0a39b78
--- /dev/null
+++ b/scripts/villota_scripts/villota_custom_functions.lua
@@ -0,0 +1,158 @@
+-- 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
new file mode 100755
index 0000000..1d5bb02
--- /dev/null
+++ b/scripts/zdoc_scripts/iracing_common_scripts.lua
@@ -0,0 +1,136 @@
+-- iRacing SLI-PRO Custom SLIMax Manager Scripts v2.3
+-- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
+-- last change by Zappadoc - 2012-12-17
+
+-- ================================
+-- CONSTANTS
+
+
+-- ================================
+-- additional lua extension module dll
+
+
+-- ================================
+-- additional scripts file
+require "scripts/zdoc_scripts/iracing_stuff"
+
+-- ================================
+-- 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 custom controls script here (manage buttons, switches and encoders)
+ 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
+ -- 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)
+
+ end
+ return result
+end
+
+function custom_shiftLightsMethodEvent(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)
+ -- skip std methods
+ return 1
+ end
+
+ return 2
+end
+
+function custom_shiftLightsBU0710Event(idx)
+ -- type your custom shiftlights method for BU0710 device only here
+ return 2
+end
+
+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_spdLmtMethodEvent(idx)
+ -- type your custom speedlimiter 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_spdLmtMethodEvent(idx)
+
+ end
+ return result
+end
+
+function custom_gearEvent(gear)
+ -- type your custom gear event script here
+ -- get current simulation name
+ -- custom script to overwrite OSP value and OSP limit for each gear of each iRacing car
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim) then
+ if gOldGear == nil then gOldGear = -2 end
+ -- setup iRacing car OSP, RedZone, Max gear, ...
+ iRacing_CarSetup(gear)
+ if gear ~= gOldGear then
+ gOldGear = gear
+ -- print("\n----------\nGear: ".. gear .."\nOSP: " .. gOSPLimit .. "\nRedZone:" .. gRedZone .."\n")
+ end
+ end
+ return 2
+end
+
+function custom_enterSessionEvent(devType)
+ -- type your custom script on session start, here
+
+ -- custom script to get the max gear of each iRacing car
+ -- get current simulation name
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim ) then
+ iRacing_CarSetup(0)
+ -- see debug window
+ -- get car name
+ local cNm = GetContextInfo("carname")
+ local mxG = GetCarInfo("maxgear")
+ local ospf = GetContextInfo("ospfactor")
+ print("\n----------\nSetup car:" .. cNm .. "\nMaxGear:" .. mxG .. "\nOSP Factor:" .. ospf .. "\n");
+ 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
diff --git a/scripts/zdoc_scripts/iracing_stuff.lua b/scripts/zdoc_scripts/iracing_stuff.lua
new file mode 100755
index 0000000..b53c66c
--- /dev/null
+++ b/scripts/zdoc_scripts/iracing_stuff.lua
@@ -0,0 +1,355 @@
+-- Custom SLIMax Manager Scripts for iRacing v2.1
+-- Copyright ©2012-2013 by Zappadoc
+-- _last change by Zappadoc - 2012-12-17
+
+-- =====================================
+-- iRacing Stuff script
+-- define car setup function and all pit limiter and shiftlights methods for each car you drive
+
+
+function iRacing_CarSetup(cGear)
+ -- get car name
+ local cNm = ""
+ cNm = GetContextInfo("carname")
+ local mxG = 4
+ local ospf = 140
+
+ if cNm == "cadillacctsvr" then
+ mxG = 6
+ ospf = 148
+
+ elseif cNm == "mclarenmp4" then
+ mxG = 6
+ ospf = 150
+
+ elseif cNm == "formulamazda" then
+ mxG = 6
+ ospf = 60
+
+ elseif cNm == "williamsfw31" then
+ mxG = 7
+ ospf = 90
+
+ elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
+ mxG = 6
+ ospf = 140
+
+ elseif cNm == "hpdarx01c" then
+ mxG = 6
+ if cGear <= 2 then
+ ospf = 10
+ gOSPLimit = 9900
+ gRedZone = 9920
+ elseif cGear ==3 then
+ ospf = 100
+ gOSPLimit = 9530
+ gRedZone = 9545
+ elseif cGear == 4 then
+ ospf = 90
+ gOSPLimit = 9500
+ gRedZone = 9510
+ else
+ ospf = 150
+ gOSPLimit = 9420
+ gRedZone = 9425
+ end
+
+
+ elseif cNm == "fordgt" then
+ mxG = 6
+ ospf = 128
+
+ elseif cNm == "fr500s" then
+ mxG = 6
+ ospf = 150
+
+ elseif cNm == "fordv8sc" then
+ mxG = 6
+ ospf = 100
+
+ elseif cNm == "dallara" then
+ mxG = 6
+ ospf = 95
+
+ elseif cNm == "latemodel" then
+ mxG = 5
+
+ elseif cNm == "legends ford34c" then
+ mxG = 5
+ ospf = 150
+
+ elseif cNm == "skmodified" then
+ mxG = 6
+
+ elseif cNm == "silvercrown" then
+ mxG = 6
+
+ elseif cNm == "trucks silverado" then
+ mxG = 4
+
+ elseif cNm == "stockcars impala" then
+ mxG = 4
+ ospf = 140
+
+ elseif cNm == "lotus79" then
+ mxG = 5
+ ospf = 100
+
+ elseif cNm == "stockcars2 chevy" then
+ mxG = 4
+ ospf = 130
+
+ elseif cNm == "stockcars2 chevy cot" then
+ mxG = 4
+ ospf = 150
+
+ elseif cNm == "c6r" then
+ mxG = 6
+ ospf = 145
+
+ elseif cNm == "solstice" then
+ mxG = 5
+ ospf = 150
+
+ elseif cNm == "jettatdi" then
+ mxG = 5
+
+ elseif cNm == "radical sr8" then
+ mxG = 6
+ ospf = 115
+
+ elseif cNm == "rt2000" then
+ mxG = 5
+ ospf = 140
+
+ elseif cNm == "specracer" then
+ mxG = 5
+ ospf = 140
+
+ elseif cNm == "rileydp" then
+ mxG = 5
+ ospf = 85
+
+ elseif cNm == "streetstock" then
+ mxG = 4
+ ospf = 150
+
+ elseif cNm == "sprint" then
+ mxG = 6
+
+ else
+ -- default
+ mxG = 4
+ ospf = 150
+ end
+ -- set max gear and OSP factor for this car
+ SetMaxGear(mxG)
+ SetOSPFactor(ospf)
+end
+
+function FixRPMSpeedlimiter()
+ local led = ""
+ -- init table
+ initLedTable(mRPMLedTable, 0)
+ SetRPMLed("mRPMLedTable")
+ for i = 0,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+
+end
+
+function iRacing_spdLmtMethodEvent(idx)
+ local led = ""
+
+ -- get car name
+ local cNm = GetContextInfo("carname")
+
+ -- speedlimiter stuff
+ if cNm == "formulamazda" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "mclarenmp4" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "williamsfw31" then
+ -- speedlimiter led fixed + digits blinking, method 6
+ mSpdLimitMethod = 6
+
+ elseif cNm == "fordv8sc" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "dallara" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "fordgt" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "hpdarx01c" then
+ FixRPMSpeedlimiter()
+ return 1
+
+ elseif cNm == "rileydp" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "c6r" then
+ FixRPMSpeedlimiter()
+ return 1
+
+ elseif cNm == "radical sr8" then
+ mSpdLimitMethod = 0
+
+ elseif cNm == "jettatdi" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "cadillacctsvr" then
+ FixRPMSpeedlimiter()
+ return 1
+
+ -- cars with without dashboardleds
+ -- elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
+ -- elseif cNm == "fr500s" then
+ -- elseif cNm == "latemodel" then
+ -- elseif cNm == "legends ford34c" then
+ -- elseif cNm == "legends ford34c rookie" then
+ -- elseif cNm == "skmodified" then
+ -- elseif cNm == "silvercrown" then
+ -- elseif cNm == "trucks silverado" then
+ -- elseif cNm == "stockcars impala" then
+ -- elseif cNm == "lotus79" then
+ -- elseif cNm == "stockcars2 chevy" then
+ -- elseif cNm == "solstice" then
+ -- elseif cNm == "solstice rookie" then
+ -- elseif cNm == "rt2000" then
+ -- elseif cNm == "specracer" then
+ -- elseif cNm == "streetstock" then
+ -- elseif cNm == "sprint" then
+
+ else
+ -- default
+ mSpdLimitMethod = 0
+
+ end
+ return 2
+end
+
+function iRacing_shiftLightsMethodEvent(idx)
+ -- rpm table name
+ local tName = "mRPMLedTable"
+ -- get rpm
+ local rpm = 0
+ rpm = GetCarInfo("rpm")
+ if rpm == nil then rpm = 0 end
+
+ -- check redzone value
+ if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
+
+ -- get car name
+ local cNm = GetContextInfo("carname")
+
+ local isPit = GetCarInfo("inpits")
+ local carspd = GetCarInfo("rawspeed")
+
+ -- init leds (see global.lua)
+ initLedTable(mRPMLedTable, 0)
+
+ -- Pits Stuff
+ if isPit == 1 and carspd == 0 then
+ -- pit stop
+
+ elseif isPit >= 1 and carspd > 21 then
+ -- car Approaching pits (or in pit lane) and exceed 45 mph
+ -- set the red zone to the current engine rpm (This sets the shiftlights to the max and warns the driver)
+ local spdLmt = GetCarInfo("speedlimiter")
+ if spdLmt == 0 then
+ -- if speedlimiter is OFF
+ gRedZone = rpm
+ end
+ end
+
+ -- shiftlights stuff
+ if cNm == "formulamazda" then
+ -- start Mazda shiftlights
+ SideToCenterSLI(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5)
+
+ elseif cNm == "mclarenmp4" then
+ local gear = GetCarInfo("gear")
+ if gear == 6 then
+ ProgressiveFixedSLI(rpm, 6300, 6490, 6580, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
+ else
+ ProgressiveFixedSLI(rpm, 6200, 6390, 6480, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
+ end
+
+ elseif cNm == "williamsfw31" then
+ AlternateSLI(rpm, gRedZone, 11.0, 12.0, 12.9)
+
+ elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
+ SideToCenterSLI(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99)
+
+ elseif cNm == "fr500s" then
+ SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
+
+ elseif cNm == "fordv8sc" then
+ SideToCenterSLI(rpm, gRedZone, 87, 90, 92, 94 ,97 ,98 ,99)
+
+ elseif cNm == "dallara" then
+ SideToCenterSLI(rpm, gRedZone, 78, 82, 90, 94 ,97 ,98 ,99)
+--
+ elseif cNm == "fordgt" then
+ SideToCenterSLI(rpm, gRedZone, 93, 94, 95, 96 ,97 ,98 ,99)
+
+ elseif cNm == "hpdarx01c" then
+ ProgressiveFixedSLI(rpm, 7800, 7900, 8100, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
+
+ elseif cNm == "rileydp" then
+ ProgressiveFixedSLI(rpm, 10000, 6700, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000, 10000)
+
+ elseif cNm == "c6r" then
+ ProgressiveFixedSLI(rpm, 4700, 4800, 4900, 5000, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
+
+ elseif cNm == "radical sr8" then
+ ProgressiveFixedSLI(rpm, 4350, 4800, 5100, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
+
+ elseif cNm == "jettatdi" then
+ SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
+
+ elseif cNm == "cadillacctsvr" then
+ --ProgressiveFixedSLI(rpm, 6500, 6580, 6600, 6700, 6800 , 6900 , 7000 , 7100, 7200, 7300, 7400, 7500, 7600)
+ 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 )
+
+ -- progressive default method for all cars with dashboard without leds
+ -- elseif cNm == "latemodel" then
+ -- elseif cNm == "legends ford34c" then
+ -- elseif cNm == "legends ford34c rookie" then
+ -- elseif cNm == "skmodified" then
+ -- elseif cNm == "silvercrown" then
+ -- elseif cNm == "trucks silverado" then
+ -- elseif cNm == "stockcars impala" then
+ -- elseif cNm == "lotus79" then
+ -- elseif cNm == "stockcars2 chevy" then
+ -- elseif cNm == "solstice" then
+ -- elseif cNm == "solstice rookie" then
+ -- elseif cNm == "rt2000" then
+ -- elseif cNm == "specracer" then
+ -- elseif cNm == "streetstock" then
+ -- elseif cNm == "sprint" then
+
+ else
+ -- default
+ 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
+
+ -- set leds
+ SetRPMLed(tName)
+end
+
+function iRacing_ospMethodEvent(idx)
+ -- get car name
+ local cNm = GetContextInfo("carname")
+ -- OSP Method stuff
+ if cNm == "mclarenmp4" or cNm == "williamsfw31" then
+ if mOSPMethod ~= nil then mOSPMethod = 3 end
+ end
+ return 2
+end \ No newline at end of file
diff --git a/slipro_gus.sli b/slipro_gus.sli
new file mode 100755
index 0000000..64762a6
--- /dev/null
+++ b/slipro_gus.sli
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<settings version="SLIPREFS02" flag="4" value=" " info="SLI-PRO Default Settings #~http://www.eksimracing.com">
+ <GENERAL info="Common device options" flag="15">
+ <REVERSE flag="15" value="r" info="choose the reverse char (* for blank char)"/>
+ <NEUTRAL flag="15" value="-" info="choose the neutral char (* for blank char)"/>
+ </GENERAL>
+ <SLIPRO info="SLI-PRO device options" flag="4">
+ <HELP flag="4" value=" " info="Define the default value for speed-limiter method, left and right panel function, max left and right functions, Quick-Info left and right function"/>
+ <SPDLMTMETHOD flag="6" info="SPD LMT Methods functions are defined in speedlimiter.lua script. Enter a value from 0 to 5 (default 3)" value="1"/>
+ <SPDLMTRPMLEDONLY flag="6" value="false" info="Enter true if you want to blink the RPM led without the speedlimiter led when speedlimiter is activated."/>
+ <LEFTDIGITSPANELS flag="4" info="Double-Click 'LEFTDIGITSPANELS' tag to assign left panel functions and apply your change. These functions are defined in slipro.lua script#~Custom Script can change the default behavior.#~These Functions ARE Not Available In All Simulation/Game" value="5,1,3,4,2,6,7,8"/>
+ <RIGHTDIGITSPANELS flag="4" info="Double-Click 'RIGHTDIGITSPANELS' tag to assign right panel functions (time related functions) and apply your change. These functions are defined in slipro.lua script#~Custom Script can change the default behavior.#~These Functions ARE Not Available In All Simulation/Game" value="1,3,2,11,27,22,23,20"/>
+ <QIFUNCTIONLEFT flag="6" value="3" info="Enter the corresponding function number (0 to deactivate) to show the info on left digits while you keep the button assigned to QIButton pressed (see the functions list in the slipro.lua script or by editing LEFTDIGITSPANELS tag)."/>
+ <QIFUNCTIONRIGHT flag="6" value="3" info="Enter the corresponding function number (0 to deactivate) to show the info on right digits while you keep the button assigned to QIButton pressed (see the functions list in slipro.lua script or by editing RIGHTDIGITSPANELS tag)."/>
+ <BUTTONSCHARSMAPPING flag="38" value="false" info="Buttons from 1 to 16: Activate (true) or deactivate (false) button mapping to char function"/>
+ <BTNCHARLIST flag="38" value="NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA" info="Map each button to char (from button 1 to 16)"/>
+ <SW3CHARSMAPPING value="false" flag="38" info="Switch 3: Activate (true) or deactivate (false) switch mapping to char function"/>
+ <SW3CHARS value="NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA" flag="38" info="set each position of switch to map it to char (up to 12 mapping per switch)"/>
+ <SW4CHARSMAPPING value="false" flag="38" info="Switch 4: Activate (true) or deactivate (false) switch mapping to char function"/>
+ <SW4CHARS value="NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA" flag="38" info="set each position of switch to map it to char (up to 12 mapping per switch)"/>
+ <SW5CHARSMAPPING value="false" flag="38" info="Switch 5: Activate (true) or deactivate (false) switch mapping to char function"/>
+ <SW5CHARS value="NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA" flag="38" info="set each position of switch to map it to char (up to 12 mapping per switch)"/>
+ <SW6CHARSMAPPING value="false" flag="38" info="Switch 6: Activate (true) or deactivate (false) switch mapping to char function"/>
+ <SW6CHARS value="NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA" flag="38" info="set each position of switch to map it to char (up to 12 mapping per switch)"/>
+ </SLIPRO>
+ <SHIFTPOINTS info="Shiftpoints is calculated on fly and depend the car you drive (see method below)" flag="6">
+ <HELP info="OSP Feedback method is defined in osp.lua script and contains the following methods: #~#~0 default two std blue led blinking#~1 two std blue led blinking + shiftlights rpm blue blinking#~2 normal blinking + shiftlights rpm blue no blinking#~3 shiftlights rpm blue only no blinking#~4 shiftlights rpm blue only blinking" flag="6"/>
+ <SHIFTPOINTSMETHOD info="Enter the type of OSP feedback (method used) from 0 to 4 (default 0)." flag="6" value="0"/>
+ </SHIFTPOINTS>
+ <LED flag="6" value=" " info="####### Leds Layout ######">
+ <HELP info="Set the corresponding function for each led from 1 to 11#~(6 extra and 5 external)#~#~RESET LED what does it means?#~#~well, by default all led are reseted before applying its new state, typically ON or OFF and this work fine if you have each led function assigned to ONE led only!#~#~But now, let say you have TC and Pit-Request on the same led. If you allow reset for both function TC can't be ON if the Pit-Request is OFF! #~PitReq function is after TC (see the priority order below) and will reset the state of TC...#~#~In other words, to avoid reseting the led you just have to put false in the 2th function this way the led will stay highlighted if one of the two function state is ON... clear? hope so!#~#~Here the current priority order of all functions :#~#~Ignition (supersede all other with no led and 'E' displayed)#~shiftpoint#~speedlimiter#~low fuel#~TC#~ALB#~Green flag#~Yellow flag#~Red flag#~Overheating#~Damage#~PitReq and InPits#~Power#~RevLimit#~Headlights#~SafePrefs#~IMPORTANT External method (supersede all other if activated)" flag="6"/>
+ <LEDOPTIMALSHIFTPOINTRIGHT value="6" info="set if you want to have a shiftpoint feedback on one or two led, value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <LEDOPTIMALSHIFTPOINTLEFT value="1" info="set if you want to have a shiftpoint feedback on one or two led, value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <LEDSPEEDLIMITER value="5" info="set if you want to have a speedlimiter feedback, value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <LEDLOWFUEL value="2" info="set if you want to have a low fuel feedback value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDTRACTIONCONTROL value="true" info="set if you want to have a TC feedback" flag="6"/>
+ <LEDTRACTIONCONTROL value="4" info="value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDANTILOCKBRAKES value="true" info="set if you want to have a anti-lock brakes feedback" flag="6"/>
+ <LEDANTILOCKBRAKES value="3" info="value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDGREENFLAG value="true" info="set if you want to have a green flag feedback (not implemented in all API)" flag="6"/>
+ <LEDGREENFLAG flag="6" info="value from led 1 to 11 (zero to deactivate)" value="9"/>
+ <RESETLEDYELLOWFLAG value="false" info="set if you want to have a yellow flag feedback (not implemented in all API)" flag="6"/>
+ <LEDYELLOWFLAG value="2" info="value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDREDFLAG flag="6" value="false" info="set if you want to have a red flag feedback (not implemented in all API)"/>
+ <LEDREDFLAG flag="6" value="5" info="value from led 1 to 11 (zero to deactivate)"/>
+ <RESETLEDDAMAGE value="false" info="set if you want to have a damage feedback (not implemented in all API)" flag="6"/>
+ <LEDDAMAGE value="3" info="value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDOVERHEATING value="false" info="set if you want to have an overheating feedback" flag="6"/>
+ <LEDOVERHEATING value="3" info="value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDREVLIMIT value="true" info="set if you want to have the revlimit feedback" flag="6"/>
+ <LEDREVLIMIT value="8" info="value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDPOWER value="true" info="set if you want to have a power ON/OFF feedback" flag="6"/>
+ <LEDPOWER value="11" info="value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDPITREQUEST value="false" info="set if you want to have a pit request and inpits feedback" flag="6"/>
+ <LEDPITREQUEST flag="6" value="6" info="value from led 1 to 11 (zero to deactivate)"/>
+ <RESETLEDHEADLIGHTS value="true" info="set if you want to have a headlights feedback" flag="6"/>
+ <LEDHEADLIGHTS value="10" info="value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDSAFEPREFS value="false" info="set when SafePrefs toggle button is ON" flag="6"/>
+ <LEDSAFEPREFS value="10" info="value from led 1 to 11 (zero to deactivate)" flag="6"/>
+ <RESETLEDBLUEFLAG value="false" info="set if you want to have a blue flag feedback (not implemented in all API)" flag="6"/>
+ <LEDBLUEFLAG flag="6" value="1" info="value from led 1 to 11 (zero to deactivate)"/>
+ <RESETLEDDRS value="false" info="set if you want to have a DRS feedback (not implemented in all API)" flag="38"/>
+ <LEDDRS value="7" info="value from led 1 to 11 (zero to deactivate)" flag="38"/>
+ </LED>
+ <SHIFTLIGHTS info="Shiftlights options" flag="15">
+ <HELP info="SHIFTLIGHTS Methods Information defined in shiftlights.lua script." flag="15"/>
+ <SHIFTLIGHTSTYPE flag="15" info="SHIFTLIGHTS Methods Functions are defined in shiftlights.lua script. the default implementation contains the following methods:#~0 Progressive,#~1 all green/red/blue alternatively,#~2 percentage method,#~3 absolute method (not recommended), #~4 from side to center" value="2"/>
+ <RPMVALUES flag="22" value="75,77,79,81,83,85,87,89,91,93,95,97,99" info="Individual RPM threshold value in percentage for shiftlights , for all 13 leds #~set the value of each led from 0 to 100%#~*Double-Click 'RPMVALUES' tag to edit RPM values and apply your change"/>
+ <RPMABSOLUTE flag="22" value="15452,15545,15823,16354,16410,16675,17252,17545,17823,18354,18510,18655,18675" info="Individual RPM threshold value for shiftlights, for all 13 leds #~set the value of each led from 0 to 20000%#~*Double-Click 'RPMABSOLUTE' tag to edit RPM values and apply your change"/>
+ </SHIFTLIGHTS>
+ <BRIGHTNESS info="Global and indivudual brightness options" flag="6">
+ <MAXBRIGHTNESS flag="6" value="145" info="Calibrate your device brightness by adjusting the maximum brightness value from 128 to 220 (default 145 for SLI-PRO).#~To calibrate your device, Choose the Test Device... menu and check if the device do not reset by itself during the testing process, if it does, decrease the maximum value."/>
+ <GLOBALBRIGHTNESS flag="6" value="0" info="GLOBAL BRIGHTNESS from 1 to 100%, (default 98%), use an encoder (2 inputs) to decrease or increase brightness."/>
+ <BRIGHTSTEP flag="6" value="10" info="Set the step for brightness adjustment (default 10)"/>
+ <TCBRIGHTNESS value="6" info="Max TC brightness from 3 to 8 (Default 6)" flag="6"/>
+ <ABSBRIGHTNESS value="6" info="Max ABS brightness from 3 to 8 (Default 6)" flag="6"/>
+ <RPMBRIGHTNESS flag="6" value="1,1,1,1,8,8,8,8,8,1,1,1,1" info="Individual brightness for shiftlights, for all 13 leds #~set the value of each led from 1 to 8"/>
+ <EXTRABRIGHTNESS flag="6" value="5,7,7,7,7,5" info="Individual brightness for the 6 extra leds #~set the value of each led from 1 to 8"/>
+ <EXTERNALBRIGHTNESS value="7,7,7,7,7" info="Individual brightness for the 5 external leds #~set the value of each led from 1 to 8" flag="6"/>
+ <GEARDIGITBRIGHTNESS info="Individual Digits brightness from 1 to 8" flag="6" value="7"/>
+ <TIMEDIGITBRIGHTNESS info="Individual Digits brightness from 1 to 8" flag="4" value="7"/>
+ <SPEEDDIGITBRIGHTNESS flag="4" value="8" info="Individual Digits brightness from 1 to 8"/>
+ </BRIGHTNESS>
+</settings>