Page 1 of 1

Converting a switch input to a toggle input

Posted: 19 Apr 2020, 01:58
by fgdsu67
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

Re: Converting a switch input to a toggle input

Posted: 20 Apr 2020, 07:24
by admin
lmc_get_xpl_variable takes single argument (data ref name) and return its value. Try lmc_get_xpl_variable('AirbusFBW/SPDmanaged') == 0 and...

Re: Converting a switch input to a toggle input

Posted: 20 Apr 2020, 21:54
by fgdsu67
Thank you very much for your answer, it worked perfectly !!!! :D :D :D :D :D :D