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

Element select value in xml gauge

Messages
71
Country
switzerland
Hello,

Sorry for my stupid question! As an abosulte not experimented gauge programmer, I've got a question.

You probably know that I made a lot of cockpitsounds gauges. As I learned here, I had xml variable like this :

<Element>
<Select>
<Value>
(L:lever fuel cutoff eng1,number) (L:lever fuel cutoff eng1_TMP,number) !=
if{
1 (&gt;L:DSD_leverswitch10_SD,number)
(L:lever fuel cutoff eng1,number) (&gt;L:lever fuel cutoff eng1_TMP,number)
}
</Value>
</Select>
</Element>

My question : Is it necessary to add Element Select Value for each single variable :
<Element>
<Select>
<Value>
Variable A
</Value>
</Select>
</Element>

<Element>
<Select>
<Value>
Variable B
</Value>
</Select>
</Element>

etc..

Or can I put all variables simply between to Element Select value like that :

<Element>
<Select>
<Value>
Variable A
Variable B
etc...
</Value>
</Select>
</Element>

Does it change something or not ?

Thanks!

Daniel
 
You can have multiple statements and lines within element/select/value.

For example:

Code:
<Element>
<Select>
<Value>

(L:MP_DEBUG,number) 0 &gt;
if{
    (L:MP_DEline2,number) (&gt;L:MP_DEline1,number)
    (L:MP_DEline3,number) (&gt;L:MP_DEline2,number)
    (L:MP_DEline4,number) (&gt;L:MP_DEline3,number)
    (L:MP_DEBUG,number) (&gt;L:MP_DEline4,number)
    0 (&gt;L:MP_DEBUG,number)
    (L:MP_DEcount,number) ++ (&gt;L:MP_DEcount,number)
}
(A:PROP RPM:1,rpm) 0.16805 * (&gt;L:AdvJ2,number)
(A:Total Velocity,feet per second) (L:AdvJ2,number) / (&gt;L:T28AdvanceJ,number)

(A:PROP RPM:1,rpm) 0.17916 * (&gt;L:AdvJ2,number)
(A:Total Velocity,feet per second) (L:AdvJ2,number) / (&gt;L:P51AdvanceJ,number)

(A:PROP RPM:1,rpm) 0.10666 * (&gt;L:AdvJ2,number)
(A:Total Velocity,feet per second) (L:AdvJ2,number) / (&gt;L:LegacyAdvanceJ,number)
(A:STALL WARNING,bool) !
if{
    (L:BestAOA,degrees) (A:INCIDENCE ALPHA,Degrees) max (&gt;L:BestAOA,degrees)
    (A:SIM ON GROUND,bool) !
    if{
        (L:StallSpeed,knots) 0 ==
        if{ 200 (&gt;L:Stallspeed,knots) }
        (L:StallSpeed,knots) (A:Airspeed Indicated,knots) min (&gt;L:StallSpeed,knots)
    }
}

</Value>
</Select>
</Element>

But there can be a limit. I have run into problems in the past where a gauge would not run due to too many statements. If your gauge stops running and you don't know why then that may be one of the reasons.

It may be a good idea to group related calculations into one element/select/value set. It may make it easier to debug.
 
But there can be a limit. I have run into problems in the past where a gauge would not run due to too many statements.

... but fortunately the limit is large (for 'routine' XML gauge work, that is ;)). Here's a link to an interesting recent FSDeveloper discussion on XML size limit.

Good suggestion to group related calcs!

Bob
 
The real "advantage" of using <Element> section constructs is that unlike the <Update> section, of which there can only be one, you can have many <Element> sections...
 
<Update> section, of which there can only be one

Ah! Sure! ?
Because I made this and it works :

<Update Hidden="Yes">
<!-- PRIMARY INIT SECTION TO DO ONCE ON A/C LOAD! -->
(L:Gen_Init,bool) 0 ==
if{
1 (>K:MIXTURE_RICH)
1 (>L:Gen_Init,bool)
}

(L:DelayPrimaryInit, enum) ++ (>L:DelayPrimaryInit, enum)
(L:DelayPrimaryInit, enum) 20 ==
if{
0 (>L:fuel flow control lewer)
0 (>L:horn button)
1 (>L:pitot button)
1 (>K:MIXTURE_RICH)
}

(A:AVIONICS MASTER SWITCH,bool) 0 ==
if{ 1 (>K:AVIONICS_MASTER_SET) }

</Update>
 
Hi Daniel,

I'm a little confused by your response. The code snippet you posted shows just one <Update> section. It contains several lines of code, but still only one <Update> section.

unlike the <Update> section, of which there can only be one

According to this discussion, there may be more than one Update section if using FSX schema. See comment number 3. I believe Daniel may use FS9 schema (which is probably much more commonly used than FSX schema) in which case, only one <Update> section.
 
Bob nailed my statement perfectly. Yes, the FSX ACES XML Schema does allow for multiple <Update> sections, but given the absurdity and unnecessary complexity of that schema, I (and most others of whom I am aware) have decided to avoid it like the bubonic plague.

However, even though the more commonly used FS9 XML schema is limited to a single <Update> section, it remains quite possible to script multiple sub-sections within it with separate timing routines, so it isn't nearly as much of a handicap as one might imagine. :scratchch
 
Yes, the FSX ACES XML Schema does allow for multiple <Update> sections,

Actually it's not a real improvement having multiple <Update> sections in FSX schema appart from ACE editor's convenience, because all of them share the same script section.

In some cases, where parts of XML script code are very extense and cover different systems' sections, might be better to put them within different <Element> sections instead of a big single <Update> as to avoid parsing needless code, just by using the quit command when appropiate.

Tom
 
Bob nailed my statement perfectly. Yes, the FSX ACES XML Schema does allow for multiple <Update> sections, but given the absurdity and unnecessary complexity of that schema, I (and most others of whom I am aware) have decided to avoid it like the bubonic plague.

And one more note of clarification for any true XML beginner reading this thread ... you can use FS9-style (FS9 Schema) XML in gauges designed for both FS9 and FSX. FSX Schema won't work for FS9 gauges, not that anybody would want to do that.

Bill's eloquent (and pithy) reference to the plague is appropriate and I second his thoughts about the confusing and unnecessary complexity of FSX Schema.

Bob
 
There are two -and only two- cases where I might have to rely on the FSX schema, and that would be if I needed to use the dynamic drawing of <Arc> or <Pie> segments...

...but even those rare cases can be 'solved' using some semi-tricky FS9 schema tricks. :coffee:
 
Curious,

what tricks?
(using fs9, have the scripts working for rectangles. heightcode etc.)
 
Jan, for a "dynamic pie display" such as might be used for an engine RPM display, a mask cover could be used to keep the multiple "pie fan segments" from view. As the rpm increases, the "fan of pie segments" rotates and becomes visible. As the first "pie segment" is fully displayed, the next "pie segment" continues to rotate. Think of a ladies' folding fan, and how it unfolds.

If this were done using the FSX XML Schema, the size of a single "pie segment" would be controlled by a dynamic (L:variable) in a single statement. The same holds true for <Arc> segments.

For a <Pie> or <Arc> display, one could use these:
StartAngleScript Optional script to evaluate the start angle, overriding StartAngle.
EndAngleScript Optional script to evaluate the end angle, overriding EndAngle.
 
Last edited:
Was it this??? Years ago..

PHP:
<Gauge Name="Output_test.xml" Version="1.0">
  <Image Name="NAV_Infopage.bmp"/>

<Element>
<Position X="100" Y="100"/>

<Element>
   <Select>
     <Value>
     '50' s0
     </Value>
   </Select>
</Element>

<Element>
  <Visible>(A:ENG1 N1 RPM,percent) 33 &lt;</Visible>
  <Pie Radius="50" StartAngle="360" EndAngle="270"
       LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
   <Pivot X="51" Y="51"/>
  </Pie>
  <Rotate>
   <Value>(A:ENG1 N1 RPM,percent) 100 /</Value>
  <Nonlinearity>
  <Item Value="0" X="50" Y="0"/>
  <Item Value="0.4" X="0" Y="50"/>
  </Nonlinearity>
  </Rotate>
</Element>


<Element>
  <Visible>(A:ENG1 N1 RPM,percent) 33 &gt;
           (A:ENG1 N1 RPM,percent) 66 &lt; &amp;&amp;</Visible>
<Pie Radius="50" StartAngle="360" EndAngle="180"
LineWidth="2.0" Color="dkgray" FillColor="blue" Bright="yes">
<Pivot X="51" Y="51"/>
</Pie>
<Rotate>
<Value>(A:ENG1 N1 RPM,percent) 100 /</Value>
<Nonlinearity>
<Item Value="0" X="50" Y="0"/>
<Item Value="0.4" X="0" Y="50"/>
</Nonlinearity>
</Rotate>
</Element>

<Element>
<Visible>(A:ENG1 N1 RPM,percent) 66 &gt;</Visible>
<Pie Radius="50" StartAngle="360" EndAngle="90"
LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
<Pivot X="51" Y="51"/>
</Pie>
<Rotate>
<Value>(A:ENG1 N1 RPM,percent) 100 /</Value>
<Nonlinearity>
<Item Value="0" X="50" Y="0"/>
<Item Value="0.4" X="0" Y="50"/>
</Nonlinearity>
</Rotate>
</Element>

<Element>
<Position X="0" Y="-50"/>
<Polygon LineWidth="2" Color="dkgray" FillColor="green" Bright="yes">
<Point X="-30" Y="-1"/>
<Point X="-1" Y="50"/>
<Point X="50" Y="50"/>
<Point X="50" Y="-1"/>
<Point X="-30" Y="-1"/>
</Polygon>
</Element>

</Element>

</Gauge>
 
Here's my example of a discharge valve in FS9. In this case however, it displays exactly as the real gauge that does have a mask with a physically rotating white disk.
vololiberista
Code:
Gauge Name="fwd discharge Indicator" Version="1.0">
   <Image Name="fwd_dv_back.bmp" Luminous="1"/>
   <Element>
      <Position X="190" Y="182"/>
      <Image Name="fwd_dv_disc.bmp" PointsTo="West" Luminous="1">
         <Axis X="131" Y="131"/>
      </Image>
      <Rotate>
         <Value>(L:fwd_dv_segment,enum) 0 &gt; if{ 0 } els{ 1 }</Value>
         <Nonlinearity>
            <Item Value="0" X="71" Y="210"/>
            <Item Value="1" X="175" Y="49"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="50"/>
      </Rotate>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <Image Name="fwd_dv_topmask.bmp" Luminous="1"/>
   </Element>
   <Element>
      <Position X="205" Y="201"/>
      <Image Name="fwd_dv_bar.bmp" PointsTo="North" Luminous="1">
         <Axis X="205" Y="201"/>
      </Image>
      <Rotate>
         <Value>(L:fwd_dv_segment,enum) 0 &gt; if{ 1 } els{ 0 }</Value>
         <Nonlinearity>
            <Item Value="1" X="9" Y="181"/>
            <Item Value="0" X="185" Y="21"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="160"/>
      </Rotate>
   </Element>
   <Mouse>
      <Tooltip>Fwd Discharge Valve %( (L:fwd_dv_segment,enum) )%{if}Cross-Lined%{else}In_Line%{end}</Tooltip>
   </Mouse>
</Gauge>
 
Thanks for searching and finding that very old post, Jan. I took the opportunity to edit each of the XML scripts once again since the last forum upgrade screwed 'em up again.

I also bumped it back to the top and stickied it, so it won't get buried again! :rotfl:
 
This has meandered into a FS9 schema dynamic pie shape discussion that I think it is very interesting. Thanks, Bill, Edi, Volo, and Jan. I've never used one of these before but the effect is very nice, very current.

So, I took the liberty to combine Edi and Jan's scripts, above, into one XML gauge to see how they look. I added it to the FSX default B373 aircraft. As you can see, their scripts are fundamentally the same gauge (one is N1, one is throttle), and they are both nice. Edi on top, Jan on the bottom.

Code:
Added to PANEL.CFG:
Window10=Dynamic Pie Shape

//--- DYNAMIC PIE SHAPE ------------------
[Window10]
position=2
size_mm=200,400
visible=1
window_size_ratio=1.00
gauge00=DynamicPieShape!Output_test2,    0,    0,    200,    400

----------------------------
The XML Gauge:

<Gauge Name="Output_test2.xml" Version="1.0">

    <Element Name="B A C K G R O U N D   R E C T A N G L E">   
        <Position X="0" Y="0"/>
        <Rectangle Width="200" Height="400" FillColor="gainsboro" Bright="Yes" />   
    </Element>

// Edis Gauge
    <Element Name="EduHir">
    <Position X="75" Y="25"/>
        <FormattedText X="80" Y="14" Font="ariel bold" FontSize="14" LineSpacing="14"
            Color="#111111" BackgroundColor="gainsboro" Bright="Yes">
                <String>EDUHIR</String>
        </FormattedText>
    </Element>
    <Element>
    <Position X="100" Y="100"/>
        <Element>
            <Select>
                <Value>
                    '50' s0
                </Value>
            </Select>
        </Element>
        <Element>
            <Visible>(A:ENG1 N1 RPM,percent) 33 &lt;</Visible>
            <Pie Radius="50" StartAngle="360" EndAngle="270"
                LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
                <Pivot X="51" Y="51"/>
            </Pie>
            <Rotate>
                <Value>(A:ENG1 N1 RPM,percent) 100 /</Value>
                <Nonlinearity>
                    <Item Value="0" X="50" Y="0"/>
                    <Item Value="0.4" X="0" Y="50"/>
                </Nonlinearity>
            </Rotate>
        </Element>
        <Element>
        <Visible>(A:ENG1 N1 RPM,percent) 33 &gt;
        (A:ENG1 N1 RPM,percent) 66 &lt; &amp;&amp;</Visible>
            <Pie Radius="50" StartAngle="360" EndAngle="180"
            LineWidth="2.0" Color="dkgray" FillColor="blue" Bright="yes">
            <Pivot X="51" Y="51"/>
        </Pie>
            <Rotate>
            <Value>(A:ENG1 N1 RPM,percent) 100 /</Value>
                <Nonlinearity>
                    <Item Value="0" X="50" Y="0"/>
                    <Item Value="0.4" X="0" Y="50"/>
                </Nonlinearity>
            </Rotate>
        </Element>
        <Element>
        <Visible>(A:ENG1 N1 RPM,percent) 66 &gt;</Visible>
        <Pie Radius="50" StartAngle="360" EndAngle="90"
            LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
            <Pivot X="51" Y="51"/>
        </Pie>
        <Rotate>
            <Value>(A:ENG1 N1 RPM,percent) 100 /</Value>
                <Nonlinearity>
                    <Item Value="0" X="50" Y="0"/>
                    <Item Value="0.4" X="0" Y="50"/>
                </Nonlinearity>
            </Rotate>
        </Element>
        <Element>
        <Position X="0" Y="-50"/>
            <Polygon LineWidth="2" Color="dkgray" FillColor="green" Bright="yes">
                <Point X="-30" Y="-1"/>
                <Point X="-1" Y="50"/>
                <Point X="50" Y="50"/>
                <Point X="50" Y="-1"/>
                <Point X="-30" Y="-1"/>
            </Polygon>
        </Element>
    </Element>

// Jans Gauge
    <Element Name="Jan">
        <Position X="75" Y="225"/>
        <FormattedText X="80" Y="14" Font="ariel bold" FontSize="14" LineSpacing="14"
            Color="#111111" BackgroundColor="gainsboro" Bright="Yes">
                <String>PHJVH</String>
            </FormattedText>
    </Element>
    <Element>
        <Position X="100" Y="300"/>
        <Element>
            <Visible>
                (A:general eng1 throttle lever position,part) 0.33 &lt;
            </Visible>
            <Pie Radius="50" StartAngle="360" EndAngle="270" LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
                <Pivot X="51" Y="51"/>
            </Pie>
            <Rotate>
                <Value>(A:general eng1 throttle lever position,part)</Value>
                <Nonlinearity>
                    <Item Value="0" X="50" Y="0"/>
                    <Item Value="0.4" X="0" Y="50"/>
                </Nonlinearity>
            </Rotate>
        </Element>
        <Element>
            <Visible>
                (A:general eng1 throttle lever position,part) 0.33 > (A:general eng1 throttle lever position,part) 0.66 &lt; and
            </Visible>
            <Pie Radius="50" StartAngle="360" EndAngle="180" LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
                <Pivot X="51" Y="51"/>
            </Pie>
            <Rotate>
                <Value>(A:general eng1 throttle lever position,part)</Value>
                <Nonlinearity>
                    <Item Value="0" X="50" Y="0"/>
                    <Item Value="0.4" X="0" Y="50"/>
                </Nonlinearity>
            </Rotate>
        </Element>
        <Element>
            <Visible>(A:general eng1 throttle lever position,part) 0.66 ></Visible>
            <Pie Radius="50" StartAngle="360" EndAngle="90" LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
                <Pivot X="51" Y="51"/>
            </Pie>
            <Rotate>
                <Value>(A:general eng1 throttle lever position,part)</Value>
                <Nonlinearity>
                    <Item Value="0" X="50" Y="0"/>
                    <Item Value="0.4" X="0" Y="50"/>
                </Nonlinearity>
            </Rotate>
        </Element>
        <Element>
            <Position X="0" Y="-50"/>
            <Polygon LineWidth="2" Color="dkgray" FillColor="green" Bright="yes">
                <Point X="-30" Y="-1"/>
                <Point X="-1" Y="50"/>
                <Point X="50" Y="50"/>
                <Point X="50" Y="-1"/>
                <Point X="-30" Y="-1"/>
            </Polygon>
        </Element>
    </Element>
</Gauge>

upload_2014-5-8_16-29-8.png


Bob
 
Last edited:
Bob,
i didn't find the link to AVSIM. It's more or less the same. I maybe changed it a little. It's years ago.......
So all the honour to Jan!!

Edi
 
Back
Top