Page 1 of 1

Mechanical Push Button in Xplane Cockpit mapping

Posted: 25 Dec 2018, 00:15
by russell458
Having trouble with my FF757.. Because the datarefs are a little different from that of the regular Xplane ones that "toggle" a switch.

757 dataref for a Logo button anim/52/buttom
When the logo button is not depressed and the light is off the dataref is
"elseif (button == string.byte('5')) then lmc_set_xpl_variable('anim/52/button', 0) "

When the logo push button is depressed, the logo lights turn on and the dataref is
elseif (button == string.byte('5')) then lmc_set_xpl_variable('anim/52/button', 1)

How could I program this, so that I can hit string.byte('5')) over again and it will turn the logo lights off, or change the dataref from anim/52/button', 1 back to anim/52/button', 0.

Thanks alot for the help.

Merry christmas!

Rich

Re: Mechanical Push Button in Xplane Cockpit mapping

Posted: 25 Dec 2018, 22:40
by admin
Solution 1) remember the "state" in some lua variable and based on this send the oposit
Solution 2) instead of remebering the value in lua var, read the dataref first on every (appropriate) key press and send the other value

Re: Mechanical Push Button in Xplane Cockpit mapping

Posted: 26 Dec 2018, 14:06
by russell458
Good day thank you for the response.
I have tried using xpl_get but I really am not experienced enough in lua. I mapped datarefs that simply toggle the switch on and off with a single button, but im lucky i got that far.

Would you kindly be able to write one of your solutions out for me, with that I will be able to use it again and again with all switches similar.

Thanks alot, happy holidays