• 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.

Determining FS Version via XML

Messages
1,564
Country
thailand
Is there an easy XML way to determine whether the sim is FS9 or FSX?

I'll try this using search results of an FSX-only gps variable, but I wonder if there is a simpler way that I am overlooking? Perhaps an A:Var syntax unique to one of the sims?

Just curious.

Thx,

Bob
 
Bob,

A possible method is to use the fact that FS9 does not recognize FSX Aces style code .
Create 2 instruments , one in FSX code , the other in FS9 code.

The FS9 is your primary instrument ,
create a L:Var in it that requires a simple action that can only be done in the FSX instrument .

If you are in FSX that code will be executed and the result will return to the FS9 coded instrument
indicating that you are in FSX.
If not executed you are in FS9 .

Cheers
Karol
 
I immediately thought of throwing an FSX only K:Event and having an <On Event> block catch it.
If you don't get satisfactory results with any of the stuff mentioned, it is a small matter to retrieve all of the version information with a C gauge and post it to a group of L:Vars. Let me know if you want such a thing.

Doug
 
I don't need to test for the version, but I use this code that outputs the fuel density, depending on which version the user is running. It uses the fact that the A: fuel density variable uses different units in FS9 and FSX. I'm sure you could modify it to detect the version instead. It checks to see if the variable is outputting 6 or 6.7 (FS9) or something bizarre (FSX; 1583 for piston engines/avgas).

Code:
<!--  Determine fuel density for FS2004 (pounds per gallon) or FSX (pounds) ( 10 * near 10 / gives exactly 6.7 lbs/gallon) -->
    <Macro Name="Fuel_Weight"> (A:Fuel weight per gallon, pounds per gallon) 6 ==
(A:Fuel weight per gallon, pounds per gallon)  10 * near 10 / 6.7 == ||
if{ (A:Fuel weight per gallon, pounds per gallon) }
els{ (A:Fuel weight per gallon, pounds)  } </Macro>

Hope this helps,
 
Last edited:
Thanks! All will work but I believe Tom's suggestion of exploiting the Units difference between the two sims in (A:Fuel weight per gallon, pounds per gallon) is the simplest for my use. In this case, a simple Panel Refresh gauge. Bob

Code:
<Gauge Name="Panel Reload" Version="1.0" >
  <Image Name="Reload.bmp" Bright="Yes" ImageSizes="20,20,0,0"/>
  <Mouse>
    <Area Left="0" Top="0" Width="20" Height="20">
    <Cursor Type="Hand"/>
      <Click>
        (A:Fuel weight per gallon, pounds per gallon) 0 ==
          if{ (>K:RELOAD_USER_AIRCRAFT) }  <!-- FSX -->
          els{ (>K:RELOAD_PANELS) }        <!-- FS9 -->
      </Click>
    </Area>
  </Mouse>
</Gauge>
 
Last edited:
Glad you found it useful. :)

And your code is much better than mine; I'll be changing that.
 
UPDATE: I misspoke when I said that the FSX units in FS9 give a zero result - it gives a result like 1583 for piston engine avgas. So my code will correctly detect the sim, but testing for 0 will not. I've updated the info in my post.

Sorry for the confusion,
 
Interesting is that the Prepar3D SDK v2.2 has both commands listed:
RELOAD_PANELS
RELOAD_USER_AIRCRAFT
 
Interesting is that the Prepar3D SDK v2.2 has both commands listed:
RELOAD_PANELS
RELOAD_USER_AIRCRAFT

... as do the online FSX ESP SDK and the FS9 SDK. It's just that (>K:RELOAD_PANELS) doesn't work in FSX the same way it used to in FS9. Guess the same will be true for P3D 2.2? Not sure, I don't have it yet.

I updated your Refreshing Panels in FS9 wiki to include the FSX related script example above, but I guess I need to check out what Tom just said and see what revision may be needed.

Bob
 
UPDATE: I misspoke when I said that the FSX units in FS9 give a zero result - it gives a result like 1583 for piston engine avgas. So my code will correctly detect the sim, but testing for 0 will not. I've updated the info in my post.

Sorry for the confusion,

Hi Tom,

I will look into this a little further, but when I run FSX Acceleration (FSX Deluxe 10.0.61637.0, FSX-Xpack.20070926-1421) the system variable (A:Fuel weight per gallon, pounds per gallon) always returns 0.0 for jets (A321) and avgas aircraft (Cessna 421, Extra 300s, de Havilland Beaver). For an avgas plane, (A:Fuel weight per gallon, pounds) returns 6.0. For a jet, (A:Fuel weight per gallon, pounds) returns 6.7.

When I test that variable in FS9 (v9.1 build 40901.01) on the Cessna 421 (avgas), (A:Fuel weight per gallon, pounds per gallon) returns 6.0, and (A:Fuel weight per gallon, pounds) returns 1585.0323.
In FS9 for a jet, (A:Fuel weight per gallon, pounds per gallon) returns 6.7, and (A:Fuel weight per gallon, pounds) returns 1769.9527.

So, it still seems to me that (A:Fuel weight per gallon, pounds per gallon) = 0 can be used to point to FSX. But if you are getting different results, then maybe I am missing something here ..... hmm

Bob
 
Last edited:
Hi,

No, I was looking in FS9. So if you test for pounds per gallon = 0 then it appears all is well. Just don't try testing pounds = 0 in FS9. :)

Thanks,
 
Back
Top