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

FSXA Altimeter xml code below sea level

Messages
1,749
Country
unitedstates
Does anyone have a sample xml code of an altimeter below sea level since this will go into the negative values.

I need a sample for digital and analog.

I noticed the default aircraft will show 9000 for -1000 feet. and so on. I figure this is correct.
But my analog code just stop at zero. And the string for the digital shows dashes.
 
My altimeter correctly points to say hundreds of feet below zero. But numerically it counts down by one. For example zero feet is 000, 100ft below sea level is 999, 200ft is 998 and so on. That is correct for an analogue altimeter.
 
Do you have a xml example you can share. Because my string is 2 parts and only can show above zero. So i only need an example as i have to re code my original to work.
 
I have my digital string working now for below sea level.:stirthepo

I am now looking for an example of a xml code the the model def. Because adding a minus symbol makes the needle work but rotates the wrong direction.
And looking at the default gauges and the code is for a 2D needle which works without any special change. Just the normal 1000 /
So i am stumped on how this would work for a 3D needle.
 
Here you go. This is the precision altimeter. An analog dial with a pointer and a number roll in the centre.
Subsitute L precision_kohlsman), (L precision_indicated_altitude) etc., for the equivalent A vars. In FS9 you have to create separate altimeters if you want a standby altimeter that has separate controls.
Code:
<Gauge Name="Altimeter" Version="1.0">
   <Image Name="ALTIMETER.bmp" ImageSizes="120,125" Luminous="1"/>
//---------------------------------------------------
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_MBS_MASK.bmp" ImageSizes="120,125">
         <Axis X="88" Y="115"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(L:precision_kohlsman, inHg) 100 * 1000 / flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_MBS_MASK.bmp" ImageSizes="120,125">
         <Axis X="96" Y="115"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(L:precision_kohlsman, inHg) 100 * 100 / 10 % flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_MBS_MASK.bmp" ImageSizes="120,125">
         <Axis X="104" Y="115"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(L:precision_kohlsman, inHg) 100 * 10 / 10 % flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_MBS_MASK.bmp" ImageSizes="120,125">
         <Axis X="112" Y="115"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(L:precision_kohlsman, inHg) 100 * 10 % near</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
//---------------------------------------------------
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_MBS_MASK.bmp" ImageSizes="120,125">
         <Axis X="0" Y="115"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(L:precision_kohlsman, millibars) 1000 / flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_MBS_MASK.bmp" ImageSizes="120,125">
         <Axis X="8" Y="115"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(L:precision_kohlsman, millibars) 100 / 10 % flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_MBS_MASK.bmp" ImageSizes="120,125">
         <Axis X="16" Y="115"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(L:precision_kohlsman, millibars) 10 / 10 % flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_MBS_MASK.bmp" ImageSizes="120,125">
         <Axis X="24" Y="115"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119,8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(L:precision_kohlsman, millibars) 10 % flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
//---------------------------------------------------
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_ALT_MASK.bmp" ImageSizes="120,125">
         <Axis X="25" Y="41"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_1.bmp" ImageSizes="11,187" Luminous="1">
    <Axis X="0" Y="170"/>
      </Image>
      <Shift>
         <Value>(L:precision_indicated_altitude, feet) 100000 + 100000 % d 100 % 100 / 0.61 - 0.38 / r 10 / flr d 1000 / 10 % flr  r 1000 %  996 &gt; if{ + } </Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="170"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_PITOT_STATIC Action="Freeze"/>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
      </Shift>
   </Element>

   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_ALT_MASK.bmp" ImageSizes="120,125">
         <Axis X="42" Y="41"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_2.bmp" ImageSizes="11,187" Luminous="1">
         <Axis X="0" Y="170"/>
      </Image>
      <Shift>
         <Value>(L:precision_indicated_altitude, feet) 100000 + 100000 % d 100 % 100 / 0.61 - 0.38 / r 10 / flr d 100 / 10 % flr  r 100 %  96 &gt; if{ + } </Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="170"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_PITOT_STATIC Action="Freeze"/>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
      </Shift>
   </Element>

   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_ALT_MASK.bmp" ImageSizes="120,125">
         <Axis X="65" Y="41"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_2.bmp" ImageSizes="11,187" Luminous="1">
    <Axis X="0" Y="170"/>
      </Image>
      <Shift>
         <Value>(L:precision_indicated_altitude, feet) 100000 + 100000 % d 100 % 100 / 0.61 - 0.38 / r 10 / flr d 10 / 10 % flr  r 10 %  6 &gt; if{ + } </Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="170"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_PITOT_STATIC Action="Freeze"/>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
      </Shift>
   </Element>

   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="ALTIMETER_ALT_MASK.bmp" ImageSizes="120,125">
         <Axis X="77" Y="41"/>
      </MaskImage>
         <Image Name="NUMBER_ROLL_05.bmp" ImageSizes="11,51" Luminous="1">
         <Axis X="0" Y="34"/>
      </Image>
      <Shift>
         <Value>(L:precision_indicated_altitude, feet) 10 / 10 %</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
            <Item Value="10" X="0" Y="34"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_PITOT_STATIC Action="Freeze"/>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
      </Shift>
   </Element>
//---------------------------------------------------


<Element>
      <Select>
<Position X="0" Y="0"/>
         <Value>(L:ALT_TEST,bool) 1 == (L:alt_warn,bool) 1 == and</Value>        
         <Case Value="1">
            <Image Name="ALTIMETER_MBS_MASK_LIGHT.bmp" Bright="Yes"/>
         </Case>
      </Select>
   </Element>

<Element>
     <Visible>(L:ALT_TEST,bool) 1 == (L:alt_warn,bool) 0 == and
(P:Absolute time,seconds) 1 % 0.5 1 * > ! and </Visible>
<Image Name="ALTIMETER_MBS_MASK_LIGHT.bmp" Bright="Yes"/>    
   </Element>



   <Element>
      <Position X="59.5" Y="59.5"/>
      <Image Name="NEEDLE_ALT.bmp" PointsTo="North"  ImageSizes="9,52" Luminous="1">
         <Axis X="4" Y="47"/>
      </Image>
      <Rotate>
         <Value>(L:precision_indicated_altitude, feet)</Value>
         <Failures>
            <SYSTEM_PITOT_STATIC Action="Freeze"/>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
         <Nonlinearity>
            <Item Value="0" X="59.5" Y="9"/>
            <Item Value="500" X="59.5" Y="109"/>
         </Nonlinearity>
      </Rotate>
   </Element>
//---------------------------------------------------
   
</Gauge>
 
Oh i see you used Lvars because it was a backup for FS9. So just use A vars instead.

This code is not for the model def file but for a 2D needle. I have a sample of a 2D which works. My issue is i need a 3D needle to work below sea level. My 3D needle just stops at zero or if i use an else code with a minus value the needle animation travels the wrong direction.
 
The simple answer for your problem is to offset the keyframed animation of the needle, then offset the modeldef.xml script to re-zero the calibration.

For example, if the current needle's animation track is 0 - 100 for 360º rotation, Then move the zero key to 100 - 200 normal rotation, and make frames 99 - 0 reverse rotation.
Code:
<Code>100 (L:altitude,number) +</Code>
 
The simple answer for your problem is to offset the keyframed animation of the needle, then offset the modeldef.xml script to re-zero the calibration.

For example, if the current needle's animation track is 0 - 100 for 360º rotation, Then move the zero key to 100 - 200 normal rotation, and make frames 99 - 0 reverse rotation.
Code:
<Code>100 (L:altitude,number) +</Code>

That is how i animate a 3 way switch to offset using -1, 0, 1 or a better example is a vertical speed indicator. Where is my brain! Every time i spend 4 months modeling my coding seems to fade a bit.:yikes:

I usually write the code this way for offsets. Thanks for the help Bill,
Code:
<Code>(L:altitude,number) 100 +</Code>
 
Last edited:
Back
Top