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

<String> element and <Visible> tag issues in FSX

taguilo

Resource contributor
Messages
1,585
Country
argentina
Hi,

Navigating through the forum I came across this thread:

http://www.fsdeveloper.com/forum/showthread.php?t=174646

and also found more comments scattered in other threads as well.

Well, this is an "issue" (elegant synonymous of bug) in FSX, related to the way <String> element's scripts are stored into the element's display buffer. This affects both <Text> and <FormattedText> string types.
I'm not good at tech explanations, but I'll do my best to be understood:

This happens with a string element that is a direct child of a gauge; when it is created (at gauge's init, or by a panel/gauge redraw of any kind), if it has a <Visible> condition that is false at the first evaluation, the content of the script is not passed to the element's display buffer. Despite this, the script is indeed evaluated and its result saved in a "script buffer". When the next cycle comes, the script result is reevaluated and compared to what is currently in its "buffer"; if both are different the new result is transfered to the display buffer, otherwise nothing happens and the display buffer maintains its current data.When a <Visible> conditional is set to true, whatever is in the display buffer is made "visible" (transfered to the visible screen) BUT, as the display buffer is empty, nothing is shown. However, as soon as a new script result is at least one bit different from the previous, the display buffer is updated and, if <Visible>, transfered to the screen.
Naturally there's a simple way to overcome this "issue": to place the <String> element as a child (inside) of another element which is the one that contains the <Visible> tag:

For example, instead of this:


Code:
[FONT="Courier New"]<Gauge Name=...etc>

<Element> 
  <Position, etc>
  <Visible>Bool</Visible>
  <Text> or <Formattedtext>
   <String>...
[/FONT]

Write this

Code:
[FONT="Courier New"]<Gauge Name=...etc>

<Element> 
  <Position, etc>
  <Visible>Bool</Visible>
  <Element>
    <Position, etc>	
    <Text> or <Formattedtext>
      <String>...[/FONT]


When the parent element visibility comes to true, forces all its child elements to update their display buffers.

Hope it wasn't much :confused:

Tom
 
Last edited:
Thanks for that workaround. I instead converted my Notepad gauges to Formatted Text, which does not need a Visible statement. While more work, it resulted in code that is much easier to read and I also took the opportunity to add some nice touches. :) But I will keep it in mind for future gauges.

BTW, another FSX bug that just bit me is that the Fuel Density variable (that uses pounds per gallon in FS9) does not work in FSX unless the units are instead in pounds. Thus you cannot use that variable in a gauge designed for both FS9 and FSX. Ugh...

Thanks again,
 
... I instead converted my Notepad gauges to Formatted Text, which does not need a Visible statement.

Actually FormattedText is also affected but, as long as you could manage the conditional within the string script and not use a <Visible> tag, you're right and problem is gone. Unfortunately, there are situations in where two strings share the same display area and are very different is structure as to make the filter in their scripts; in these cases a <Visible> tag is unavoidable and the workaround solution comes pretty handy.

Tom
 
Tom,
thanks a LOT for this solution (not workaround) to the fs "issue" !
It would have saved me a lot of work if I'd known this earlier, but I sure will archive it at a preferred place.
Great info and explanation. Thanks again!
 
Working on a panel in the usual manner. SDK open, multiple emacs windows open and FSX in windowed mode. Everything works, CAB it up and go for a 'real' flight in full screen mode.
Visible tags are broken! No display if the readout doesn't change. Back to FSX windowed - all is fine, full screen - broken. Much head banging until I found this thread.
Thanks a lot Tom, elements within elements fixed the problem.
 
Well, this technique also serves to point out that quite frequently it occurs that there are more than one <Element> sections that will use the same <Visibility> condition...

...so it only makes good organizational sense to group all of them under one "Parent <Visibility>" section. ;)
 
Back
Top