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

FSX simple gps

Messages
106
Country
germany
hi guys

I'd like to make a simple GPS display for the gps position in xml.
my idea was:

Code:
   <Element>
      	<Position X="10" Y="495"/>
       	<Text X="256" Y="17" Length="45" Fixed="No" Attributes="Bold" Font="Arial" Adjust="Left" VerticalAdjust="Bottom" Color="#000000" Bright="Yes" Multiline="Yes">
         	<String>LAT: %((A:GPS POSITION LAT, Radians))%!01d!%° %((A:GPS POSITION LAT, Radians))%!01d!%.%((A:GPS POSITION LAT, Radians))%!03d!%  LON: %((A:GPS POSITION LON, Radians))%!01d!%° %((A:GPS POSITION LON, Radians))%!01d!%.%((A:GPS POSITION LON, Radians))%!03d!% </String>
      	</Text>
   </Element>

Unfortunately, everything is set to 0
what is wrong? missing something?
 
Try something like this
Code:
<String>PP %((A:GPS POSITION LAT,degrees) 0 &lt; if{ 'S' } els{ 'N' } )%!s!  
%((A:GPS POSITION LAT,degrees) abs flr )%!02d!° 
%((A:GPS POSITION LAT,degrees) abs 1 % 60 * flr )%!02d!' 
%((A:GPS POSITION LAT,degrees) abs 1 % 60 * 1 % 60 * )%!02d!"  
%((A:GPS POSITION LON,degrees) 0 &lt; if{ 'W' } els{ 'E' } )%!s! 
%((A:GPS POSITION LON,degrees) abs flr )%!03d!° 
%((A:GPS POSITION LON,degrees) abs 1 % 60 * flr )%!02d!'  
%((A:GPS POSITION LON,degrees) abs 1 % 60 * 1 % 60 * )%!02d!" 
%</String>

What it does is to check the sign of the lat position and output "N" if it positive and "S" if negative. Does the same thing later for lon position. The rest of the code just breaks down the decimal positions into degrees, minutes and seconds and puts the appropiate character after them

Roy
 
Last edited:
thanks thanks thanks.
My display is now better than that of the federal police. they have to be zero only.
 
The following code gives you the the Lat/Long in three formats:

1. degrees - minutes - seconds. 53:24:16
2. degrees - minutes to decimal places 53:24.2713
3. degrees to decimal places 53.423861

The gauge has :
1. Aircraft's current position.
2. Next Waypoint if a flight plan is loaded.

Simply click on the Lat/ Long area to scroll through the formats.

It's a complete instrument , just copy with a xml editor , it does not require a background bitmap , place it in a folder in your aircraft's Panel folder ,
make an entry in the panel cfg , size 105 x 125 , and test fly it.

Cheers
Karol

HTML:
<Gauge Name="LAT LONG CONV" Version="1.0">
<Size X="105" Y="125" />
	<Element Name="BACKGROUND RECTANGLE">	
		<Position X="0" Y="0"/>
		<Rectangle Width="105" Height="125" FillColor="black" Bright="Yes" />			
	</Element>
   <Element>
      <Element>
          <Position X="2" Y="5"/>
           <Text X="100" Y="10" Bright="Yes" Length="20" Font="Tahoma" FontSize="8" Color="#6E98CA" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
            <String>%LAT/LONG CONV%</String>
           </Text>
       </Element>
		<Element>
          <Position X="5" Y="30"/>
          <FormattedText X="95" Y="36" Font="Tahoma" FontSize="10" LineSpacing="12" Adjust="Left" Color="#349F34" Bright="Yes">
            <String>%A/C  POS%\n
			%Lat  %((L:ACPOS, number))%{case}%{:0}%((A:PLANE LATITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % flr r flr 'N' 'S' l0 ? )%!s!%!02.0f!%\{dplo= } %!02.0f!%' %!02.0f!%"%{:1}%((A:PLANE LATITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % r flr 'N' 'S' l0 ? )%!s!%!02.0f!%\{dplo= } %!07.4f!%' %{:2}%((A:PLANE LATITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % r flr 'N' 'S' l0 ? )%!s!%((A:PLANE LATITUDE, degrees) abs )%!09.6f!%\{dplo= }%{end}\n
			%Long %((L:ACPOS, number))%{case}%{:0}%((A:PLANE LONGITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % flr r flr 'E' 'W' l0 ? )%!s!%!03.0f!%\{dplo= } %!02.0f!%' %!02.0f!%"%{:1}%((A:PLANE LONGITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % r flr 'E' 'W' l0 ? )%!s!%!03.0f!%\{dplo= } %!07.4f!%' %{:2}%((A:PLANE LONGITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % r flr 'E' 'W' l0 ? )%!s!%((A:PLANE LONGITUDE, degrees) abs )%!010.6f!%\{dplo= }%{end}%</String>
          </FormattedText>
        </Element>	
		<Element>
          <Position X="5" Y="80"/>
          <FormattedText X="95" Y="36" Font="Tahoma" FontSize="10" LineSpacing="12" Adjust="Left" Color="#349F34" Bright="Yes">
            <String>%NXT  WPT%  %((A:GPS WP NEXT ID, string))%!s!%\n
			%Lat  %((L:NEXTWP, number))%{case}%{:0}%((A:GPS WP NEXT LAT, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % flr r flr 'N' 'S' l0 ? )%!s!%!02.0f!%\{dplo= } %!02.0f!%' %!02.0f!%"%{:1}%((A:GPS WP NEXT LAT, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % r flr 'N' 'S' l0 ? )%!s!%!02.0f!%\{dplo= } %!07.4f!%' %{:2}%((A:GPS WP NEXT LAT, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % r flr 'N' 'S' l0 ? )%!s!%((A:GPS WP NEXT LAT, degrees) abs )%!09.6f!%\{dplo= }%{end}\n
			%Long %((L:NEXTWP, number))%{case}%{:0}%((A:GPS WP NEXT LON, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % flr r flr 'E' 'W' l0 ? )%!s!%!03.0f!%\{dplo= } %!02.0f!%' %!02.0f!%"%{:1}%((A:GPS WP NEXT LON, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % r flr 'E' 'W' l0 ? )%!s!%!03.0f!%\{dplo= } %!07.4f!%' %{:2}%((A:GPS WP NEXT LON, degrees) d 0 &gt;= s0 r abs d 3600 * 60 % r d 60 * 60 % r flr 'E' 'W' l0 ? )%!s!%((A:GPS WP NEXT LON, degrees) abs )%!010.6f!%\{dplo= }%{end}%</String>
          </FormattedText>
        </Element>
	</Element>
		
   <Mouse>
     <Area Left="7" Top="42" Width="85" Height="25">
      <Tooltip ID="">%PP DMS>Deci% </Tooltip>
      <Cursor Type="Hand"/>
      <Click Kind="LeftSingle">(L:ACPOS, number) ++ 3 % (&gt;L:ACPOS, number) </Click>
    </Area>	   
     <Area Left="7" Top="92" Width="85" Height="25">
      <Tooltip ID="">%NW DMS>Deci% </Tooltip>
      <Cursor Type="Hand"/>
      <Click Kind="LeftSingle">(L:NEXTWP, number) ++ 3 % (&gt;L:NEXTWP, number) </Click>
    </Area>	
   </Mouse>
</Gauge>
 
Last edited:
The formatted text box was too short , it was cropping off the minutes superscript in the second format of the above code.
I have edited the above code and increased the text length to 95 , it now looks as it should.

Cheers
Karol
 
Why not simply add some carriage returns to eliminate the need to scroll at all, and making the script infinitely easier for humans to read? :D

Code:
<FormattedText X="95" Y="36" Font="Tahoma" FontSize="10" LineSpacing="12" Adjust="Left" Color="#349F34" Bright="Yes">
  <String>
    %A/C  POS%\n
    %Lat  %((L:ACPOS, number))%{case}%{:0}
    %((A:PLANE LATITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 
    % r d 60 * 60 % flr r flr 'N' 'S' l0 ? )
    %!s!%!02.0f!%\{dplo= } %!02.0f!%' %!02.0f!%"%{:1}
    
    %((A:PLANE LATITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 
    % r d 60 * 60 % r flr 'N' 'S' l0 ? )
    %!s!%!02.0f!%\{dplo= } %!07.4f!%' %{:2}
    
    %((A:PLANE LATITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 
    % r d 60 * 60 % r flr 'N' 'S' l0 ? )
    %!s!
    
    %((A:PLANE LATITUDE, degrees) abs )%!09.6f!%\{dplo= }%{end}\n
    %Long %((L:ACPOS, number))%{case}%{:0}
    
    %((A:PLANE LONGITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 
    % r d 60 * 60 % flr r flr 'E' 'W' l0 ? )
    %!s!%!03.0f!%\{dplo= } %!02.0f!%' %!02.0f!%"%{:1}
    
    %((A:PLANE LONGITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 
    % r d 60 * 60 % r flr 'E' 'W' l0 ? )
    %!s!%!03.0f!%\{dplo= } %!07.4f!%' %{:2}
    
    %((A:PLANE LONGITUDE, degrees) d 0 &gt;= s0 r abs d 3600 * 60 
    % r d 60 * 60 % r flr 'E' 'W' l0 ? )
    %!s!
    
    %((A:PLANE LONGITUDE, degrees) abs )%!010.6f!%\{dplo= }%{end}%
  </String>
</FormattedText>
 
n4gix

Thanks, that's much better.
Will keep your sample as a template for future use.

Karol
 
n4gix

Thanks, that's much better.
Will keep your sample as a template for future use.

Karol
For the most part, extraneous blank spaces and carriage returns are ignored by the XML parser, so it's unnecessary to remove them for actual use...

...my simple "rule" for <String> scripts is to always make certain that every line begins with a % symbol. This will guarantee no problems with display in the sim.
 
I noticed with your sample that the % type structure is as used in the GPS Loops.
Much neater , and all on the screen page.
Karol
 
That is where I got the idea, yes. I've also found that it makes reading and understanding multiple conditions much easier as well, as in the following example.

On my overhead panel is a multi-segment set of indicators which display leading edge slat and trailing edge flap movements and positions. For the "intransit" set of lights, I scripted the logic in this section. For instance, I want the "intransit" lights to illuminate only whenever the various surfaces are moving, hence the twin conditions of greater than and less than. Since there are nine possible conditions, there are nine sets of lower/upper limits required.

Imaging how difficult this would be were it all compressed into a single line! Worse still, imagine how impossible to understand had I put all of the "and" and "or" conditionals at the end of the single line!!!

IOW, "and and or and or and or and or and or and or and or and or and or" :yikes:

Code:
    <!-- LE Flap Indicator -->
    (A:LEADING EDGE FLAPS LEFT PERCENT,percent) 0 &gt;
    (A:LEADING EDGE FLAPS LEFT PERCENT,percent) 50 &lt; and

    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 2.5 &gt;
    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 5.0 &lt; and
    or

    (A:LEADING EDGE FLAPS LEFT PERCENT,percent) 50 &gt;
    (A:LEADING EDGE FLAPS LEFT PERCENT,percent) 100 &lt; and
    or

    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 5.0 &gt;
    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 12.5 &lt; and
    or

    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 12.5 &gt;
    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 25.0 &lt; and
    or

    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 25.0 &gt;
    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 37.5 &lt; and
    or

    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 37.5 &gt;
    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 62.5 &lt; and
    or

    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 62.5 &gt;
    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 75.0 &lt; and
    or

    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 75.0 &gt;
    (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 100 &lt; and
    or

    if{ 1 (>L:LightsLE_IntransitL,bool) 1 (>L:LightsLE_IntransitR,bool) }
    els{ 0 (>L:LightsLE_IntransitL,bool) 0 (>L:LightsLE_IntransitR,bool) }
 
Last edited:
Bill,
you shamed me into editing my post! And it is easier to read

Roy
Roy, there's no "shame" involved. I've simply tried to develop certain habits in scripting that make my life easier, since I'm all too easily confused myself! :D
 
n4gix

Regards your flaps code above.
Q1. does that go in a visability statement ?
Q2. is the " or " the same as " || " ?

I had hoped to read my wing sweep dial into a supplementary digital readout , and your code seems to provide the answer .

Karol
 
n4gix

Regards your flaps code above.
Q1. does that go in a visability statement ?
Q2. is the " or " the same as " || " ?

I had hoped to read my wing sweep dial into a supplementary digital readout , and your code seems to provide the answer .

Karol
No, it actually goes into an <Update Hidden="Yes"> section. This forces the script to be evaluated at each gauge cycle (18 times/second). I will eventually wrap this entire bit of script into an if{ } condition such that it will only be evaluated when needed, in other words whenever flaps position is > 0...

Yes, "or" is equivalent to the double-pipe symbol "||"... I prefer to use "or" because frankly it's just easier for a human to read!!! :D

&amp;&amp; - && - and are all functionally equivalent!

|| - or are both functionally equivalent!
 
Back
Top