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

<Update> section limitations

Messages
205
Country
netherlandsantilles
Yep, although I believe I read somewhere trough the forums that Bill got a way to hack the system again by having more updates hidden in <visibility> tags not sure though it was in 2D or 3D gauges...
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Code:
<Element>
<Select>
<Value>
[Your code here]
</Value>
</Select>
</Element>

This works as well as any update tag and you can use it as often as you like.
 
Messages
205
Country
netherlandsantilles
I use <update> tag to place lines long of code that only calculate and control system logic within the gauge. I use the <Element> or <Visibility> tags mainly to control Bitmap logic.
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
The only advantage I know about is that you can directly control the update rate of the Update section, which is not possible in an Element. You can use timing code to do the same thing, of course, but that is a clumsier approach. So if I would have things that need an update only once per second (for example), I would put those into the Update section and put the rest into Elements.
 
Messages
57
Country
finland
The only advantage I know about is that you can directly control the update rate of the Update section, which is not possible in an Element. You can use timing code to do the same thing, of course, but that is a clumsier approach. So if I would have things that need an update only once per second (for example), I would put those into the Update section and put the rest into Elements.
Tom, this is interesting. How do I specify the update interval?
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
Tom, this is interesting. How do I specify the update interval?

XML:
<Update Frequency="*"/>
Where '*' is:
1: 1* per sec.
2: 2* per sec.
3: 3* per sec.
4: 4.5* per sec.
5 and 6: 6* per sec.
7,8 and 9: 9* per sec.
0: 18* per sec. (default, and maximum schedule rate)

But now Tom's remark
"" So if I would have things that need an update only once per second (for example), I would put those into the Update section and put the rest into Elements "
makes me doubt .....
I allways understood that if you specify the Frequency in a Update section, this schedule rate applies to the whole gauge (so all other subsequent Element sections too).
I'll test this again ....LoL

Rob
 
Last edited:

rcbarend

Resource contributor
Messages
435
Country
netherlands
I allways understood that if you specify the Frequency in a Update section, this schedule rate applies to the whole gauge (so all other subsequent Element sections too).
Just made a simple test gauge, which proves my point …

XML:
<Gauge Name="TEST" Version="1.0">

<Image Name="test.bmp"/>

<Update Frequency="1">
(G:Var1) ++ (>G:Var1)
</Update>

<Element><Select><Value>
(G:Var2) ++ (>G:Var2)
</Value></Select></Element>

<Element><Select><Value>
(G:Var3) ++ (>G:Var3)
</Value></Select></Element>

<Element>
<Position X="2" Y="0"/>
<Text X="48" Y="10" Length="10" Font="arial bold" FontSize="8" Color="#FFFFFF" Adjust="Left" VerticalAdjust="Center">
<String>Var1</String>
</Text>
</Element>
<Element>
<Position X="50" Y="0"/>
<Text X="38" Y="10" Length="10" Font="arial bold" FontSize="8" Color="#FFFFFF" Adjust="Right" VerticalAdjust="Center">
<String>%((G:Var1))%!d!</String>
</Text>
</Element>

<Element>
<Position X="2" Y="10"/>
<Text X="48" Y="10" Length="10" Font="arial bold" FontSize="8" Color="#FFFFFF" Adjust="Left" VerticalAdjust="Center">
<String>Var2</String>
</Text>
</Element>
<Element>
<Position X="50" Y="10"/>
<Text X="38" Y="10" Length="10" Font="arial bold" FontSize="8" Color="#FFFFFF" Adjust="Right" VerticalAdjust="Center">
<String>%((G:Var2))%!d!</String>
</Text>
</Element>

<Element>
<Position X="2" Y="20"/>
<Text X="48" Y="10" Length="10" Font="arial bold" FontSize="8" Color="#FFFFFF" Adjust="Left" VerticalAdjust="Center">
<String>Var3</String>
</Text>
</Element>
<Element>
<Position X="50" Y="20"/>
<Text X="38" Y="10" Length="10" Font="arial bold" FontSize="8" Color="#FFFFFF" Adjust="Right" VerticalAdjust="Center">
<String>%((G:Var3))%!d!</String>
</Text>
</Element>

</Gauge>

G:Var1, but also G:var2 and 3 are incremented once per sec.

As a sidenote:
This (still) makes me wonder what the advantage is of using an Update section (other then for specifying the schedule freq. for the whole XML gauge) over using (multiple) Element sections.
In fact, other then for specifying the schedule rate, I don't see any advantage in using an Update section at all; since I suspect (but now I am guessing ...LoL) the max. code size restriction within one Element section in a gauge, is the same as within the (only one possible) Update section in an FS9-syntax XML gauge.
Or am I missing something ???

By the way, this is in FSX-Accell, but I doubt it's any different in FS9 or any P3D version.

Cheers,
Rob
 
Last edited:
Messages
85
Country
england
Just made a simple test gauge, which proves my point …

By the way, this is in FSX-Accell, but I doubt it's any different in FS9 or any P3D version.

Cheers,
Rob

FWIW I have tested Rob's code in FS9 and he is absolutely correct.
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Here's code for a general timer:
Code:
(P:ABSOLUTE TIME, seconds) (L:START TIME, seconds) - 1 &gt;
  if{ (P:ABSOLUTE TIME, seconds) (&gt;L:START TIME, seconds)
[Your code here]
}

The "1" specifies the update interval in seconds.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
In fact, other then for specifying the schedule rate, I don't see any advantage in using an Update section at all; since I suspect (but now I am guessing ...LoL) the max. code size restriction within one Element section in a gauge, is the same as within the (only one possible) Update section in an FS9-syntax XML gauge.
Or am I missing something ???
To me, the major advantage is that most - if not all - of your 'logic' is neatly contained in a single "askit" instead of being scattered willy-nilly in multiple <Element> sections... :stirthepo
 
Last edited:

rcbarend

Resource contributor
Messages
435
Country
netherlands
Hi Bill,

I understand your point.
So its for reason of structuring the code.

But since most of my gauges are mainly control "logic" , I structure a gauge in sequential functions , each in their own Element.
At least I understand now that there's no "functional" reason to use either Update or Element sections.
So I guess it's just a matter of preference, and the type of gauge.

Rob
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Using Element scripts has an important advantage over Update, in that each <Value> script is individually treated, where Update script is a single chunk of code, even in FSX's multiple <Update> schema.

Therefore, <Value> is the perfect place to use one of the most powerful operators : quit.

So for example, if you have a very long initialization code that is only executed once per flight, or any other condtional long code, using quit will prevent the unwanted portion from being parsed. Perhaps not a big saving, but counts in a whole.


Tom
 
Messages
46
Country
france
Hello guys

Sorry to jump in your conversation, but I have a related question, which is not fully answered by your comments so far.

I run p3d v4.5.

- in an XML gauge, can I have more than one <Update> object ?
- is there a size limit for the <Update> object ? Is that limit applicable for each object considered separately or for all the <Update> objects together ?
- if there is no frequenncy defined for the Updae, what is the number of cycles per second by default ?

Many thanks
 
Top