Using these buttons is pretty simple. As you found out already, the relevant call is this: Code: extensions.ui_simplePowertrainControl.setButton("my_id", "UI Name", "powertrain_jato", "0072bc", 1, "print('button clicked!')") Feel free to look at the relevant extension code to get a better idea of what it does. Here's the params explained: a unique identifier, make sure you are not using something existing the tool tip when hovering the button an icon to be displayed, can be left empty if you wish the color of the progress ring if you want to use that the value of the progress ring from 1 (full ring) to 0 (no ring) the vlua code executed within the current vehicle when the button is clicked You need to call this method any time you want to change something about the button and when the vehicle changes. The second part is taken care of by the updateSimpleControlButtons method if set up correctly like in official content. Updating the button when its data changes is up to you though. Please make sure to not just blindly update it every frame, that's not very efficient.
I'm running into a problem with LUA itself, I defined JetsEnable as 1 multiple times here Code: local M = {} M.type = "auxiliary" M.defaultOrder = 500 local rpm = 0 local outputmin = 0 local outputmax = 1 local thrust = 0 local indicator = 1 local JetsEnable = 1 electrics.values.Jet = 0 local lastFuelRatio = 1 local function init(jbeamData) JetsEnable = 1 if JetsEnable ~= nil then JetsEnable = 1 end min = jbeamData.min or 4000 max = jbeamData.max or 6000 end local function updateSimpleControlButtons() extensions.ui_simplePowertrainControl.setButton("jato_" .. M.name, "Jets", "powertrain_jato", "0072bc", JetsEnable, "JetsEnable = 1 - (JetsEnable)") end local function rpmthrust(rpm, min, max, outputmin, outputmax) local output = (rpm - min) / (max - min) * (outputmax - outputmin) + outputmin if output > outputmax then return outputmax else return output end end local function updateGFX(dt) rpm = electrics.values.rpm if rpm >= min then thrust = rpmthrust(rpm, min, max, outputmin, outputmax) indicator = thrust else thrust = 0 indicator = 0.01 end electrics.values.Jet = thrust * electrics.values.throttle_input * JetsEnable updateSimpleControlButtons() end M.updateGFX = updateGFX M.init = init M.updateSimpleControlButtons = updateSimpleControlButtons return M yet it keeps telling me that it is a nil value?
Since I didn't get a response, I used the good ol' f*ck around and find out technique, and realized that it didn't work because the int was defined as a local, and the function was either unable to access or change it. thank you to both @Diamondback and @Agent_Y for helping me and whoever finds this thread thru google search, the problem is now resolved