Jump to content
Sign in to follow this  
AllanK

Multi position switch

Recommended Posts

I am looking for help setting up a StreamDeck Mobile device. My issue is with controls that have  more than 2 positions. I can use the 2 position control without a problem.

Take the following scenario:

A switch has 3 positions – down, middle and up. I want the StreamDeck Mobile to show the switch in the 3 different positions.

So the logic goes something like this:

If local variable POSITION does not exist

  Create the local variable POSITION and set it to 0

  Display SWITCH_POSTION_MIDDLE.png in StreamDeck Mobile row 2 column 5

Endif

If short press

  If POSITION < 1

    Add 1 to POSITION

    If POSITION = 0

      Display SWITCH_POSTION_MIDDLE.png in StreamDeck Mobile row 2 column 5

    Else

      Display SWITCH_POSTION_TOP.png in StreamDeck Mobile row 2 column 5

    Endif

  Endif

Endif

If long press

  If POSITION > -1

    Subtract 1 from POSITION

    If POSITION = 0

      Display SWITCH_POSTION_MIDDLE.png in StreamDeck Mobile row 2 column 5

    Else

      Display SWITCH_POSTION_BOTTOM.png in StreamDeck Mobile row 2 column 5

    Endif

  Endif

Endif

I bought Axis and Ohs so I could use the StreamDeck Mobile. I also use SPAD.NEXT and the above logic can quickly and easily be done – however SPAD does not support the StreamDeck Mobile.

Any suggestions would be greatly appreciated. If there are suggestions, please use Vbscript

Share this post


Link to post
Share on other sites

You can use VBScript in AAO 4.0. Please refer to the manual.
(But the StreamDeck does not work like your pseudo code suggests - I'll just assume that you know this)

But RPN is shorter and faster. This is a simple script too, using the seq or iseq operator. Example - the fuel selector in the TBM (the _IDX LVar is an invented one, it is only used in this script)
0·1·2·1·(B:FUEL_Selector_1)·(L:KA_TANKSEL_IDX)·4·iseq·(>B:FUEL_Selector_1_Set)·(>L:KA_TANKSEL_IDX)

In the AAO StreamDeck plugin these multi state items are often implemented using SliderGauge Actions. The images of the different states of the switch are arranged in a strip, and the state variable of the switch is used to slide the strip to the correct position.

Make sure to take a look at flightsim dot to, where talented simmers provide ready made StreamDeck profiles and scripts.

 

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

Thanks for your reply.

0·1·2·1·(B:FUEL_Selector_1)·(L:KA_TANKSEL_IDX)·4·iseq·(>B:FUEL_Selector_1_Set)·(>L:KA_TANKSEL_IDX)

This brings me to my first question – what is event B:? And while on the topic I see other possible events are H:, IE; CMD:. – what are they or where are they documented. I have already worked out L:, K: and S:.

 The “iseq” operator advances a variable through a range of values – this is no use for the aircraft I am setting up – an FSLABS plane on P3Dv5. FSLABS make a lot of use of ROTOR_BRAKE so I cannot look for or change the value in a variable – I have to count the number of times the particular command has been issued.

To move the Nav&Logo light switch up I issue the event 72489 (>K:ROTOR_BRAKE) while to move it down the event 72488 (>K:ROTOR_BRAKE).

I guess I will investigate VBScript unless there is another suggestion.

Another question on the SliderGauge. After I add a number of images and Submit, I cannot see the assigned images. Is there any way of seeing them to check if they are valid?

Share this post


Link to post
Share on other sites
4 hours ago, AllanK said:

what is event B:

The code is just an example. BVars, HVars and InputEvents are used in MSFS, and their specification is in the MSFS SDK documentation. CMD and DREF are XPlane assets, they don't officially exist yet. 

4 hours ago, AllanK said:

this is no use for the aircraft I am setting up – an FSLABS plane on P3Dv5

TMBK FSLabs don't have an SDK like PMDG et al. There could/should be an LVar that controls the animation of that knob, maybe check that first. If there is none, then you are out of luck in every way. When you can't query the actual state of the switch, there is no way of advancing it anywhere. You can only blindly use the INC and DEC events, but you cannot display anything on the gauge action when there is no value to examine. 

 

4 hours ago, AllanK said:

Another question on the SliderGauge. After I add a number of images and Submit, I cannot see the assigned images. Is there any way of seeing them to check if they are valid?

Sorry, but I don't understand. How can you "add a number of images" to the Slider action? You can add exactly one image, that's it. The Elgato software does not have the option to show you these assets, except in actual operation on the action button itself. You can look inside the action properties with the Lorby StreamDeck Editor app.

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

As well as P3Dv5 & v6 I also use X-plane 11 & 12. So, your comment "MD and DREF are XPlane assets, they don't officially exist yet" implies they may at some time in the future. I won't hold my breath though.

Ah well - thanks for your responses. My search goes on...

Share this post


Link to post
Share on other sites
7 hours ago, AllanK said:

My search goes on...

Use "Scripting->Read LVars from Sim" to collect all currently existing LVars. Maybe operate the switch(es) that you are interested in first, sometimes the LVars are only visibile after they have been used.

Then you can use "Scripting->Watch simulator variables" to check their values. Open the "Select variable" dialog and use the filter box to search for likely candidates (=that have a name that suggests they might be used for the animation of the switch). Hold down left shift and doubleclick on the variable to add it to the observer window (left shift keeps the selection tree open, otherwise it will close after the double click). Then operate the switch in the cockpit and observe the LVar to see if it changes. If it does you can use it on the slider gauge to slide the image strip up/down (or left/right, whatever you chose to do)

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites
17 hours ago, AllanK said:

So, your comment "MD and DREF are XPlane assets, they don't officially exist yet" implies they may at some time in the future.

There is an XPlane prototype of AAO that you can get by sending your proof of purchase to the support address (last page of the AAO manual)


LORBY-SI

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...