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

XML gauge conflict?

Dave_W

Resource contributor
Messages
185
This is in a VC in FSX.

This is supposed to be an oil transfer system. The oil goes from a reserve tank to one of four engine tanks. The oil quantities are stored between sessions using dsd_xml_config.

To transfer oil, you open a 2D window, click on a tank number selector gauge which sets (L:TANK NUMBER, number). Then click on another switch which sets (L:PUMP SWITCH,bool).

In this same window, and only in this window, there is a gauge that decrements at a specific rate as the
reserve tank oil quantity decreases.

That gauge appears to do what I want it to with the following code:

Code:
<Gauge Name="Res_Oil_Tank_Level" Version="1.0">
   <Image Name="tank_level_back.bmp"/>
   
<Element>
   <Position X="128" Y="128"/>
   <Image Name="tank_level_needle_bevel.bmp" PointsTo="North">
  <Axis X="18" Y="65"/>
  </Image>
  <Rotate>
  <Value Minimum="0" Maximum="50">
     (L:TANK NUMBER, number) 0 &gt; (L:PUMP SWITCH,bool) 1== &amp;&amp;
     (P:ABSOLUTE TIME, seconds) (L:START TIME, seconds) - 10 &gt; &amp;&amp;
     if{ (P:ABSOLUTE TIME, seconds) (&gt;L:START TIME, seconds)
     (L:RES OIL QUANTITY, gallons) -- (&gt;L:RES OIL QUANTITY, gallons) } els{ (L:RES OIL QUANTITY, gallons) }
   </Value>
  <Nonlinearity>
  <Item Value="0" X="84" Y="97"/>
  <Item Value="10" X="100" Y="87"/>
  <Item Value="20" X="117" Y="80"/>
  <Item Value="30" X="135" Y="80"/>
  <Item Value="40" X="153" Y="84"/>
  <Item Value="50" X="174" Y="95"/>
  </Nonlinearity>
  <Delay DegreesPerSecond="25"/>
  </Rotate>   
</Element>
<Mouse>
  <Area Left="20" Width="200" Top="150" Height="80">
  <Tooltip>Reserve oil quantity (%((L:RES OIL QUANTITY, gallons))%!d! GALS) Click to fill </Tooltip>
  <Cursor Type="Hand"/>
  <Click>(A:GENERAL ENG COMBUSTION:1, bool) ! (A:SIM ON GROUND, bool) &amp;&amp; (A:BRAKE PARKING POSITION, bool) &amp;&amp; if{ 50 (&gt;L:RES OIL QUANTITY, gallons) } </Click>
  </Area>
</Mouse>   
</Gauge>

That's all for the 2D window.

In the VC, I have two, dual needle engine oil quantity gauges. The gauge for the engine chosen for the
transfer by (L:TANK NUMBER, number) increments at a specific rate if (L:PUMP SWITCH,bool) is on.

The following example code is taken from the engine one part:
Code:
  <!-- ========================= Oil Qty - engine 1 =================== -->
  <Element>
  <Position X="128" Y="128"/>
  <Image Name="Oil_Qty_L_Needle_4_256.bmp" PointsTo="North">
  <Axis X="12" Y="99"/>
  </Image>
     <Element>
       <Select>
        <Value Minimum="0" Maximum="22">
           (L:TANK NUMBER, number) 0 > (L:TANK NUMBER, number) 2 &lt; &amp;&amp;
           (L:PUMP SWITCH,bool) 1== &amp;&amp; (P:ABSOLUTE TIME, seconds)
           (L:START TIME, seconds) - 10 &gt; &amp;&amp;
           if{ (P:ABSOLUTE TIME, seconds) (&gt;L:START TIME, seconds)
           (L:ENG1 OIL QUANTITY, gallons) ++ (>L:ENG1 OIL QUANTITY, gallons) }
         </Value>
       </Select>
     </Element>   
  <Rotate>
     <Value>(L:ENG1 OIL QUANTITY, gallons)</Value>
     <Nonlinearity>
  <Item Value="0" X="71" Y="211"/>
  <Item Value="5" X="32" Y="97"/>
  <Item Value="10" X="88" Y="35"/>
  <Item Value="15" X="162" Y="33"/>
  <Item Value="20" X="216" Y="80"/>
  <Item Value="22" X="227" Y="115"/>
     </Nonlinearity>
     <Delay DegreesPerSecond="25"/>
  </Rotate>
  </Element>

This code appears to do what I want it to only if I comment out the reserve oil tank quantity gauge that is in the 2D window. If I don't do that, the engine quantity gauge in the VC won't increment.

I hope this is enough information to show what the problem is. Can anyone see something wrong?

TIA
 
Sorry, no time now to understand what the code exactly does.
But I notice on two places that you use "1==" instead of "1 ==" So a missing space.
Not sure if the space is required (looks more clear with a space anyway) but you can try ..

Rob
 
Try what Rob said.
Also rename (L:START TIME, seconds) in the VC gauge to (L:START TIME2, seconds) to deconflict the timers used for controlling oil quantity in the tanks.
 
But I notice on two places that you use "1==" instead of "1 ==" So a missing space.
Not sure if the space is required (looks more clear with a space anyway) but you can try ..

The space is mandatory, otherwise 1== is being discarded by the parser.

However in this specific case is not a factor, because (L: PUMP SWITCH,bool) can hold 0 or 1, so there is no need to compare against "1 ==" or "0 ==". As 1== is not being stored on the stack, what is evaluated is (L: PUMP SWITCH,bool) alone.

Bjoern nailed it. (L:START TIME, seconds) must be renamed in the VC gauge. (P:ABSOLUTE TIME, seconds) (&gt;L:START TIME, seconds) is first executed in the 2D panel gauge therefore (P:ABSOLUTE TIME, seconds) (L:START TIME, seconds) - 10 &gt; in VC gauge will never execute as True (1).

Tom
 
Thanks Bjoern.

Tom, thanks for explaining everything.

I don't know enough about using the forum, or I would mark this thread as solved.

Edit: Rob, thanks also. It was a bit early in the A.M. when I replied.
 
Last edited:
Back
Top