Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Reading from a Script to detect vars (Black Square Starship)

Featured Replies

In the Black Square Starship, there are 4 vertical speed modes: IAS, IASP, DES and V/S.

The developer kindly shared their RPN code used on the buttons in the aircraft. I have V/S working but not IAS (IASP) and DES.

Quote

 

IAS Profile:
(A:AUTOPILOT FLIGHT LEVEL CHANGE, bool) (L:var_iasHoldMode, bool) ! and (A:INDICATED ALTITUDE:1, FEET) 250 - (A:AUTOPILOT ALTITUDE LOCK VAR:1, FEET) < and

Descend:
(A:AUTOPILOT FLIGHT LEVEL CHANGE, bool) (L:var_iasHoldMode, bool) ! and (A:INDICATED ALTITUDE:1, FEET) 250 + (A:AUTOPILOT ALTITUDE LOCK VAR:1, FEET) < and

Airspeed hold:
(A:AUTOPILOT AIRSPEED HOLD, bool)
(A:AUTOPILOT FLIGHT LEVEL CHANGE, bool) (L:var_iasHoldMode, bool) and
or

 

I am making a Stream Deck profile for the Starship and have created working dials for Airspeed and V/S but cannot figure out how to read the 'situation' to turn a button on or off.

Using AUTOPILOT FLIGHT LEVEL CHANGE, bool (for example), turns on both buttons as there is no 'check' as per script above.

I normally read the SimVars such as A:AUTOPILOT VERTICAL HOLD, Bool to get a response but this doesn't work in the Starship for IAS and DES mode.

I have tried adding the code above as an S: Script to the entry field but it doesn't work and I cannot figure out why and kindly ask for your help.

1.jpg

Finally, when rotating the dials, sometimes the numbers changes (they always change in the aircraft) but they often 'stick' on the Stream Deck and don't update, any idea why?

Example:
2.jpg

Edited by toby23

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11
Link to my: Dynamic Flight Dispatch Tool

  • Commercial Member
2 hours ago, toby23 said:

any idea why?

Maybe you are reading from the wrong AVar? The autopilot variables in MSFS are all indexed, with the index denoting the active autopilot "slot".

(A:AUTOPILOT ALTITUDE LOCK VAR, FEET)
is the default (no idea which index that is)

The actual values are then indexed per slot:

(A:AUTOPILOT ALTITUDE LOCK VAR:0, FEET)

(A:AUTOPILOT ALTITUDE LOCK VAR:1, FEET)

(A:AUTOPILOT ALTITUDE LOCK VAR:2, FEET)

(A:AUTOPILOT ALTITUDE LOCK VAR:3, FEET)

I think that to get the correct value, you have to supply the correct "slot" (the code snippets above suggest index :1). Without the index you get some kind of default.

LORBY-SI

  • Commercial Member
2 hours ago, toby23 said:

I have tried adding the code above as an S: Script to the entry field but it doesn't work and I cannot figure out why and kindly ask for your help.

Maybe it just doesn't work as a "Toggle" Action. Did you try any of the others?

LORBY-SI

  • Author
14 minutes ago, Lorby_SI said:

Maybe it just doesn't work as a "Toggle" Action. Did you try any of the others?

I don't understand what you mean by "others"?
If I enter this script in the "Read" field, it should test which mode is active and return either a 0 or 1,

This is the script: 

Quote

(A:AUTOPILOT FLIGHT LEVEL CHANGE, bool) (L:var_iasHoldMode, bool) ! and (A:INDICATED ALTITUDE:1, FEET) 250 + (A:AUTOPILOT ALTITUDE LOCK VAR:1, FEET) < and

Can you see why it wouldn't work?

 

1.jpg

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11
Link to my: Dynamic Flight Dispatch Tool

  • Commercial Member
3 hours ago, toby23 said:

ask for your help.

I would use the LVars that control the emissive properties of the green triangles above the buttons.

(L:var_ApDescend_EM_L_readonly, bool)

(L:var_ApSpeedProfile_EM_L_readonly, bool)

(L:var_ApAltitude_EM_L_readonly, bool)

etc.

in AAO,

  • execute "Scripting->Read LVars from sim" - let it finish.
  • open "Scripting->Watch simulator variables"
  • click "Select variable"
  • when the dialog opens, immediately start typing "readonly", then press "Enter".
  • Go to the tab "LVars" at the top and open the list "Local simulator variables"
    This now contains all variables that (I think) control the various LEDs in the cockpit
  • Hold down the left Shift key and doubleklick on every variable that you are interested in. This will bring them over into the observer window
  • Now operate the controls in the cockpit, make sure that the variables change their value as expected
  • Click on the variable you want once, that brings it down into the input field. From there you can copy&paste it over to the StreamDeck Action,.

LORBY-SI

  • Commercial Member
3 minutes ago, toby23 said:

Can you see why it wouldn't work?

No. Other than this is a very complex script to do a very simple thing. This doesn't feel right. The question is what the return value of this script actually is. Maybe you just have the assignment backwards (=wrong ON value)?

LORBY-SI

  • Author

I'll give that a try, thank you.

Below is a screenshot of part of my conversation with the developer from Black Square, that hopefully helps explain this in more detail.


2.jpg

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11
Link to my: Dynamic Flight Dispatch Tool

  • Author
Just now, Lorby_SI said:

Sorry, but - It is working for me... I'm using the script exactly as you posted it.

Still seems to complicated to me.

Would you mind showing me a screenshot of how you entered the code in Stream Deck, or did you test directly in AAO?

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11
Link to my: Dynamic Flight Dispatch Tool

  • Commercial Member
3 minutes ago, toby23 said:

Below is a screenshot of part of my conversation with the developer from Black Square, that hopefully helps explain this in more detail.

Not really that helpful for your purposes, I'm afraid.

When you see something light up or move in the cockpit, in most cases there is a simple LVar controlling it (because that is what they are for). That is what you need to hunt for first, before looking at scripts.

I always use the MSFS developer mode for this (in this case too)

LORBY-SI

  • Author
1 hour ago, Lorby_SI said:

I would use the LVars that control the emissive properties of the green triangles above the buttons.

 

Great idea, thank you for showing me how to do this. It works well.

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11
Link to my: Dynamic Flight Dispatch Tool

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.