xpl_command "ONCE" & "PRESS"?

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Message
Author
User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: xpl_command "ONCE" & "PRESS"?

#21 Post by Sling »

I think the confusion has come about because dataref tool now has a press button where as in previous versions it had the separate BEGIN, ONCE & END buttons for each command. All the press does is send the BEGIN, ONCE, END sequence. Jacques posted the detail earlier in this thread. If you want to simulate a PRESS you just do the sequence. If PRESS were implemented in AM then it would be a simpler way of achieving the same. A useful addition i think.

Tony

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: xpl_command "ONCE" & "PRESS"?

#22 Post by Corjan »

Hi,


You are right, it is the dataref tool causing the confusion. X-plane has no notion of a press command.

It is also very weird to me that this would be helpfull. Isn't a simple ONCE command sufficient when you have a button?


Corjan

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: xpl_command "ONCE" & "PRESS"?

#23 Post by Corjan »

Hi,


Too get rid of all the confusion, I had a look at the dataref tool code to see what it does exactly:

Code: Select all

    std::shared_ptr<Widget11Button> once_button = std::make_shared<Widget11Button>();
    once_button->setLabel("Command once");
    once_button->setAction([crr]() {
        crr->commandOnce();
    });
    

    std::shared_ptr<Widget11Button> press_button = std::make_shared<Widget11Button>();
    press_button->setLabel("Command press");
    press_button->setPushAction([crr](bool is_down) {
        if(is_down) {
            crr->commandBegin();
        } else {
            crr->commandEnd();
        }
    });

So internally also uses BEGIN, ONCE and END commands. Same stuff already supported by X-plane and AM.

Corjan

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: xpl_command "ONCE" & "PRESS"?

#24 Post by JackZ »

So internally also uses BEGIN, ONCE and END commands. Same stuff already supported by X-plane and AM.
@Corjan
Well actually not at the moment, the ONCE command is not implemented in AM as a parameter, only BEGIN and END are available from what I tested and also the Wiki says.

The standard AM command without any parameter sends a BEGIN ONCE END sequence which is interpreted by XPlane as a single button push.

To achieve the equivalent of press, I found out that AT LEAST two ONCE commands with some time in between need to be issued in sequence between the BEGIN and the END for the command to be interpreted as a Press by XPlane.

Some addon only react to button press command (understand maintained), hence my initial demand.
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: xpl_command "ONCE" & "PRESS"?

#25 Post by Corjan »

Hi,


It might be that the aircraft model requires a special combo and timing.
But normally a ‘press’ is just an ONCE command.

In AM, if you do a ‘xpl_command’ without any additional arguments, an ONCE command call will be issued. So ONCE is also supported.


Corjan

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: xpl_command "ONCE" & "PRESS"?

#26 Post by Corjan »

JackZ wrote: Sat Aug 07, 2021 3:31 pm To achieve the equivalent of press, I found out that AT LEAST two ONCE commands with some time in between need to be issued in sequence between the BEGIN and the END for the command to be interpreted as a Press by XPlane.
The dataref tool maps the BEGIN when you start pressing the GUI button, and an END when you release it. This naturally creates some delay, based on how long you hold down the mouse button. The aircraft model might like that, and process it the way you expect.


Corjan

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: xpl_command "ONCE" & "PRESS"?

#27 Post by Keith Baxter »

Hi,

From my side, what we now have is as expected, and a clearly explained in the API.
Thumbs up from me.


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 

Post Reply