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

(Solved) Conditional parameters in XML tooltips

Messages
20
Country
england
If I wanted to display a parameter in the custom variable (L:GAUGE_PARAMETER, number) in a gauge called "My Gauge", I'd write the following XML code:

<Tooltip>My Gauge (%((L:GAUGE_PARAMETER, number))%!d! units)</Tooltip>

If (L:GAUGE_PARAMETER, number) is equal to 15 (for example), then the tooltip will read My Gauge (15 units).

Suppose though I only wanted to display the parameter if another variable (L:GAUGE_ACTIVE, bool) is true (with the gauge only displaying "My Gauge" with no bracketed parameter after it if (L:GAUGE_ACTIVE, bool) is false) -- is there any way of doing that in XML?

Thanks in advance,

George
 
maybe something like this:

Code:
(%((L:GAUGE_ACTIVE, bool) 1 == if{ (L:GAUGE_PARAMETER, number) })
 
Or similar to this?
Code:
<Tooltip>My Gauge%((L:GAUGE_ACTIVE, bool))%{case}%{:0} %{:1} (%((L:GAUGE_PARAMETER, number))%!d! units) %{end}</Tooltip>
 
Hi,

Normal if{ statements don't work in Tooltip lines - you need to use the String versions of the if structure. A simple example:

Code:
<Tooltip>PROP REVERSE %((L:MB, bool) 1 == ) %{if} ACTIVATED %{else} INACTIVE %{end} </Tooltip>
 
Code:
<Tooltip>My Gauge: %((L:GAUGE_PARAMETER, number))%{case}%{:0}nothing, rien, nichts%{:15}%((L:GAUGE_PARAMETER, number))%!d! units%{end})</Tooltip>

or

Code:
<Tooltip>My Gauge: %((L:GAUGE_PARAMETER, number) 15 ==)%{if}%((L:GAUGE_PARAMETER, number))%!d! units%{else}zero, noting, nada%{end})</Tooltip>

Note use of "else" in string code instead of "els".

I've also moved the "units" inside of the conditional string, so it will only display if your L: var actually evaluates to a "true" value. Makes the tooltip appear cleaner in the simulator. That way, you can also get rid of excess spaces in tooltips with conditional text pieces. Just put the space used in between words or numbers in front of the string that is conditionally displayed instead of after the string with permanent visibility.
 
Not quite right Bjoern, but close enough that I was able to finish it off myself. The correct code for what I wanted to do was:

Code:
<Tooltip>My Gauge%((L:GAUGE_ACTIVE, bool))%{if} (%((L:GAUGE_PARAMETER, number))%!d! units)%{else}%{end}

Thanks a lot!

George
 
Glad you sorted it out. I was typing from memory since I do not have access to my FSX PC on weekdays.

Btw: You can leave out the {else} and {end} if you have no other strings or evaluations follwing up.
 
Back
Top