xpl_command "ONCE" & "PRESS"?
xpl_command "ONCE" & "PRESS"?
Hi @Corjan
In the wiki page http://siminnovations.com/wiki/index.ph ... pl_command, i can see that
xpl_command() can have additional properties, such as BEGIN and END, but i found out that the commands "ONCE" and "PRESS" can also be sent to XPlane.
I have this particular problem in an instrument, where i can trigger a command via Dataref Editor using the command buttons command press and command once.
I found that the corresponding Dataref (which I cannot modify) correctly toggles from 0 to 1 when using the Command press button, but apparently ther is no such feature in the xpl_command() extra parameters
And ofc the basic xpl_command() without the external parameter doesn't work either.
Using this function without parameters apparently sends the "BEGIN/ONCE/END" sequence, which doesn't work in my case, while the command press apparently sends "BEGIN/ONCE/ONCE/ONCE/END", which as not been implemented in AM
So if it deosn't exist already, having additional parameters to additionnaly send "ONCE" or "BEGIN/ONCE/ONCE/ONCE/END" (for command press) would be apreciated to fully use the Xplane commands
Any input?
Thanks
Jacques
In the wiki page http://siminnovations.com/wiki/index.ph ... pl_command, i can see that
xpl_command() can have additional properties, such as BEGIN and END, but i found out that the commands "ONCE" and "PRESS" can also be sent to XPlane.
I have this particular problem in an instrument, where i can trigger a command via Dataref Editor using the command buttons command press and command once.
I found that the corresponding Dataref (which I cannot modify) correctly toggles from 0 to 1 when using the Command press button, but apparently ther is no such feature in the xpl_command() extra parameters
And ofc the basic xpl_command() without the external parameter doesn't work either.
Using this function without parameters apparently sends the "BEGIN/ONCE/END" sequence, which doesn't work in my case, while the command press apparently sends "BEGIN/ONCE/ONCE/ONCE/END", which as not been implemented in AM
So if it deosn't exist already, having additional parameters to additionnaly send "ONCE" or "BEGIN/ONCE/ONCE/ONCE/END" (for command press) would be apreciated to fully use the Xplane commands
Any input?
Thanks
Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
Re: xpl_command "ONCE" & "PRESS"?
I answered myself, as I found after LOTS of trial and error a workaround kinda.
When one uses a "BEGIN" with the 1 parameter , AM sends to Xplane "BEGIN" and some "ONCE" (every frame?) as long as it doesn't sends an "END" function (0 parameter).
So to emulate a "COMMAND PRESS" function that is needed with some xpl_commands, one needs to introduce a slight delay after the "BEGIN" to let AM send at least two or more "ONCE", then send an "END" to close the command.
Tricky to say the least, and sheer luck I could find a workaround..
Another method without timer() is using the button_add(), but it needs a physical or a virtual button of some sort
@Corjan , it would be wonderful if you could revisit the xpl_command(), with and additional parameter to differentiate between a « Command once » and a « Command press ».
Thanks
Jacques
When one uses a "BEGIN" with the 1 parameter , AM sends to Xplane "BEGIN" and some "ONCE" (every frame?) as long as it doesn't sends an "END" function (0 parameter).
So to emulate a "COMMAND PRESS" function that is needed with some xpl_commands, one needs to introduce a slight delay after the "BEGIN" to let AM send at least two or more "ONCE", then send an "END" to close the command.
Tricky to say the least, and sheer luck I could find a workaround..
Code: Select all
---------------------------------
-- xpl_command COMMAND PRESS trick
---------------------------------
xpl_command("cjs/texanii/commands/rmu_button_dmeh",1)-- "BEGIN is sent then "ONCE" every frame by AM, until "END" is sent
timer_start(100,nil,function()
xpl_command("cjs/texanii/commands/rmu_button_dmeh",0)-- after a slight delay of 100msec (adjust to what is needed) send an "END" command to stop
end)
Another method without timer() is using the button_add(), but it needs a physical or a virtual button of some sort
Code: Select all
function buttonDMEHpressed()
xpl_command("cjs/texanii/commands/rmu_button_dmeh",1)-- "BEGIN is sent then "ONCE" every frame by AM, until "END" is sent
end
function buttonDMEHreleased()
xpl_command("cjs/texanii/commands/rmu_button_dmeh",0)-- sendS an "END" command to stop
end
button_add("button_DMEH_released.png","button_DMEH_pressed.png",257,1244,111,63, buttonDMEHpressed,buttonDMEHreleased)
Thanks
Jacques
Last edited by JackZ on Sat Jul 24, 2021 11:19 am, edited 1 time in total.
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: xpl_command "ONCE" & "PRESS"?
Jacques,
You want it to be like si_command()
I thought that it used to work with xpl_command(). Maybe I am wrong
http://siminnovations.com/wiki/index.ph ... Si_command
Keith
You want it to be like si_command()
I thought that it used to work with xpl_command(). Maybe I am wrong
http://siminnovations.com/wiki/index.ph ... Si_command
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: xpl_command "ONCE" & "PRESS"?
@Keith Baxter
exactly.
But in xpl_command(), the only two parameters available are 1 for "BEGIN" (and I found out that it continuously fires "ONCE" after the initial "BEGIN"), and 0 for "END" (that fires only "END"). If I try to replace the integer parameter by those string, Lua throws an error
exactly.
But in xpl_command(), the only two parameters available are 1 for "BEGIN" (and I found out that it continuously fires "ONCE" after the initial "BEGIN"), and 0 for "END" (that fires only "END"). If I try to replace the integer parameter by those string, Lua throws an error
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
Re: xpl_command "ONCE" & "PRESS"?
@Ralph At least modify the Wiki page with the workaround, as the actual « BEGIN » and « END » example are kinda useless at the moment without an actual way to use them?
Thanks
Jacques
Thanks
Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
Re: xpl_command "ONCE" & "PRESS"?
Hi,
Will have to look closely how it is implemented exactly, has been a while.
Will get back to you next week,
Corjan
Will have to look closely how it is implemented exactly, has been a while.
Will get back to you next week,
Corjan
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: xpl_command "ONCE" & "PRESS"?
@Corjan
Please see what you can do for us.
I am on a different project to Jacques and have the same request.
Keith
Please see what you can do for us.
I am on a different project to Jacques and have the same request.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: xpl_command "ONCE" & "PRESS"?
@Keith Baxter
You can always use the workaround I exposed in my previous posts, to emulate the Command Pressed effect:
Either:
-a button with a Xpl_command BEGIN on pressed() state and an xpl_command END on the released state
or
- send a BEGIN normally, followed by the use of a timer to trigger the END after a slight delay (200 msec seems to work for me).
Jacques
You can always use the workaround I exposed in my previous posts, to emulate the Command Pressed effect:
Either:
-a button with a Xpl_command BEGIN on pressed() state and an xpl_command END on the released state
or
- send a BEGIN normally, followed by the use of a timer to trigger the END after a slight delay (200 msec seems to work for me).
Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: xpl_command "ONCE" & "PRESS"?
JacquesJackZ wrote: ↑Mon Jul 26, 2021 3:59 pm @Keith Baxter
You can always use the workaround I exposed in my previous posts, to emulate the Command Pressed effect:
Either:
-a button with a Xpl_command BEGIN on pressed() state and an xpl_command END on the released state
or
- send a BEGIN normally, followed by the use of a timer to trigger the END after a slight delay (200 msec seems to work for me).
Jacques
100s
Not so much of a HACK if the the xpl_command() had a pressed feature.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: xpl_command "ONCE" & "PRESS"?
Indeed, hence my initial request!
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ