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.

Read LVars from sim fails

Featured Replies

  • Commercial Member
53 minutes ago, joker20001911 said:

No problem. Yes it seems that way. The read variable for the cabin only seems to work if a cabin light is on, not when you flip the cabin switch. Hmm

OK, I get it now. There problem here is, that reading the value like I did above actually doesn't work like that. This is something that only the sim can do internally.

You will have to create a script like this:
Group: Scripts (or whatever you want)
Title: UpdateBus1516
Code:
(SIMPROC) 16 (>A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:15, Bool) (>L:BusCon1615, Number)

Then, on the StreamDeck, you establish this as an autoscript (at the bottom of the page) "Scripts-UpdateBus1516"
and as the read variable you use "L:" and "BusCon1615, Number" in the box, ON Value = 1
I am using the "Toggle" SD Action.

What is happening now is that the SD action directs the sim to write the desired value into an LVar, which can then be read from anywhere.

Yes, this is more involved than usual. Normally developers provide LVars to read the switch position. That you stumbled right into the mess of the electrical bus lookup was just bad luck, normally the process is not that involved.
 

Edited by Lorby_SI

LORBY-SI

14 minutes ago, Lorby_SI said:

OK, I get it now. There problem here is, that reading the value like I did above actually doesn't work like that. This is something that only the sim can do internally.

You will have to create a script like this:
Group: Scripts (or whatever you want)
Title: UpdateBus1516
Code:
(SIMPROC) 16 (>A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:15, Bool) (>L:BusCon1615, Number)

Then, on the StreamDeck, you establish this as an autoscript (at the bottom of the page) "Scripts-UpdateBus1516"
and as the read variable you use "L:" and "BusCon1615, Number" in the box, ON Value = 1
I am using the "Toggle" SD Action.

What is happening now is that the SD action directs the sim to write the desired value into an LVar, which can then be read from anywhere.

Yes, this is more involved than usual. Normally developers provide LVars to read the switch position. That you stumbled right into the mess of the electrical bus lookup was just bad luck, normally the process is not that involved.
 

This definitely worked!  I never would have known that.  Thank you so much for your help.  I will try to do the same for the access button to have it change state on the SD too.  But pushing the button on SD does make it work in game.  Thank you again!

  • Commercial Member

Btw. when you know that you will always only be using the StreamDeck and not click on the switch from within the cockpit, you could wrap it into one single line of code that you assign to the Down event:

(SIMPROC) 15 16 (>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) 16 (>A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:15, Bool) (>L:BusCon1615, Number)

This would toggle the bus connection and immediately write the value into the LVar, that you can then read with the action.

You don't need an autoscript with this, but it will not show the state of the switch correctly when you click on the switch in the cockpit with the mouse.

LORBY-SI

  • Commercial Member
5 minutes ago, joker20001911 said:

I will try to do the same for the access button to have it change state on the SD too. 

That is just an LVar. No way near as complicated. I posted that somewhere above.

Read variable is type "L" and "var_AccessLights_Button, Number" goes into the box. ON value is "1"

Edited by Lorby_SI

LORBY-SI

4 minutes ago, Lorby_SI said:

Btw. when you know that you will always only be using the StreamDeck and not click on the switch from within the cockpit, you could wrap it into one single line of code that you assign to the Down event:


(SIMPROC) 15 16 (>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) 16 (>A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:15, Bool) (>L:BusCon1615, Number)

This would toggle the bus connection and immediately write the value into the LVar, that you can then read with the action.

You don't need an autoscript with this, but it will not show the state of the switch correctly when you click on the switch in the cockpit with the mouse.

I do like to click the switches now and then.  I appreciate that code and may use in the future if I will only be using SD.  

Alright.  Thank you again for the help!  Now on to the avionics switches.  LOL!  Should I create a new topic if I can't find it within a search on this site for additional assistance?

  • Commercial Member
Just now, joker20001911 said:

Alright.  Thank you again for the help!  Now on to the avionics switches.  LOL!  Should I create a new topic if I can't find it within a search on this site for additional assistance?

The procedure is always the same. 

1. Look for a ready made scripts package or SD profile for this aircraft on flightsim.to

2. If you don't find any, or want to do it yourself,
- Maybe try the default simulator events first
- then/or look for an MSFS Input Event in the event group of that name in the usual event treelist in AAO.
- then/or use the MSFS developer mode (Tools->Behaviors, "click back into the sim, hover the mouse over the button/switch/lever and press Ctrl-G") to find out how a switch is operated and what the variable is that controls its animation. Replicate that in AAO/on the StreamDeck

LORBY-SI

1 minute ago, Lorby_SI said:

The creator of that profile says to do this

Import the AAO script AxisAndOhsScripts_BKSQ_TBM.xml according to the AAO manual

how do I do that!  I actually saw that one but didn’t know how to import them and I did read the manual but may have missed it

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.