--- mLCDup = 10 mLCDdown = 9 mKeyDelay = 100 -- -- rFactor -- mRFactorLCD_keys = { "H", -- std "J", -- standings "K", -- pit "L", -- vehicle "Y", -- aids "I", -- extra "O" -- race } mRFactorLCD_state = 0 -- -- rFactor2 -- mRFactor2LCD_keys = { "6", -- std "7", -- standings "8", -- pit "9", -- vehicle "]", -- aids "0", -- extra "-", -- race "=" -- penalities } mRFactor2LCD_state = 0 function custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) -- print ( string.format("[%s] %s:%s = %s => %s (%s)", deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) ) if funcIndex == -1 then if ctrlType == 1 and ( ctrlPos == mLCDup or ctrlPos == mLCDdown ) and value == 0 then local Key = nil --if ctrlPos == mLCDup then -- print ( " + LCD up") --else -- print ( " + LCD down") --end local sim = GetContextInfo("simulation") if sim == "rFactor2.exe" or sim == "rFactor.exe" then if sim == "rFactor2.exe" then --print ( " >> rF2 :" , mRFactor2LCD_state) if ctrlPos == mLCDup then mRFactor2LCD_state = mRFactor2LCD_state + 1 elseif ctrlPos == mLCDdown then mRFactor2LCD_state = mRFactor2LCD_state - 1 end mRFactor2LCD_state = mRFactor2LCD_state % table.getn(mRFactor2LCD_keys) --print ( " << rF2 :" , mRFactor2LCD_state) Key = mRFactor2LCD_keys[mRFactor2LCD_state + 1] elseif sim == "rFactor.exe" then --print ( " >> rF :" , mRFactorLCD_state) if ctrlPos == mLCDup then mRFactorLCD_state = mRFactorLCD_state + 1 elseif ctrlPos == mLCDdown then mRFactorLCD_state = mRFactorLCD_state - 1 end mRFactorLCD_state = mRFactorLCD_state % table.getn(mRFactorLCD_keys) --print ( " << rF :" , mRFactorLCD_state) Key = mRFactorLCD_keys[mRFactorLCD_state + 1] end end if Key ~= nil then --print ( "KeyStroke : ", Key ) SetKeystroke(Key, mKeyDelay, "") return 0 end end end return 2 end print ( "gugus> + controls" )