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

DME Display Question

Messages
683
Country
us-california
I'm working on a DME display. In it's current state it works, but I would like to have it show dashes instead of zeroes when there is not an active NAV:1 DME. Here's what I have now...

Code:
<Gauge Name="PL-4 DME" Version="1.0">
   <Image Name="PL-4_DME_display.bmp"/>
   <Element> 
       <Visible>(A:ELECTRICAL MASTER BATTERY,bool) (A:Circuit avionics on,bool)  &amp;&amp;</Visible>   
       <Element>
           <Position X="50" Y="10"/>            
             <Text X="200" Y="70" Length="5" Font="LCD" Color="Orange">
                 <String>%((A:NAV DME:1, nautical miles) abs)%!03.1f!</String>           
                </Text>
               </Element> 
         <Element>
           <Position X="200" Y="10"/>
             <Text X="200" Y="70" Length="4" Font="LCD" Color="Orange">
              <String>%((A:NAV DMESPEED:1, knots) abs)%!03d!</String>
             </Text>
        </Element> 
        <Element>
           <Position X="300" Y="10"/>
             <Text X="200" Y="70" Length="3" Font="LCD" Color="Orange">
              <String>%((A:NAV DME:1, nautical miles) (A:NAV DMESPEED:1, knots) / 60 *) %!02d!</String>
             </Text>
        </Element> 
        <Element>
           <Position X="50" Y="60"/>
             <Text X="30" Y="25" Length="2" Font="Ariel" Color="Orange">
              <String>%NM%</String>
             </Text>
        </Element> 
      <Element>
           <Position X="200" Y="60"/>
             <Text X="30" Y="25" Length="2" Font="Ariel" Color="Orange">
              <String>%KT%</String>
             </Text>
        </Element> 
        <Element>
           <Position X="310" Y="60"/>
             <Text X="30" Y="25" Length="3" Font="Ariel" Color="Orange">
              <String>%MIN%</String>
             </Text>
        </Element> 
       </Element>
  </Gauge>

It's been a loooong time since I have worked with gauge xml. I was happy to get this far! :D
 
Try using the token variable:

(A:NAV HAS DME:index,bool)

Code:
<String>
     %((A:NAV HAS DME:1,bool))
     %{if}
     %((A:NAV DME:1, nautical miles) abs)%!03.1f!
     %{else}---.-
     %{end}
</String>
 
Bill, I'm afraid it's not working. I get nothing displayed now. Here's how I added it...

Code:
<Element>
           <Position X="60" Y="10"/>            
             <Text X="200" Y="70" Length="5" Font="LCD" Color="darkorange">
                 <String>
                     %((A:NAV HAS DME:1,bool))
                     %{if} 
                     %((A:NAV DME:1, nautical miles) abs)%!03.1f!
                     %{else}---.-
                     %{end}
                 </String>
                </Text>
               </Element>
 
Hey Robert,


On the stock Beech Baron from FS2004, it has a DME that does this.




Code:
<Gauge Name="DME" Version="1.0">
   <Image Name="DME_Background.bmp" ImageSizes="70,35,112,56"/>
   <Element>
      <Position X="28" Y="21"/>
      <Select>
         <Value>(G:Var1)</Value>
         <Case Value="0">
            <Image Name="DME_Knob_1.bmp" ImageSizes="11,11,15,15"/>
         </Case>
         <Case Value="1">
            <Image Name="DME_Knob_2.bmp" ImageSizes="11,11,15,15"/>
         </Case>
      </Select>
   </Element>
   <Element>
      <Position X="5" Y="10"/>
      <Text X="60" Y="9" Length="12" Fixed="Yes" Font="Quartz" Adjust="Center" VerticalAdjust="Center" Color="#FF0000" Bright="Yes">
         <String>%((G:Var1))%{if}%((A:NAV2 DME, nmiles) s0 (A:NAV2 DMESPEED, knots) s1)%{else}%((A:NAV1 DME, nmiles) s0 (A:NAV1 DMESPEED, knots) s1)%{end}%(l0 0 &gt;=)%{if}%(l0 9999 min d 99 &lt;=)%{if}%!04.1f!%{else}%!4d!%{end} %(l1 9999 min)%!04d! %(l0 l1 / 60 * 99 min)%!02d! min%{else}---- ---- --%{end})"</String>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
            <SYSTEM_ELECTRICAL_AVIONICS Action=""/>
         </Failures>
      </Text>
   </Element>
   <Element>
      <Position X="5" Y="2"/>
      <Text X="60" Y="9" Length="12" Fixed="Yes" Font="Quartz" Adjust="Center" VerticalAdjust="Center" Color="#FF0000" Bright="Yes">
         <String> NM  KT MIN </String>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action=""/>
            <SYSTEM_ELECTRICAL_AVIONICS Action=""/>
         </Failures>
      </Text>
   </Element>
   <Mouse>
      <Help ID="HELPID_RADIO_DME"/>
      <Tooltip ID="TOOLTIPTEXT_DME_NAV_NM_KT_MIN" MetricID="TOOLTIPTEXT_DME_NAV_KM_MS_MIN"/>
      <Area Left="28" Top="21" Width="10" Height="10">
         <Tooltip ID="TOOLTIPTEXT_DME_N1_N2_SELECT"/>
         <Cursor Type="Hand"/>
         <Click>(G:Var1) ! (&gt;G:Var1)</Click>
      </Area>
   </Mouse>
</Gauge>
 
Bill, I'm afraid it's not working. I get nothing displayed now. Here's how I added it...

I should have asked first, is this for FS9 or FSX? Try this version for FS9/FSX compatibility:

Code:
<Element>
           <Position X="60" Y="10"/>            
             <Text X="200" Y="70" Length="5" Font="LCD" Color="darkorange">
                 <String>
                     %((A:NAV1 HAS DME,bool))
                     %{if} 
                     %((A:NAV1 DME, nautical miles) abs)%!03.1f!
                     %{else}---.-
                     %{end}
                 </String>
                </Text>
               </Element>
 
I should have mentioned at the start it's FSX code. :o
I tried the "new" code and it also seems to not work. Is it possible the text formatting could have an effect?
 
There's a signal strength variable that tells you if there's a signal or not. There's also a flag to tell you if the VOR has a DME component.

Does anyone actually read the SDK?? :P
 
As a matter of fact I had it open most of the day yesterday before posting here. After a good night's sleep I re-visited that document and came up with this:

%(CONDITIONAL)%{if}TEXT TO DISPLAY IF TRUE%{else}TEXT TO DISPLAY IF FALSE%{end}

I had to mess around with it a bit, and finally came up with something that works.

%((A:NAV HAS DME:1, bool))%{if}%((A:NAV DME:1, nautical miles))%!03d!%{else}---%{end}

Oddly it looks like the same sequence that Bill posted, just all in the same line. :confused:
 
%((A:NAV HAS DME:1, bool))%{if}%((A:NAV DME:1, nautical miles))%!03d!%{else}---%{end}

Oddly it looks like the same sequence that Bill posted, just all in the same line. :confused:

It is the same. If you copy/pasted from the forum however, it is possible that there were blank spaces at the end of each line, which would mess up the script.

I suggested the discrete (A:NAV HAS DME:1, bool) token for the sake of simplicity, but there is a second method, which makes use of the (A:NAV CODES:1, flags) token:

http://www.fsdeveloper.com/wiki/index.php?title=XML:_Decode_Flags

Code:
<Macro Name="HasDME">(A:NAV CODES:1, flags) 1 &amp; 1 ==</Macro>

%(@HasDME)%{if}%((A:NAV DME:1, nautical miles))%!03d!%{else}---%{end}

A third method would be similar to what Bill (Lionheart) suggested, which simply test for "greater than zero" and displays --- instead if distance is zero:

Code:
%((A:NAV DME:1, nautical miles) s0 0 &gt;)%{if}%(l0)%!03d!%{else}---%{end}

As you can see, there are many ways to skin this cat! :rotfl:
 
There's a signal strength variable that tells you if there's a signal or not. There's also a flag to tell you if the VOR has a DME component.

Does anyone actually read the SDK?? :P

Very few seem to before they start asking SDK questions :cool:
 
Oddly it looks like the same sequence that Bill posted, just all in the same line. :confused:

That's my bad. I completely forgot that a <Text> type requires all of the XML script to be on a single line in the <String>xxx</String> entry.

<FormattedText> on the other hand allows the <String> entry to be on multiple lines as I posted earlier. Had you simply used <FormattedText> instead of a simple <Text> type, it would have worked.

Since I never use the simple <Text> type at all anymore, I had forgotten this! :o
 
Back
Top