Converting a switch input to a toggle input

Announcements, questions
Post Reply
fgdsu67
Posts: 2
Joined: 19 Apr 2020, 01:46

Converting a switch input to a toggle input

Post by fgdsu67 » 19 Apr 2020, 01:58

Good evening,

I am trying to make a luamacros script for my ToLiss A321 on XP11, and I am stuck on one issue :

The Push and Pull functions are unfortunately "single channel" commands, and as my keyboard doesn't have an infinite key number I would like to assign both functions to one key. I found in the datarefs that we can monitor the status of the function (Managed or Selected), and I tried this script part :

.....
elseif (lmc_get_xpl_variable('AirbusFBW/SPDmanaged', 0) and button == 85) then lmc_xpl_command('AirbusFBW/PushSPDSel')
elseif (lmc_get_xpl_variable('AirbusFBW/SPDmanaged', 1) and button == 85) then lmc_xpl_command('AirbusFBW/PullSPDSel')
.....

However it always takes into account the first line, without checking the state of SPDmanaged. I'm sorry but I'm new to Lua programming :roll: :D
Is there any way you could help me on this matter please ?

With all my best regards

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

Re: Converting a switch input to a toggle input

Post by admin » 20 Apr 2020, 07:24

lmc_get_xpl_variable takes single argument (data ref name) and return its value. Try lmc_get_xpl_variable('AirbusFBW/SPDmanaged') == 0 and...
Petr Medek
LUAmacros author

fgdsu67
Posts: 2
Joined: 19 Apr 2020, 01:46

Re: Converting a switch input to a toggle input

Post by fgdsu67 » 20 Apr 2020, 21:54

Thank you very much for your answer, it worked perfectly !!!! :D :D :D :D :D :D

Post Reply