Mt5_Roie Posted November 12, 2012 Posted November 12, 2012 So I have the following in clickable data: elements["PTR-BATTERY-PWR"] = {class = {class_type.TUMB,class_type.TUMB}, hint = _("Battery Power"), device = devices.AVIONICS, action = {device_commands.Button_20, device_commands.Button_21}, arg = {246,246}, arg_value = {-1,1}, arg_lim = {{0,1},{0,1}},updatable = true} I got it by looking at the code from the A-10C. From this code I have button 20 coded to start the power up for the plane, button 21 does the opposite. The problem is that if someone clicks on the switch when it's in the on position using left click - it activates buttons 20 and not 21. If they right click it activates button 21. So I'm trying to make sure that when the switch is in the on positon - power is on, and if its in the off - power is off. So is there a programmatic method of detecting switch state? In this case I'd like to know if PTR-BATTERY-PWR is in 0 or 1 state. Based on that I can program the appropriate code. on a side note, is there a way to force it so the button can't be put down unless it's done via right click? So left click for one way and force right click to turn off? Coder - Oculus Rift Guy - Court Jester
aaron886 Posted November 12, 2012 Posted November 12, 2012 Value. function SetCommand(command,value) if command == 3072 and BattAvail:get() == 1 then if value == 1 and APU_N1:get() == 0.0 then APU_Start() end if value == 0 yadda yadda end Note that SetCommand is passed a command and a value. Do some looking into what value your switches send you.
Mt5_Roie Posted November 13, 2012 Author Posted November 13, 2012 Will test tonight sometime. Thanks again as usual. Quick follow up question - how do set the aircraft to start up with no power on? Seems like everytime I get in the cockpit the hud and electric are already on. Is there a varible in the main LUA to turn everything off to begin with? Coder - Oculus Rift Guy - Court Jester
aaron886 Posted November 13, 2012 Posted November 13, 2012 You create the concept of electrical power yourself.
Mt5_Roie Posted November 13, 2012 Author Posted November 13, 2012 Should have known there wasn't going to be an easy answer. I''ll start working on a electrical system this week. Coder - Oculus Rift Guy - Court Jester
Recommended Posts