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

FSXA Using Update Code in XML Gauges

Messages
278
Country
ca-britishcolumbia
Hey everyone,
Just a quick question, if I may? Can you use multiple udate sections in xml code? or does it have to be done by another route?

example of what i have, but the second update (blue) doesn't seem to work, but works on its own:

Code:
<Update id="Update">
<Frequency>1</Frequency>
<Script>(L:map_ZoomStep, number) 0 == if{ 
13 (&gt;L:map_ZoomStep, number) @CalculateZoomFactor((L:map_ZoomStep, number)) (&gt;L:map_ZoomFactor, number) }
(L:MapInit) 0 == if{
0 (&gt;L:LayerAirports)
0 (&gt;L:LayerAirspaces)
0 (&gt;L:LayerTerrain)
0 (&gt;L:LayerVORs)
0 (&gt;L:LayerILSs)
0 (&gt;L:LayerNDBs)
0 (&gt;L:LayerLowAirways)
0 (&gt;L:LayerTags)
0 (&gt;L:LayerCompass)
0 (&gt;L:LayerIntersections)
10 (&gt;L:LayerRangeRings)
0 (&gt;L:LayerRangeRings)
7 (&gt;L:VehicleObjectDetail)
25 (&gt;L:Filter)
1 (&gt;L:MapInit)
0  (&gt;L:LayerCompass) }
</Script>
</Update>

[COLOR="Blue"]<Update id="SquawkIdent">
<Script>quit
0 (&gt;C:ITrafficInfo:Filter)
(C:ITrafficInfo:ListSize) (&gt;G:Var1)
(G:Var1) 0 == if{ quit }
(G:Var1) -- (&gt;G:Var1)
:1 
(G:Var1) (&gt;C:ITrafficInfo:CurrentVehicle) 
(G:Var1) (&gt;C:ITrafficInfo:SelectedVehicle) 
(C:ITrafficInfo:S:TRANSPONDER CODE, number) 0 == if{ (C:ITrafficInfo:SelectedVehicleID) (&gt;C:fs9gps:1:SelectedVehicle) } 
(G:Var1) -- (&gt;G:Var1)
(G:Var1) -1 == if{ quit }	
g1</Script>
</Update>[/COLOR]
 
No. You can have one -and only one- <Update> section per "gauge."

So, either take the second <Update> section and put it in a new "gauge" by itself, or...

...use a timer function to control the refresh rate for each block of scripted logic. Unless told otherwise, everything within an <Update> section will execute at the maximum refresh rate of 18 Hz (18 cycles/second).

Code:
<Update>
    <!-- 18 Hz UPDATE -->
        /* everything that should be done at 18 Hz rate */
    <!-- END 18 Hz UPDATE -->
    
    <!-- 1 Hz UPDATE -->
    (P:Absolute time,seconds) 1 % 1 > !
    if{
        /* everything that should be done at 1 Hz rate */
      }
    <!-- END 1 Hz UPDATE -->
</Update>

Here is an explanation of how the universal timer code works:
Code:
<!--
With this universal code it's very simple to control not only the length of the cycle but the frequency of the 
blink itself:
Pseudocode:<Visble>(P:Absolute time,seconds) "seed" % "blink lapse" > !</Visible>
The seed parameter is the total length of the blinking cycle. For example, if you want something to blink on every 
second, you use 1, if you want it blink every half a second, use 0.5 , every two seconds, 2 ,etc.

For each seed, you can determine how long would be the duration of both the visible and invisible part.
Then:
(P:Absolute time,seconds) 1 % 0.5 > ! 
this will make the visible and invisible parts of half a second both.
(P:Absolute time,seconds) 1 % 0.7 > ! 
this will make the visible part 70% of the cycle (0.7 secs) and invisible parts of 30 % (0.3 secs).
(P:Absolute time,seconds) 0.5 % 0.25 > ! 
this will make the visible and invisible parts a quarter of second both.
You can invert the cycle by removing the "!" char.
-->
 
Last edited:
One more Question

With the gauge i am currently playing with, the updates are getting more frequent. and finding the handy dandy timer function may not be my best course of action. So having said that....

I s it possible to create an xml gauge with just an update?

Example:
Code:
Removed (see below)

then just add it to the panel config file with the guage? or am i going down the wrong path?
Sorry I have asked more than one question

thanks for any support
Greg
 
Last edited:
Sorry re-read Bill's comments, and low and behold the answer was right in front of me. Thanks again

Greg
 
Back
Top