• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX FSX ignores events at flight loading .....

rcbarend

Resource contributor
Messages
435
Country
netherlands
Hi,

Maybe the description below is of some help to people that create XML gauges.

In many of my gauges, I need to initialise certain aircraft functions to a defined value.
The simplest way is to issue events at the first gauge schedule; however, in many cases FSX simply ignores such events then.

My environment: Windows7-64bit (No SSD), FSX-Accelleration (but the same problem occurs with e.g. FS9 on WindowsXP).
For the test, I use a saved flight and want to set PropPitch to an initial value (20 percent).
An XML gauge in the panel.cfg includes the following code:

Code:
<Update Hidden="Yes">
  (L:VertInit,number) d ++ (&gt;L:VertInit,number) 0 ==
  if{ 0.20 16384 * (&gt;K:PROP_PITCH_SET) }
</Update>

Meaning that the PropPitch event is given once, at the first schedule of the gauge.
The problem: FSX ignores this event in many cases, depending on how you load, Windows cache, etc.....
In fact, the code above ONLY works (on my PC), when I load the saved flight, let it stabilize, and then reload the aircraft.
Some examples to get it working (exact values are specific for my PC and this particular flight).
- After a rebooted PC, start FSX the first time and load the flight the first time: the value "0" in the code example needs to be at least "140" (140 / 18.2 = 7.6 sec after gauge load) for FSX to see/execute the event.
- When starting FSX again, and loading the flight the first time, the value needs to be at least "45".
- When the flight is loaded, and I reload the flight, the value needs to be at least "35".

So the "deaf time for events" strongly depends on how/when you load, cache, probably PC-performance, where the gauge is defined in the panel.cfg, etc .....
I don't know if this is specific for events given in XML code, or if it also applies to gauges programmed in C/C++/C# ..... But I'm curious to know....
(Please, let's not start another pro/con XML programming debate here .. LoL)

The solution I use in my XML gauges that rely on proper aircraft-initialisation:
- After gauge load, give a specific event at every gauge schedule.
- Await the functional initialisation, until the result of the event is actually reflected in the corresponding XML variable.

As a generic solution, I use an initialisation gauge with the SeatBelt function:
Code:
<Update Frequency="2"/>
<Element>
  <Select>
  <Value>
  (L:RCB_FSX_INIT,bool) !
  if{
  (&gt;K:CABIN_SEATBELTS_ALERT_SWITCH_TOGGLE)
  (A:CABIN SEATBELTS ALERT SWITCH,bool)
  if{ 1 (&gt;L:RCB_FSX_INIT,bool) }
  }
  </Value>
  </Select>
</Element>
Just as example, but this has never failed me; meaning that I'm sure that FSX is ready to receive/execute events at the shortest possible time depending on how the aircraft/flight is loaded ..

Hope this helps other designers ....

Best regards, Rob
 
Bill gave me this code a while back for loading events action after reloading aircraft. This way reloading aircraft or saved flights are always in sink.

Code:
<Element>
<Value>
(L:Firstload.bool) !
if{
1 (>K:CABIN_SEATBELTS_ALERT_SWITCH_TOGGLE)
}
1 (>L:Firstload.bool)
}
</Value>
</Select>
</Element>
 
Rob, that is an clever solution to ensure that your script actually completes it's job. Thanks for sharing! :coffee:
 
Back
Top