Mechanical Push Button in Xplane Cockpit mapping

Announcements, questions
Post Reply
russell458
Posts: 9
Joined: 23 Mar 2018, 04:14

Mechanical Push Button in Xplane Cockpit mapping

Post by russell458 » 25 Dec 2018, 00:15

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

admin
Site Admin
Posts: 605
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Mechanical Push Button in Xplane Cockpit mapping

Post by admin » 25 Dec 2018, 22:40

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
Petr Medek
LUAmacros author

russell458
Posts: 9
Joined: 23 Mar 2018, 04:14

Re: Mechanical Push Button in Xplane Cockpit mapping

Post by russell458 » 26 Dec 2018, 14:06

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

Post Reply