summaryrefslogtreecommitdiff
path: root/scripts/slimax_script_readme.txt
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/slimax_script_readme.txt')
-rw-r--r--scripts/slimax_script_readme.txt1657
1 files changed, 837 insertions, 820 deletions
diff --git a/scripts/slimax_script_readme.txt b/scripts/slimax_script_readme.txt
index f309203..6a22a4f 100644
--- a/scripts/slimax_script_readme.txt
+++ b/scripts/slimax_script_readme.txt
@@ -1,820 +1,837 @@
-SLIMax Manager III 3.3.1 Scripting Information - PART OF SLIMax Manager pkg
-Copyright (c)2011-2013 by EK & Zappadoc - All Rights Reserved.
-updated 2013-10 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
-2 to skip and give control to SLIMax Mgr
-
----------------------------------------------
-GLOBAL EVENTS (ALL DEVICES)
----------------------------------------------
-function controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) and custom_controlsEvent
-params = see the control.lua script
-Devices supported: global event
-Notes: Controls Event, Manage buttons and switches. (see controls.lua script)
-
----------------------------------------------
-function deviceReport(deviceType) and custom_deviceReport
-param = the current targeted device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
-Devices supported: global event
-Notes: This function is called periodically and outputs the previously processed data to the device when it returns
-back to the manager, if needed, patch any previous function here to
-display additional info or to change everything. (see devhook.lua script)
-
----------------------------------------------
-function enterSessionEvent(deviceType) and custom_enterSessionEvent
-param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
-Notes: Triggered when the session starts
-(see enter_exit_session.lua script)
-
----------------------------------------------
-function exitSessionEvent(deviceType) and custom_exitSessionEvent
-param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
-Devices supported: global event
-Notes: Triggered when the session ends
-(see enter_exit_session.lua script)
-
----------------------------------------------
-LOCAL EVENTS (SPECIFIC TO DEVICES)
----------------------------------------------
-function shiftLightsMethodEvent(idx) and custom_shiftLightsMethodEvent
-function shiftLightsBU0710Event(idx) and custom_shiftLightsBU0710Event
-function shiftLightsFanatecMethodEvent(idx) and custom_shiftLightsFanatecMethodEvent
-function shiftLightsG27LedsMethodEvent(idx) and custom_shiftLightsG27LedsMethodEvent
-function shiftLightsSRDlxMethodEvent(idx) and custom_shiftLightsSRDlxMethodEvent
-function shiftLightsSRF1MethodEvent(idx) and custom_shiftLightsSRF1MethodEvent
-param = current method index
-Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
-Notes: shiftlights method event, computes all shiftlights methods
-(see shiftlights.lua script)
-
----------------------------------------------
-function ospMethodEvent(idx) and custom_ospMethodEvent
-function ospSRDlxMethodEvent(idx) and custom_ospSRDlxMethodEvent
-function ospSRF1MethodEvent(idx) and custom_ospSRF1MethodEvent
-function ospFanatecMethodEvent(idx) and custom_ospFanatecMethodEvent
-function ospG27LedsMethodEvent(idx) and custom_ospG27LedsMethodEvent
-param = current method index
-Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
-Notes: OSP method event, computes all Optimal Shift-Points methods
-(see osp.lua script)
-
----------------------------------------------
-function spdLmtMethodEvent(idx) and custom_spdLmtMethodEvent
-function spdLmtSRDlxMethodEvent(idx) and custom_spdLmtSRDlxMethodEvent
-function spdLmtSRF1MethodEvent(idx) and custom_spdLmtSRF1MethodEvent
-function spdLmtFanatecMethodEvent(idx) and custom_spdLmtFanatecMethodEvent
-function spdLmtG27MethodEvent(idx) and custom_spdLmtG27MethodEvent
-param = current method index
-Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
-Notes: speedlimiter method event, computes all speedlimiter methods
-(see speedlimiter.lua script)
-
----------------------------------------------
-function leftDigitsEvent(swPosition) and custom_leftDigitsEvent
-function rightDigitsEvent(swPosition) and custom_rightDigitsEvent
-function srdlxLeftDigitsEvent(swPosition) and custom_srdlxLeftDigitsEvent
-function srdlxRightDigitsEvent(swPosition) and custom_srdlxRightDigitsEvent
-function srf1LeftDigitsEvent(swPosition) and custom_srf1LeftDigitsEvent
-function srf1RightDigitsEvent(swPosition) and custom_srf1RightDigitsEvent
-function fanatecDigitsEvent(swPosition) and custom_fanatecDigitsEvent
-param = switch position
-Devices supported: SLI-PRO, SIM RACE Deluxe, SIM RACE F1 and Fanatec Wheels and emulators SLI-EMU and SRF1-EMU
-
-Notes: computes data to be displayed on digits panel of the device
-(see scripts: slipro.lua, simracedlx.lua, simracef1.lua and fanatec.lua)
-
----------------------------------------------
-function gearEvent(gear) and custom_gearEvent
-function gearFanatecEvent(gear) and custom_gearFanatecEvent
-Devices supported: SLI Boards series and Fanatec Wheels
-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 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
-
-Devices supported: SLI Boards series only
-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
-============================================
-
----------------------------------------------
-Fanatec additions:
----------------------------------------------
-SetFanatecDigitsAllowed(boolean)
-param boolean = true or false
-by default the 3 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
-
----------------------------------------------
-SetFanatecDigits(string)
-param string = 3 chars string + dots
-Set the alpha-numerical text (including the . delimiter) to the digits panel (see fanatec.lua script)
-
----------------------------------------------
-SetFanatecOneDigit(digit,a,b,c,d,e,f,g,dot)
-param digit = from 0 to 2
-param a,b,c,d,e,f,g = false or true
-param dot = false or true
-Set the 7 segments + dot of each digit
-
----------------------------------------------
-SetFanatecCspMotor(power,delay)
-param power: from 0 to 100
-param delay: from 0 to 1000 ms (1sec max)
-
-SetFanatecWheelMotor(motor,power,delay)
-param motor = 0 or 1 (left or right motor )
-param power: from 0 to 100
-param delay: from 0 to 1000 ms (1sec max)
-
-SetFanatecLed(string table) <<<<< DEPRECATED use SetRPMLed()
-param string = name of lua table (default mRPMLedTable)
-set RPM led of Fanatec rim ( see shiftlights.lua script)
-
-SetFanatecGear(gear) <<<<< DEPRECATED use SetGearDigits()
-param string = one char string (i.e. "r" or "n" or "1" ... )
-set the gear value in center of the Fanatec digits panel (see fanatec.lua script)
-
----------------------------------------------
-Logitech Additions:
----------------------------------------------
-SetG27Led(int)
-param integer = number, each bit represent one led from 0 to 0x1F
-set leds of G27 device ( see shiftlights.lua script)
-
----------------------------------------------
-SetBU0710Led(int)
-param integer = number from 0 to 10
-set leds of BU0710 device ( 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 ( 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 or SIM RACE Deluxe ( see shiftlights.lua script)
-
----------------------------------------------
-SetWarnLed(idx, val)
-param integer = index of led from 1 to 6
-param integer = value 1 or 0
-set the 6 extra leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
-
----------------------------------------------
-SetExtLed(idx, val)
-param integer = index of led from 1 to 5
-param integer = value 1 or 0
-set the 5 external leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
-
----------------------------------------------
-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 or SIM RACE Deluxe DIGITS PANELs ==========
-SetRightDigits(string)
-SetLeftDigits(string)
-param string = 6 chars string + delimiter
-set the alpha-numerical text (including the . and : delimiter) to the right
-and left digits (see slipro.lua or simracedlx.lua script)
-
----------------------------------------------
-SetDigitsAllowed(boolean)
-param boolean = true or false
-by default the 6 + 6 SLI-PRO digits or 4 x 4 SIM RACE Deluxe digits are showed but sometime we need to temporarily
-hide them to set our custom information, pass false to this function to hide digits
-and true to show them again
-
----------------------------------------------
-SetKeystroke(keycode, delay, modifier, modifier2)
-param string or integer = the key as a string (see the special keycode table below ) or Microsoft VKey code as integer
-param int = the delay from 50 to 1000 ms
-param modifier = SHIFT or CONTROL or ALT or ""
-param optional modifier2 = SHIFT or CONTROL or ALT or ""
-
-SPECIAL KEYCODE TABLE IN ADDITION TO A...Z CHARS:
- 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)
-
------------------------------------------------------------------------------------
-Force sending report (not recommended)
-SLISendReport()
-FanatecSendReport() <<<<< DEPRECATED use 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 )
-
----------------------------------------------
-result = SetSMXGlobal(globalVarName, stringValue)
-param globalVarName = ref name to global
-param stringValue = value (if you want to store a number convert it to string)
-result return = -2 exceed capacity (20 global max); -1 Error; 0 create new record; 1 update new record
-
----------------------------------------------
-result, stringValue = GetSMXGlobal(globalVarName )
-param globalVarName = ref name to global
-return string in stringValue or empty
-result return = -1 Error; 0 not found; 1 ok
-
----------------------------------------------
-SMXMessageBox(text, title, buttons_style, icon_style)
-param text = message text
-param title (optional) = title of the dialog box
-param buttons_style (optional) = see global.lua or Microsoft MessageBox buttons flags
-param icon_style (optional) = see global.lua or Microsoft MessageBox icon flags
-
-=========================================
-functions to get SLI Manager Information
-=========================================
-
-GetContextInfo("selector")
-GetCarInfo("selector")
-GetTimeInfo("selector")
-GetPartialTimeInfo("selector", index)
-IsSLIFunction("selector", function_index)
-GetDeviceType(deviceID)
-
------------------------------------------------------------------------------------
-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
-
-"devicelist" return the coma delimited list of current detected devices IDs (included game controllers)
-Reminder regarding device ID: if ID < 40 this is a shiftlight/Digits device; if >=40 this is a game controller
-
-Fanatec additions:
-"bypass" return the state of BYPASS preference (see advanced options panel)
-"fanatecdigitscount" return the number of digits default = 3
-"wheelmotorcount" return the number of wheel motors default = 2
-"cspmotorcount" return the number of Clubsport pedals motors default = 1
-"fanatecwheeltype" return the type of wheel
-"fanatecrimtype" return the type of rim ( BMW = 1; Formula = 2)
-"cspdetected" return true if CSP are present
-"gearshock" return state of GEARSHOCK effect preference (see advanced options panel)
-"gearshockdelay" return the value in ms of GEARSHOCKDELAY preference (see advanced options panel)
-"fanatecdigits" return the current position of digits panel
-"fanatecquickinfo" return the current selected quick-info function
-
-
-"shiftlightsmethod" return current selected method of targeted device
-"ospmethod" return current selected method of targeted device
-"speedlimitermethod" return current selected method of targeted device
-"pitfeedback" return true when car is on pit lane
-"ospcustom" return true if an OSP record to the current car has been found
-"neutral" return ascii code of neutral char (default 'n')
-"reverse" return ascii code of reverse char (default 'r')
-"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 also GetDeviceType())
-"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)
-"safetycar" return status of SC (true = ON TRACK ) if available
-
------------------------------------------------------------------------------------
-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
-
-"ignition" return the ignition state in rFactor2, 0=off 1=ignition 2=ignition+starter
-"kers" return kers value
-"kers max" return max kers energy
-"drs" return ON or OFF status
-"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
-"averagefuelperlap" return the average of consumption of fuel during a lap
-"remainlapsintank" get an average consumption of fuel per lap and return the remaining laps
-"fuelatstart" return the fuel in tank at the beginning of each lap
-
-"watertemp" return water engine temp (celsius)
-"oiltemp" return oil engine temp (celsius)
-"sector" return current sector (integer)
-"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
-"realdifftimeready" return true when telemetry data of at least one lap has been collected if available
-"realdiffbest" return real-time diff (delta) vs best if available
-"realdifflast" return real-time diff (delta) vs last if available
-"sector1" return current sector 1 if available
-"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
-"vsbestlap" return best partial time of this sector if available
-"vsoptimallap" return optimal partial time of this sector if available
-"vssessionbestlap" return session best partial time of this sector
-"vsoptimalsector" return session optimal partial time of this sector
-"vssessionoptimallap" return diff from session optimal if available
-"vssessionoptimalsector" return diff from 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.
-
-"fanatecdigits"
-"brightness"
-"quickinfo"
-"speedmetric"
-"lastgearnorpm"
-"osptracking"
-"safeprefs"
-"laptimedelay"
-"blinktime"
-"lowfuel"
-"speedlimitermethod"
-"shiftlights"
-"ospmethod"
-"rightdigits"
-"leftdigits"
-"ospfactor"
-"drivingsetup"
-"maxgear"
-
------------------------------------------------------------------------------------
-GetDeviceType(deviceID)
-returns the corresponding name of device ID
-Param deviceID (integer)
-return string value
-
------------------------------------------------------------------------------------
-GetLedIndex("selector")
-returns the corresponding index of the led
-Param led function (string) see the list below
-return integer value
-
-"speedlimiter"
-"osp1"
-"osp2"
-"lowfuel"
-"tractioncontrol"
-"abs"
-"greenflag"
-"yellowflag"
-"redflag"
-"overheating"
-"damage"
-"pitrequest"
-"power"
-"revlimit"
-"headlights"
-"blueflag"
-"drs"
-"safeprefs"
-"drslegal"
-
-===============================
- Script Developpment
- 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
-mOSPBU0710Method same as above for BU0710
-mOSPG27Method same as above for G27
-mOSPFanatecMethod same as above for Fanatec
-mOSPSRDlxMethod same as above for SIM RACE Deluxe
-mOSPSRF1Method same as above for SIM RACE F1
-
-mSpdLimitMethod to overwrite the method value, useful in custom_spdLmtMethodEvent() function to patch the current PIT LIMITER method with another one
-mSpdLimitG27Method same as above for G27
-mSpdLimitFanatecMethod same as above for Fanatec
-mSpdLimitSRDlxMethod same as above for SIM RACE Deluxe
-mSpdLimitSRF1Method same as above for SIM RACE F1
-
-mShiftlightsMethodIndex to overwrite the method value, useful in custom_shiftlightsMethodEvent() function to patch the current shiftlights method with another one
-mShiftlightsBU0710MethodIndex same as above for BU0710
-mShiftlightsG27MethodIndex same as above for G27
-mShiftlightsFanatecMethodIndex same as above for Fanatec
-mShiftlightsSRDlxMethodIndex same as above for SIM RACE Deluxe
-mShiftlightsSRF1MethodIndex same as above for SIM RACE F1
-
-oldGear is useful in custom_gearFanatecEvent() function to patch the current gear value
-
------------------------
- SHIFTLIGHTS UTILITIES
------------------------
-shiftlights utilities functions in SLIMax Mananger script API
-(see shiftlights.lua for example and usage)
-
---------------------------------------------------------
-shiftlights utilities functions for Fanatec
---------------------------------------------------------
--- shiftlights method from side to center
-function SideToCenterFanatec(rpm, redzone, p1, p2, p3, p4 ,p5 )
-
--- progressive method
-function ProgressiveFanatec(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
-
--- alternate yellow, red and blue method
-function AlternateFanatec(rpm, redzone, step1, step2, step3)
-
--- percentage method
-function percentageFanatec(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
-
--- fixed rpm method, set rpm for each led (NOT RECOMMENDED)
-function RpmFanatec(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
-
---------------------------------------------------------
-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 (NOT RECOMMENDED)
-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 )
-
---------------------------------------------------------
-shiftlights utilities functions for Logitech G27
---------------------------------------------------------
--- progressive method for G27
-function ProgressiveG27(rpm, redzone, p1, p2, p3, p4, p5)
-
--- percentage method for G27
-function PercentageG27(rpm, redzone, p1, p2, p3, p4, p5)
-
--- fixed rpm method for G27 (NOT RECOMMENDED)
-function RpmG27(rpm, p1, p2, p3, p4, p5 )
-
---------------------------------------------------------
--- KERS functions
-function GetKersPercent()
-
---------------------------------------------------------
-LEFT and RIGHT Functions utilities for SLI-M and SLI-PRO
---------------------------------------------------------
-
--- 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
--- local err = FuncAddName("cfg/fanatec_digits_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 )
--- or fanatec list:
--- local num_available = FuncGetNewIndex("cfg/fanatec_digits_functions.ecfg")
--- return value >=100 (0 to 99 are reserved )
-
---------------------------------------------------------
-functions utilities in global.lua
---------------------------------------------------------
-
--- return KERS value in percent
-function GetKersPercent()
-
--- Init all globals
-function InitGlobals()
-
--- set RPM threshold value in percentage ( SLIMax Manager 2.1 )
-function SetRPMPercentValue(index, value)
-
--- set RPM threshold value ( SLIMax Manager 2.1 )
-function SetRPMAbsoluteValue(index, value)
-
--- get all global preferences set in general_default.sli
-function GetSLIMaxInfo()
-
--- get cpu ticks
-function GetTicks()
-
--- reset table function
-function initLedTable(ibl, value)
-
--- toggle all led state
-function toggleAllLed(val)
-
--- The following function rounds a number
--- lua doesn't return the same rounded value as C/C++
-function round(num)
-
--- The following function calculate hr, mn, sec, hd, ms
--- param: time in meter/sec
-function timeDispatcher( tt)
-
--- return speed in KPH or MPH
-function speed(spd, selector)
-
--- Fahrenheit to Celsius
-function FtoC(f)
-
--- Celsius to Fahrenheit
-function CtoF(c)
-
--- Kelvin to Celsius
-function KtoC(k)
-
--- liters to gallons
-function LtoG(liters)
-
--- gallons to liters
-function GtoL(gallons)
-
--- return fuel in liters or gallons
-function GetFuel(fl, selector)
-
--- return celcius or fahrenheit
-function GetTemp(tmp, selector)
-
--- set delta time delay in ms
-function SetDeltaTimeDelay(delay) \ No newline at end of file
+SLIMax Manager III 3.3.3 Scripting Information - PART OF SLIMax Manager pkg
+Copyright (c)2011-2013 by EK & Zappadoc - All Rights Reserved.
+updated 2013-11 by Zappadoc
+
+** ALL INFORMATION BELOW ARE SUBJECT TO CHANGE WITHOUT NOTICE **
+
+Go to scripting forum support to get the latest information about SLIMax Manager API:
+http://www.eksimracing.com/forum
+
+=================================
+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
+2 to skip and give control to SLIMax Mgr
+
+---------------------------------------------
+GLOBAL EVENTS (ALL DEVICES)
+---------------------------------------------
+function controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) and custom_controlsEvent
+params = see the control.lua script
+Devices supported: global event
+Notes: Controls Event, Manage buttons and switches. (see controls.lua script)
+
+---------------------------------------------
+function deviceReport(deviceType) and custom_deviceReport
+param = the current targeted device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
+Devices supported: global event
+Notes: This function is called periodically and outputs the previously processed data to the device when it returns
+back to the manager, if needed, patch any previous function here to
+display additional info or to change everything. (see devhook.lua script)
+
+---------------------------------------------
+function enterSessionEvent(deviceType) and custom_enterSessionEvent
+param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
+Notes: Triggered when the session starts
+(see enter_exit_session.lua script)
+
+---------------------------------------------
+function exitSessionEvent(deviceType) and custom_exitSessionEvent
+param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
+Devices supported: global event
+Notes: Triggered when the session ends
+(see enter_exit_session.lua script)
+
+---------------------------------------------
+LOCAL EVENTS (SPECIFIC TO DEVICES)
+---------------------------------------------
+function shiftLightsMethodEvent(idx) and custom_shiftLightsMethodEvent
+function shiftLightsBU0710Event(idx) and custom_shiftLightsBU0710Event
+function shiftLightsFanatecMethodEvent(idx) and custom_shiftLightsFanatecMethodEvent
+function shiftLightsG27LedsMethodEvent(idx) and custom_shiftLightsG27LedsMethodEvent
+function shiftLightsSRDlxMethodEvent(idx) and custom_shiftLightsSRDlxMethodEvent
+function shiftLightsSRF1MethodEvent(idx) and custom_shiftLightsSRF1MethodEvent
+param = current method index
+Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
+Notes: shiftlights method event, computes all shiftlights methods
+(see shiftlights.lua script)
+
+---------------------------------------------
+function ospMethodEvent(idx) and custom_ospMethodEvent
+function ospSRDlxMethodEvent(idx) and custom_ospSRDlxMethodEvent
+function ospSRF1MethodEvent(idx) and custom_ospSRF1MethodEvent
+function ospFanatecMethodEvent(idx) and custom_ospFanatecMethodEvent
+function ospG27LedsMethodEvent(idx) and custom_ospG27LedsMethodEvent
+param = current method index
+Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
+Notes: OSP method event, computes all Optimal Shift-Points methods
+(see osp.lua script)
+
+---------------------------------------------
+function spdLmtMethodEvent(idx) and custom_spdLmtMethodEvent
+function spdLmtSRDlxMethodEvent(idx) and custom_spdLmtSRDlxMethodEvent
+function spdLmtSRF1MethodEvent(idx) and custom_spdLmtSRF1MethodEvent
+function spdLmtFanatecMethodEvent(idx) and custom_spdLmtFanatecMethodEvent
+function spdLmtG27MethodEvent(idx) and custom_spdLmtG27MethodEvent
+param = current method index
+Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
+Notes: speedlimiter method event, computes all speedlimiter methods
+(see speedlimiter.lua script)
+
+---------------------------------------------
+function leftDigitsEvent(swPosition) and custom_leftDigitsEvent
+function rightDigitsEvent(swPosition) and custom_rightDigitsEvent
+function srdlxLeftDigitsEvent(swPosition) and custom_srdlxLeftDigitsEvent
+function srdlxRightDigitsEvent(swPosition) and custom_srdlxRightDigitsEvent
+function srf1LeftDigitsEvent(swPosition) and custom_srf1LeftDigitsEvent
+function srf1RightDigitsEvent(swPosition) and custom_srf1RightDigitsEvent
+function fanatecDigitsEvent(swPosition) and custom_fanatecDigitsEvent
+param = switch position
+Devices supported: SLI-PRO, SIM RACE Deluxe, SIM RACE F1 and Fanatec Wheels and emulators SLI-EMU and SRF1-EMU
+
+Notes: computes data to be displayed on digits panel of the device
+(see scripts: slipro.lua, simracedlx.lua, simracef1.lua and fanatec.lua)
+
+---------------------------------------------
+function gearEvent(gear) and custom_gearEvent
+function gearFanatecEvent(gear) and custom_gearFanatecEvent
+Devices supported: SLI Boards series and Fanatec Wheels
+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 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
+
+Devices supported: SLI Boards series only
+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
+============================================
+
+---------------------------------------------
+Fanatec additions:
+---------------------------------------------
+SetFanatecDigitsAllowed(boolean)
+param boolean = true or false
+by default the 3 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
+
+---------------------------------------------
+SetFanatecDigits(string)
+param string = 3 chars string + dots
+Set the alpha-numerical text (including the . delimiter) to the digits panel (see fanatec.lua script)
+
+---------------------------------------------
+SetFanatecOneDigit(digit,a,b,c,d,e,f,g,dot)
+param digit = from 0 to 2
+param a,b,c,d,e,f,g = false or true
+param dot = false or true
+Set the 7 segments + dot of each digit
+
+---------------------------------------------
+SetFanatecCspMotor(power,delay)
+param power: from 0 to 100
+param delay: from 0 to 1000 ms (1sec max)
+
+SetFanatecWheelMotor(motor,power,delay)
+param motor = 0 or 1 (left or right motor )
+param power: from 0 to 100
+param delay: from 0 to 1000 ms (1sec max)
+
+SetFanatecLed(string table) <<<<< DEPRECATED use SetRPMLed()
+param string = name of lua table (default mRPMLedTable)
+set RPM led of Fanatec rim ( see shiftlights.lua script)
+
+SetFanatecGear(gear) <<<<< DEPRECATED use SetGearDigits()
+param string = one char string (i.e. "r" or "n" or "1" ... )
+set the gear value in center of the Fanatec digits panel (see fanatec.lua script)
+
+---------------------------------------------
+Logitech Additions:
+---------------------------------------------
+SetG27Led(int)
+param integer = number, each bit represent one led from 0 to 0x1F
+set leds of G27 device ( see shiftlights.lua script)
+
+---------------------------------------------
+SetBU0710Led(int)
+param integer = number from 0 to 10
+set leds of BU0710 device ( 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 ( 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 or SIM RACE Deluxe ( see shiftlights.lua script)
+
+---------------------------------------------
+SetWarnLed(idx, val)
+param integer = index of led from 1 to 6
+param integer = value 1 or 0
+set the 6 extra leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
+
+---------------------------------------------
+SetExtLed(idx, val)
+param integer = index of led from 1 to 5
+param integer = value 1 or 0
+set the 5 external leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
+
+---------------------------------------------
+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 or SIM RACE Deluxe DIGITS PANELs ==========
+SetRightDigits(string)
+SetLeftDigits(string)
+param string = 6 chars string + delimiter
+set the alpha-numerical text (including the . and : delimiter) to the right
+and left digits (see slipro.lua or simracedlx.lua script)
+
+---------------------------------------------
+SetDigitsAllowed(boolean)
+param boolean = true or false
+by default the 6 + 6 SLI-PRO digits or 4 x 4 SIM RACE Deluxe digits are showed but sometime we need to temporarily
+hide them to set our custom information, pass false to this function to hide digits
+and true to show them again
+
+---------------------------------------------
+SetKeystroke(keycode, delay, modifier, modifier2)
+param string or integer = the key as a string (see the special keycode table below ) or Microsoft VKey code as integer
+param int = the delay from 50 to 1000 ms
+param modifier = SHIFT or CONTROL or ALT or ""
+param optional modifier2 = SHIFT or CONTROL or ALT or ""
+
+SPECIAL KEYCODE TABLE IN ADDITION TO A...Z CHARS:
+ 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)
+
+-----------------------------------------------------------------------------------
+Force sending report (not recommended)
+SLISendReport()
+FanatecSendReport() <<<<< DEPRECATED use 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 )
+
+---------------------------------------------
+result = SetSMXGlobal(globalVarName, stringValue)
+param globalVarName = ref name to global
+param stringValue = value (if you want to store a number convert it to string)
+result return = -2 exceed capacity (20 global max); -1 Error; 0 create new record; 1 update new record
+
+---------------------------------------------
+result, stringValue = GetSMXGlobal(globalVarName )
+param globalVarName = ref name to global
+return string in stringValue or empty
+result return = -1 Error; 0 not found; 1 ok
+
+---------------------------------------------
+SMXMessageBox(text, title, buttons_style, icon_style)
+param text = message text
+param title (optional) = title of the dialog box
+param buttons_style (optional) = see global.lua or Microsoft MessageBox buttons flags
+param icon_style (optional) = see global.lua or Microsoft MessageBox icon flags
+
+=========================================
+functions to get SLI Manager Information
+=========================================
+
+GetContextInfo("selector")
+GetCarInfo("selector")
+GetTimeInfo("selector")
+GetPartialTimeInfo("selector", index)
+IsSLIFunction("selector", function_index)
+GetDeviceType(deviceID)
+
+-----------------------------------------------------------------------------------
+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
+
+"devicelist" return the coma delimited list of current detected devices IDs (included game controllers)
+Reminder regarding device ID: if ID < 40 this is a shiftlight/Digits device; if >=40 this is a game controller
+
+Fanatec additions:
+"bypass" return the state of BYPASS preference (see advanced options panel)
+"fanatecdigitscount" return the number of digits default = 3
+"wheelmotorcount" return the number of wheel motors default = 2
+"cspmotorcount" return the number of Clubsport pedals motors default = 1
+"fanatecwheeltype" return the type of wheel
+"fanatecrimtype" return the type of rim ( BMW = 1; Formula = 2)
+"cspdetected" return true if CSP are present
+"gearshock" return state of GEARSHOCK effect preference (see advanced options panel)
+"gearshockdelay" return the value in ms of GEARSHOCKDELAY preference (see advanced options panel)
+"fanatecdigits" return the current position of digits panel
+"fanatecquickinfo" return the current selected quick-info function
+
+
+"shiftlightsmethod" return current selected method of targeted device
+"ospmethod" return current selected method of targeted device
+"speedlimitermethod" return current selected method of targeted device
+"pitfeedback" return true when car is on pit lane
+"ospcustom" return true if an OSP record to the current car has been found
+"neutral" return ascii code of neutral char (default 'n')
+"reverse" return ascii code of reverse char (default 'r')
+"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 also GetDeviceType())
+"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)
+"safetycar" return status of SC (true = ON TRACK ) if available
+
+-----------------------------------------------------------------------------------
+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
+
+"ignition" return the ignition state in rFactor2, 0=off 1=ignition 2=ignition+starter
+"kers" return kers value
+"kers max" return max kers energy
+"drs" return ON or OFF status
+"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
+"averagefuelperlap" return the average of consumption of fuel during a lap
+"remainlapsintank" get an average consumption of fuel per lap and return the remaining laps
+"fuelatstart" return the fuel in tank at the beginning of each lap
+
+"watertemp" return water engine temp (celsius)
+"oiltemp" return oil engine temp (celsius)
+"sector" return current sector (integer)
+"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
+"realdifftimeready" return true when telemetry data of at least one lap has been collected if available
+"realdiffbest" return real-time diff (delta) vs best if available
+"realdifflast" return real-time diff (delta) vs last if available
+"sector1" return current sector 1 if available
+"sector2" return current sector 2 if available
+"sector3" return current sector 2 if available
+"bestsector1" return best sector 1 if available
+"bestsector2" return best sector 2 if available
+"bestsector3" return best sector 2 if available
+"lastsector1" return last sector 1 if available
+"lastsector2" return last sector 2 if available
+"lastsector3" 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 of iRacing Simulation
+(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 AVAILABLE ONLY IN IRACING SIMULATIONS ** IMPORTANT
+
+"currentpartial" return current partial time if available
+"vsbestlap" return best partial time of this sector if available
+"vsoptimallap" return optimal partial time of this sector if available
+"vssessionbestlap" return session best partial time of this sector
+"vsoptimalsector" return session optimal partial time of this sector
+"vssessionoptimallap" return diff from session optimal if available
+"vssessionoptimalsector" return diff from 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.
+
+"fanatecdigits"
+"brightness"
+"quickinfo"
+"speedmetric"
+"lastgearnorpm"
+"osptracking"
+"safeprefs"
+"laptimedelay"
+"blinktime"
+"lowfuel"
+"speedlimitermethod"
+"shiftlights"
+"ospmethod"
+"rightdigits"
+"leftdigits"
+"ospfactor"
+"drivingsetup"
+"maxgear"
+
+-----------------------------------------------------------------------------------
+GetDeviceType(deviceID)
+returns the corresponding name of device ID
+Param deviceID (integer)
+return string value
+
+-----------------------------------------------------------------------------------
+GetLedIndex("selector")
+returns the corresponding index of the led
+Param led function (string) see the list below
+return integer value
+
+"speedlimiter"
+"osp1"
+"osp2"
+"lowfuel"
+"tractioncontrol"
+"abs"
+"greenflag"
+"yellowflag"
+"redflag"
+"overheating"
+"damage"
+"pitrequest"
+"power"
+"revlimit"
+"headlights"
+"blueflag"
+"drs"
+"safeprefs"
+"drslegal"
+
+===============================
+ Script Developpment
+ 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
+mOSPBU0710Method same as above for BU0710
+mOSPG27Method same as above for G27
+mOSPFanatecMethod same as above for Fanatec
+mOSPSRDlxMethod same as above for SIM RACE Deluxe
+mOSPSRF1Method same as above for SIM RACE F1
+
+mSpdLimitMethod to overwrite the method value, useful in custom_spdLmtMethodEvent() function to patch the current PIT LIMITER method with another one
+mSpdLimitG27Method same as above for G27
+mSpdLimitFanatecMethod same as above for Fanatec
+mSpdLimitSRDlxMethod same as above for SIM RACE Deluxe
+mSpdLimitSRF1Method same as above for SIM RACE F1
+
+mShiftlightsMethodIndex to overwrite the method value, useful in custom_shiftlightsMethodEvent() function to patch the current shiftlights method with another one
+mShiftlightsBU0710MethodIndex same as above for BU0710
+mShiftlightsG27MethodIndex same as above for G27
+mShiftlightsFanatecMethodIndex same as above for Fanatec
+mShiftlightsSRDlxMethodIndex same as above for SIM RACE Deluxe
+mShiftlightsSRF1MethodIndex same as above for SIM RACE F1
+
+oldGear is useful in custom_gearFanatecEvent() function to patch the current gear value
+
+-----------------------
+ SHIFTLIGHTS UTILITIES
+-----------------------
+shiftlights utilities functions in SLIMax Mananger script API
+(see shiftlights.lua for example and usage)
+
+--------------------------------------------------------
+shiftlights utilities functions for Fanatec
+--------------------------------------------------------
+-- shiftlights method from side to center
+function SideToCenterFanatec(rpm, redzone, p1, p2, p3, p4 ,p5 )
+
+-- progressive method
+function ProgressiveFanatec(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
+
+-- alternate yellow, red and blue method
+function AlternateFanatec(rpm, redzone, step1, step2, step3)
+
+-- percentage method
+function percentageFanatec(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
+
+-- fixed rpm method, set rpm for each led (NOT RECOMMENDED)
+function RpmFanatec(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
+
+--------------------------------------------------------
+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 (NOT RECOMMENDED)
+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 )
+
+--------------------------------------------------------
+shiftlights utilities functions for Logitech G27
+--------------------------------------------------------
+-- progressive method for G27
+function ProgressiveG27(rpm, redzone, p1, p2, p3, p4, p5)
+
+-- percentage method for G27
+function PercentageG27(rpm, redzone, p1, p2, p3, p4, p5)
+
+-- fixed rpm method for G27 (NOT RECOMMENDED)
+function RpmG27(rpm, p1, p2, p3, p4, p5 )
+
+--------------------------------------------------------
+-- KERS functions
+function GetKersPercent()
+
+--------------------------------------------------------
+LEFT and RIGHT Functions utilities for SLI-M and SLI-PRO
+--------------------------------------------------------
+
+-- 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
+-- local err = FuncAddName("cfg/fanatec_digits_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 )
+-- or fanatec list:
+-- local num_available = FuncGetNewIndex("cfg/fanatec_digits_functions.ecfg")
+-- return value >=100 (0 to 99 are reserved )
+
+--------------------------------------------------------
+functions utilities in global.lua
+--------------------------------------------------------
+
+-- return KERS value in percent
+function GetKersPercent()
+
+-- Init all globals
+function InitGlobals()
+
+-- set RPM threshold value in percentage ( SLIMax Manager 2.1 )
+function SetRPMPercentValue(index, value)
+
+-- set RPM threshold value ( SLIMax Manager 2.1 )
+function SetRPMAbsoluteValue(index, value)
+
+-- get all global preferences set in general_default.sli
+function GetSLIMaxInfo()
+
+-- get cpu ticks
+function GetTicks()
+
+-- reset table function
+function initLedTable(ibl, value)
+
+-- toggle all led state
+function toggleAllLed(val)
+
+-- The following function rounds a number
+-- lua doesn't return the same rounded value as C/C++
+function round(num)
+
+-- The following function calculate hr, mn, sec, hd, ms
+-- param: time in meter/sec
+function timeDispatcher( tt)
+
+-- return speed in KPH or MPH
+function speed(spd, selector)
+
+-- Fahrenheit to Celsius
+function FtoC(f)
+
+-- Celsius to Fahrenheit
+function CtoF(c)
+
+-- Kelvin to Celsius
+function KtoC(k)
+
+-- liters to gallons
+function LtoG(liters)
+
+-- gallons to liters
+function GtoL(gallons)
+
+-- return fuel in liters or gallons
+function GetFuel(fl, selector)
+
+-- return celcius or fahrenheit
+function GetTemp(tmp, selector)
+
+-- set delta time delay in ms
+function SetDeltaTimeDelay(delay)
+
+-- force display text on left or/and right panel during delay in ms
+function LeftRightMessageText(delay, left_text, right_text)
+
+-- return delta time vs best time + sector diff
+-- isRF must be true for rFactor 1 and 2 and clones
+function GetDeltaBestTime(isRF)
+
+-- return delta time vs last time + sector diff
+-- isRF must be true for rFactor 1 and 2 and clones
+function GetDeltaLastTime(isRF)