April 25, 20224 yr 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
April 25, 20224 yr 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 April 25, 20224 yr by Lorby_SI LORBY-SI
April 29, 20224 yr Author oh wow, I didnt' know that was possible! Will definitely try it out. 🙂 Thanks!
April 29, 20224 yr 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.