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.

MSFS Threading Issues with (>A:BUS LOOKUP INDEX) in script

Featured Replies

Hi,

I spent a few hours yesterday on this one. I'm making a profile for the DC Concorde for the streamdeck, and I found that most of the electrical controls need to send a (>A:BUS LOOKUP INDEX, number)  before reading the state of a bus variable. No idea why this is like this, but oh well...

The script was something like this (pretty much exactly as seen in the interior.xml file of the aircraft):

13·17·(>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE)·

13·(>A:BUS·LOOKUP·INDEX,·number)·

(A:BUS·CONNECTION·ON:17,·bool)

(>L:AAO_elecBUS1,·bool) )·// <- this·is·me·trying·to·save·the·output·into·a·var

 

The trouble is that I was getting very inconsistent results with the subsequent read after the lookup. The value would sometimes change, other times it wouldn't (mostly wouldn't), on nearly all of the components I tried (there are a LOT of similar components on the Concorde)

Except for one. The bus tie for bus 3 was always consistently working. Same script as all the others. That got me thinking, that this looks a lot like a race-condition type problem. 

The DC Concorde has a pretty large update loop in its interior code, where it updates a bunch of simvars constantly. I reckon it's all too likely that it is doing a number of bus lookups during that update cycle, and that could be interfering with my attempts to read another bus (from an external process). Because the lookup and the read are not atomic operations, it's very possible that in between the two operations on my script, the sim itself is running updates and changing the bus being looked up.

This is not confirmed in any way... just my theorizing of what could be happening.

So, does anyone know anything about how thread-safe external apps are with MSFS?  (or does anyone know of a way to avoid these problems?)

Thanks in advance!

Cheers

 

  • Commercial Member

These bus lookup things usually don't play well when used over SimConnect, probably because they don't happen "right before" the read out.

I would send scripts of this kind to the sim for processing - keep them in one single line and put (SIMPROC) in front
 

(SIMPROC)·13·17·(>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE)·13·(>A:BUS·LOOKUP·INDEX,·Number)·(A:BUS·CONNECTION·ON:17,·Bool)·(>L:AAO_elecBUS1,·Number)

Edited by Lorby_SI

LORBY-SI

  • Author

oh wow, I didnt' know that was possible! Will definitely try it out. 🙂

Thanks!

  • Author

It works!! Many thanks!! Now I can toggle and read electrical stuff. 🙂

Cheers

Archived

This topic is now archived and is closed to further replies.

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.