• 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 Update Section Not Working?

Messages
159
Country
us-colorado
In the simplified test code segment below, the displayed value is 0. However, if I replace (L:CrossWindVel, knots) in the GaugeString line with a 3, I get a reasonable non-zero value displayed. So it seems using the update section to put the value of 3 into the L:CrossWindVel Lvar as a test case is not working for some reason. I have tried everything I can think of without success. What am I missing?
Thx,
Al

Code:
<Update>             
      3(>L:CrossWindVel, knots)  
</Update>

<!-- Display wind correction angle -->
    <Element id="Element">
                <FloatPosition>90.000,43.000</FloatPosition>
               <Visibility> (A:AIRSPEED TRUE, knots) ) 0 >  </Visibility>
               <GaugeText id="GaugeText">
               <FontColor>#9acd32</FontColor>  
                   <FontFace>glassga</FontFace>
                    <FontHeight>20</FontHeight>      
                            <GaugeString>
                                WCA%((L:DirMode,bool) 0 == ) %{if}  %((L:CrossWindVel, knots) (A:AIRSPEED TRUE, knots) / asin  180 *  pi / near)%!+2d!°  %{end}
                            </GaugeString>
                            <Length>6</Length>
                    <Size>100,25</Size>
                    <Transparent>True</Transparent>
                    <VerticalAlign>CENTER</VerticalAlign>
                    <HorizontalAlign>LEFT</HorizontalAlign>
                </GaugeText>
            </Element>
 
Have you tried putting a space between the "3" and the "("?

Also, this
Code:
(A:AIRSPEED TRUE, knots) ) 0 >
should be:
Code:
(A:AIRSPEED TRUE, knots) 0 >

You might also want to try changing the > into &gt; but that depends on the type of xml version you're running.
 
Vitus,
Thanks for the ideas and catching the ) typo, but I am still getting the same results. To clarify a bit, I do get an output of WCA +0 when using the Lvar in the GaugeString line, but the value should not be 0. Changing the 3 to some other digit in the Update section has no effect on the output. Inserting different digits into the GaugeString line in place of the Lvar does produce different output values.
Al
 
I should have mentioned that the above code segment is part of a 2D pop-up gauge, and there is only that one Update section in the gauge.
Al
 
This XML script language is stupidly specific and I don't know all the nuances. But maybe this helps:
1. It looks like you're using the FS9 scheme, make sure that every part of your code conforms to that scheme - especially the header. I never used the fs9 scheme, but for the fsx syntax the update function needs a "script" section as well:
Code:
<Update id="some_calculations">
  <Script>
    3 (&gt;L:Test,number)
  </Script>
</Update>

2. You haven't confirmed yet that you tried adding a space between the 3 and the ( in your update function.
3. I never use a space in my variables before the unit. E.g.
Code:
(A:AIRSPEED TRUE,knots)
instead of
Code:
(A:AIRSPEED TRUE, knots)
But I don't know if that makes any difference.
 
This looks like FSX schema, therefor Update sections require a <Script> tag to work (see Vitus' post).
 
If it helps, the gauge header is

Code:
<?xml version="1.0" encoding="UTF-8"?>    
<SimBase.Document Type="AceXML" version="1,0" id="Wind Gauge">

Tried the below which I believe includes all the above suggestions, but it still does not work :( . Very strange.

Code:
<Update id="test_calculation">         
      <Script>
         3  (&gt;L:CrossWindVel,number)
      </Script>
</Update>

<!-- Display wind correction angle -->
    <Element id="Element">
                <FloatPosition>90.000,43.000</FloatPosition>
               <Visibility> (A:AIRSPEED TRUE, knots) 0 >  </Visibility>
               <GaugeText id="GaugeText">
               <FontColor>#9acd32</FontColor> 
                   <FontFace>glassga</FontFace>
                    <FontHeight>20</FontHeight>     
                            <GaugeString>
                                WCA%((L:DirMode,bool) 0 == ) %{if}  %((L:CrossWindVel,number) (A:AIRSPEED TRUE,knots) / asin  180 *  pi / near)%!+2d! %{end}
                            </GaugeString>
                            <Length>6</Length>
                    <Size>100,25</Size>
                    <Transparent>True</Transparent>
                    <VerticalAlign>CENTER</VerticalAlign>
                    <HorizontalAlign>LEFT</HorizontalAlign>
                </GaugeText>
            </Element>
 
Last edited:
This should work
for testing i used L:Vars
FS9 syntax

Code:
      %(50 (&gt;L:CrossW,knots) 100 (&gt;L:Airspd,knots))
      %WCA\t%((L:CrossW,knots) (L:Airspd,knots) / atg 180 * pi /)%!3.7f!&#176;\n
 
And cross tail head wind calc

Code:
<!-- for sinus and cosinus USE  RADIANS -->
  <Macro Name="MCR_FLT_CrossWind">
    (A:AMBIENT WIND DIRECTION,radians) (A:PLANE HEADING DEGREES MAGNETIC,radians) - (A:MAGVAR,radians) - d
       sin (A:AMBIENT WIND VELOCITY,knots) * (&gt;L:VsV1Vr_FLT_Cross_Wind_C,knots)
       cos (A:AMBIENT WIND VELOCITY,knots) * (&gt;L:VsV1Vr_FLT_Head_Wind_C,knots)
  </Macro>
 
EduHir,
Thanks for the inputs.
My issue is not what the calculations need to be, but rather why using an update section, or a Macro, does not work.
If I put ALL the calculations into one long gauge string, the Wind Correction Angle is correctly displayed as show in the picture below (here the a/c course is 301 degs, the wind is 26kts at 2 degs, but all winds are depicted relative to the a/c heading of 305 degs).
1527871927937.png


Since I could not get the Update section to work, I tried using Macros, which also didn't work. Even the simple macro "Test" below did not display the value 5 as I expected, WCA +0 was displayed.
Can macros be used to do a calculation in a gauge string? If my syntax below is correct, then I'm wondering if there is some kind of variable scope issue with both the macro and Update section.
Al
Code:
<Macro Name="Test">
     <MacroValue> 5  </MacroValue>
</Macro>

<!-- Display wind correction angle WCA-->
    <Element id="Element">
                <FloatPosition>90.000,43.000</FloatPosition>
               <Visibility> (A:AIRSPEED TRUE, knots) 0 >  </Visibility>
               <GaugeText id="GaugeText">
               <FontColor>#9acd32</FontColor> 
                   <FontFace>glassga</FontFace>
                    <FontHeight>20</FontHeight>     
                            <GaugeString>
                            WCA %(@Test)%!+3d!
                           </GaugeString>
                            <Length>6</Length>
                    <Size>100,25</Size>
                    <Transparent>True</Transparent>
                    <VerticalAlign>CENTER</VerticalAlign>
                    <HorizontalAlign>LEFT</HorizontalAlign>
                </GaugeText>
            </Element>
 
Macros need to be located at the top of the file, right below the gauge header.

And yes, they do work with gauge strings.
 
Macros need to be located at the top of the file, right below the gauge header.

That was the problem (along with a typo in my nested macro). Thanks very much for the help!

Although in this case using macros seems to be just as convenient as using an Update section, it still "bugs" me why I can't get the update section to work.
I'm sure there is a good learning experience hidden here if I could figure it out.

Al
 
Last edited:
I finally got the Update section version of the above code working. Had to use the <Script> tags as suggested above, and fix some typos.
Thanks all for the help.
Al
 
Back
Top