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

Defunct DME gauge

Messages
10
Country
finland
I have been spending hours to figure out what is wrong with this defunt DME gauge. It should connect to NAV1 and display DME distance in kilometers by three numbers. Any other DME gauge does work correctly so it has something to with the XML coding. Could some of your experts take a look and figure out what is wrong? I have attached the gauge materials and the XML code below.

Code:
<Gauge Name="DME" Version="1.0">
   <Image Name="DME_background.bmp" ImageSizes="152,152,0,0"/>
  
   <Element>
      <Select>
         <Value>(L:TSBN,bool) if{ (A:NAV1 DME, kilometers) (G:Var2) == ! if{ (A:NAV1 DME, kilometers) 100 * (>G:Var1) } els{ (G:Var1) (A:NAV1 DMESPEED,meter/second) 180 / + (>G:Var1) }
(A:NAV1 DME, kilometers) (>G:Var2)}</Value>
      </Select>
   </Element>
  
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="DME_mask.bmp" ImageSizes="152,152,0,0">
         <Axis X="26" Y="34"/>
      </MaskImage>
      <Image Name="DME_numbers.bmp" Luminous="Yes" ImageSizes="22,367,0,0">
         <Nonlinearity>
            <Item Value="0" X="0" Y="334"/>
            <Item Value="10" X="0" Y="0"/>
         </Nonlinearity>
      </Image>
      <Shift>
         <Value>(G:Var1) 100000 + 100000 % d 100 % 100 / r 100 / flr d 100 / flr  r 100 %  99 == if{ + }</Value>
         <Delay PixelsPerSecond="500"/>
      </Shift>
   </Element>
  
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="DME_mask.bmp" ImageSizes="152,152,0,0">
         <Axis X="60" Y="34"/>
      </MaskImage>
      <Image Name="DME_numbers.bmp" Luminous="Yes" ImageSizes="22,367,0,0">
         <Nonlinearity>
            <Item Value="0" X="0" Y="334"/>
            <Item Value="10" X="0" Y="0"/>
         </Nonlinearity>
      </Image>
      <Shift>
         <Value>(G:Var1) 100000 + 100000 % d 100 % 100 / r 100 / flr d 10 / 10 % flr  r 10 %  9 == if{ + } </Value>
         <Failures>
            <SYSTEM_ELECTRICAL_AVIONICS Action="Freeze"/>
         </Failures>
         <Delay PixelsPerSecond="500"/>
      </Shift>
   </Element>
  
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="DME_mask.bmp" ImageSizes="152,152,0,0">
         <Axis X="93" Y="34"/>
      </MaskImage>
      <Image Name="DME_numbers.bmp" Luminous="Yes" ImageSizes="22,367,0,0">
         <Nonlinearity>
            <Item Value="0" X="0" Y="334"/>
            <Item Value="10" X="0" Y="0"/>
         </Nonlinearity>
      </Image>
      <Shift>
         <Value>(G:Var1) 100000 + 100000 % d 10 % 10 / r 10 / flr d 10 / 10 % flr  r 10 %  9 == if{ + } </Value>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action="0"/>
         </Failures>
         <Delay PixelsPerSecond="500"/>
      </Shift>
   </Element>
  
<Element>
      <Position X="0" Y="0"/>
      <Image Name="DME_frame.bmp" ImageSizes="152,152,0,0"/>
   </Element>
  
<Mouse>
         <Tooltip>DME</Tooltip>
   </Mouse>
  
</Gauge>
 

Attachments

The code in the very first <Element> is suspicious, specially regarding (L:TSBN,bool)...
If that var is zero, which I suspect it is, nothing will happen.
Everything else dealing with (G:Var2) boggles the mind -- no clue what was intended.
Plus, there may be an error at the very end. There should be space between " (>G:Var2) " and the closing bracket " } "
Using the following, replacing the very first <Element> should get you going with a basic DME output in Kms, modify if wanted from that point :
XML:
   <Element>
      <Select>
         <Value>(A:NAV1 DME, kilometers) (>G:Var1)</Value>
      </Select>
   </Element>
 
No idea what the (L:TSBN,bool) or Var2 are for. What matters is to get this working somehow, even simplified.

I tried adding the space before the bracket and later replacing the first element with your simplified code. I still couldn't get the numbers running. Could you kindly try it to some panel and see if you can figure it out? I guess the three middle elements need to be modified as well?
 
Here you go, tested in both FS9 & FSX.

Roman
XML:
<Gauge Name="DME" Version="1.0">
   <Image Name="DME_background.bmp" ImageSizes="152,152,0,0"/>
    
    <Macro Name="ExtDigit"> <!-- https://www.fsdeveloper.com/wiki/index.php?title=XML:_Macros_-_Extracting_Digits -->
        @1 sp0
        @3 0 > 
        if{ l0 10 @3 pow * sp0 }
        l0 int 10 @2 pow % 10 @2 1 - 0 max pow / int 
    </Macro>
        
    <Update>
        (A:NAV1 DME, kilometers) 0 max sp2
    </Update>
    
   <Element Name="100s">
      <Position X="0" Y="0"/>
      <MaskImage Name="DME_mask.bmp" ImageSizes="152,152,0,0">
         <Axis X="26" Y="34"/>
      </MaskImage>
      <Image Name="DME_numbers.bmp" Luminous="Yes" ImageSizes="22,367,0,0">
         <Nonlinearity>
            <Item Value="0" X="0" Y="334"/>
            <Item Value="10" X="0" Y="0"/>
         </Nonlinearity>
      </Image>
      <Shift>
         <Value>l2 100 % s1 99.7 &gt;= l1 99.7 - * @ExtDigit(l2,3,0) +</Value>
            <Failures>
            <SYSTEM_ELECTRICAL_AVIONICS Action="Freeze"/>
         </Failures>
         <Delay PixelsPerSecond="500"/>
      </Shift>
   </Element>
   <Element Name="10s">
      <Position X="0" Y="0"/>
      <MaskImage Name="DME_mask.bmp" ImageSizes="152,152,0,0">
         <Axis X="60" Y="34"/>
      </MaskImage>
      <Image Name="DME_numbers.bmp" Luminous="Yes" ImageSizes="22,367,0,0">
         <Nonlinearity>
            <Item Value="0" X="0" Y="334"/>
            <Item Value="10" X="0" Y="0"/>
         </Nonlinearity>
      </Image>
      <Shift>
         <Value>l2 10 % s1 9.7 &gt;= l1 9.7 - * @ExtDigit(l2,2,0) +</Value>
         <Failures>
            <SYSTEM_ELECTRICAL_AVIONICS Action="Freeze"/>
         </Failures>
         <Delay PixelsPerSecond="500"/>
      </Shift>
   </Element>
   <Element Name="1s">
      <Position X="0" Y="0"/>
      <MaskImage Name="DME_mask.bmp" ImageSizes="152,152,0,0">
         <Axis X="93" Y="34"/>
      </MaskImage>
      <Image Name="DME_numbers.bmp" Luminous="Yes" ImageSizes="22,367,0,0">
         <Nonlinearity>
            <Item Value="0" X="0" Y="334"/>
            <Item Value="10" X="0" Y="0"/>
         </Nonlinearity>
      </Image>
      <Shift>
         <Value>l2 1 % @ExtDigit(l2,1,0) +</Value> <!-- ROLLING DIGIT -->
            <!-- <Value>@ExtDigit(l2,1,0)</Value> --> <!-- SNAPPING DIGIT -->
         <Failures>
            <SYSTEM_ELECTRICAL_AVIONICS Action="Freeze"/>
         </Failures>
         <Delay PixelsPerSecond="500"/>
      </Shift>
   </Element>
    <Element>
      <Position X="0" Y="0"/>
      <Image Name="DME_frame.bmp" ImageSizes="152,152,0,0"/>
   </Element>
    
    <Mouse>
         <Tooltip>DME</Tooltip>
   </Mouse>
    
</Gauge>
 
Is this someone else's DME gauge that you're trying to use? I find it odd that you don't know what the TBSN variable is for in your own XML gauge... just saying...
 
Back
Top