• 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 Getting Reciprocal of Runway Heading ?

Messages
542
Country
australia
I have created a small instrument that has several pages.
This is the instrument.
v2ZRN.jpg


One of the pages ( Enum 2) returns the Runway Heading for the Nearest Airport Longest Runway.
The following is the code that returns that Runway Heading :-
HTML:
	<Element>
        <Position X="3" Y="12" /> 
-       <FormattedText X="118" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%((@c:NearestAirportCurrentLongestAirportDirection, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d!%\{dplo= }%  -  %</String> 
        </FormattedText>
    </Element>

What I am now after is the Reciprocal (+/- 180 degrees) of that runway heading.
How do I Modify this Line of code to get the Reciprocal ?
HTML:
<String>%((@c:NearestAirportCurrentLongestAirportDirection, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d!%\{dplo= }%  -  %</String>

Any help would be appreciated .

Cheers
Karol
PS; The following is the complete instrument code , it does not require a background Bitmap.
HTML:
<Gauge Name="Liaka_Display" Version="1.0">
<Size X="122" Y="24" />	
//By Karol Chlebowski @ 2013 **
<Macro Name="c">C:fs9gps</Macro>
<Macro Name="C">C:fs9gps</Macro>	
	
<Update>		
 	<Frequency>6</Frequency>
</Update>
<Update Hidden="No">(A:GPS POSITION LAT, Radians) (>@c:NearestAirportCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (>@c:NearestAirportCurrentLongitude, Radians) 2 (>@c:NearestAirportMaximumItems) 30 (>@c:NearestAirportMaximumDistance, NMiles) 10000 (>@c:NAV_MinRunwaylength, feet)</Update> 
    	<Element> 
		<Select>
			<Value> 0 (>@c:NearestAirportCurrentLine)
	(@c:NearestAirportCurrentICAO) (>@c:WaypointAirportICAO)
	(@c:NearestAirportCurrentICAO) (>@c:FacilityICAO) 
			</Value>
		</Select>
	</Element>
<!-- Enum0= Digital colour cded Radio Altitude readout
Enum1= Nearest Airport ICAO Name Dist BrgTEXT readout 	
Enum2= Nearest Airport Longest Runway ICAO Length Precision Runway Headings TEXT  readout
Enum3= Blank Display essentially an Off Switch -->
	<Element Name="STRIKE RECTANGLE">	
		<Position X="0" Y="0"/>
		<Rectangle Width="122" Height="24" FillColor="#020702" Bright="Yes"/>			
	</Element>

 	<!-- Radio Altitude Colour coded TEXT -->
   <Element>
      <Visible>(L:Strike mode,enum) 0 ==</Visible>
        <Element>
          <Position X="72" Y="6"/>
           <Text X="22" Y="16" Bright="Yes" Length="6" Font="Arial" FontSize="10" Color="LIGHT_BLUE" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
            <String>%R.A%</String>
           </Text>
        </Element>
		
          <Element>
            <Visible> (A:RADIO HEIGHT, feet) 1001 &gt;</Visible>
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#6C8D7C"   Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
           </Element>
		   
           <Element>
            <Visible>(A:RADIO HEIGHT, feet) 1000 &lt; (A:RADIO HEIGHT, feet) 501 &gt; &amp;&amp;</Visible> 
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#00FF00"  Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
          </Element>		   

           <Element>
            <Visible>(A:RADIO HEIGHT, feet) 500 &lt; (A:RADIO HEIGHT, feet) 201 &gt; &amp;&amp;</Visible>
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#CECE55"  Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
          </Element>

          <Element>
            <Visible>(A:RADIO HEIGHT, feet) 200 &lt; (A:RADIO HEIGHT, feet) 101 &gt; &amp;&amp;</Visible>
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#CC9900"  Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
          </Element>

          <Element>
            <Visible>(A:RADIO HEIGHT, feet) 100 &lt;</Visible>
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#FF3911"  Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
          </Element>		  
   </Element>	  
	
	
 	<!-- Nearest Airport TEXT -->
   <Element>
      <Visible>(L:Strike mode,enum) 1 ==</Visible>	
	<Element>
        <Position X="3" Y="0" /> 
-       <FormattedText X="39" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%(0 (>@c:NearestAirportCurrentLine))%((@c:NearestAirportCurrentIdent, string))%!s!</String> 
        </FormattedText>
    </Element>
	
	<Element>
        <Position X="42" Y="0" /> 
-       <FormattedText X="45" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%((@c:NearestAirportCurrentDistance, NMiles))%!4.1f! nm</String> 
        </FormattedText>
    </Element>	
		
	<Element>
        <Position X="88" Y="0" /> 
-       <FormattedText X="35" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%((@c:NearestAirportCurrentTrueBearing, Degrees) (A:GPS MAGVAR, degrees) - d360)%!003.0f!%\{dplo= }%</String> 
        </FormattedText>
    </Element>
	
	<Element>
        <Position X="3" Y="12" /> 
-       <FormattedText X="118" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%((@c:FacilityName))%!s!</String> 
        </FormattedText>
    </Element>	
   </Element>
   
 	<!-- Nearest Airport  RUNWAY data TEXT -->
   <Element>
      <Visible>(L:Strike mode,enum) 2 ==</Visible>
	<Element>
        <Position X="3" Y="0" /> 
-       <FormattedText X="39" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%(0 (>@c:NearestAirportCurrentLine))%((@c:NearestAirportCurrentIdent, string))%!s!</String> 
        </FormattedText>
    </Element>

	<Element>
        <Position X="42" Y="0" /> 
-       <FormattedText X="45" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%((@c:NearestAirportCurrentLongestRunwayLength, feet))%!d! ft</String> 
        </FormattedText>
    </Element>

	<Element>
        <Position X="3" Y="12" /> 
-       <FormattedText X="118" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%((@c:NearestAirportCurrentLongestAirportDirection, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d!%\{dplo= }%  -  %</String> 
        </FormattedText>
    </Element>	

   </Element>	  
	
	


	<Mouse>
   <Area Left="0" Top="0" Width="122" Height="24">
  <Cursor Type="UpArrow"/>
    <Click>
      (L:Strike mode,enum) ++ 4 % (&gt;L:Strike mode,enum)
    </Click>
  </Area>
	</Mouse>
</Gauge>
 

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
You can get the reciprocal of a heading by adding 180 to it and then normalizing it so it doesnt exceed 360 (the command d360 would do this for you)
 
Messages
542
Country
australia
Just for information , following code is final version.

Changes are.
1. Slight improvement in update rate.
2. Enum 2 shows both ends of the Nearest Airports Longest runway headings,
ie; 016 - 196
3. Page toggle now works both ways forward and back.

Cheers
Karol

**IMPORTANT EDIT**
REASON : Testing in a remote region of Australia with widely dispursed airports revealed that the
Nearest Airports Search entry was not large enough at 30 nm , which was pretty useless ,
the following code has been edited/modified to 250 nm , much better for areas with with widely
separated airports.
My apologies for any in convenience.
If using it just copy the updated code below.

HTML:
<Gauge Name="Liaka_Display" Version="1.0">
<Size X="122" Y="24" />	
//By Karol Chlebowski @ 2013 **
<Macro Name="c">C:fs9gps</Macro>
<Macro Name="g">C:fs9gps</Macro>	

    <Update Frequency="18" Hidden="No">
	  2 (&gt;@c:NearestAirportMaximumItems, enum) 
	  250 (&gt;@c:NearestAirportMaximumDistance, NMiles) 
	  10 (&gt;@c:NAV_MinRunwaylength, feet)
     (A:GPS POSITION LAT, Radians) (&gt;@c:NearestAirportCurrentLatitude, Radians)
     (A:GPS POSITION LON, Radians) (&gt;@c:NearestAirportCurrentLongitude, Radians)
	</Update> 
      <Element> 
		<Select>
			<Value> 0 (&gt;@c:NearestAirportCurrentLine)
	               (@c:NearestAirportCurrentICAO) (&gt;@c:WaypointAirportICAO)
	               (@c:NearestAirportCurrentICAO) (&gt;@c:FacilityICAO) 
			</Value>
		</Select>
	  </Element>


<!-- Enum0= Digital colour cded Radio Altitude readout
Enum1= Nearest Airport ICAO Name Dist BrgTEXT readout 	
Enum2= Nearest Airport Longest Runway ICAO Length Precision Runway Headings TEXT  readout
Enum3= Blank Display essentially an Off Switch -->
	<Element Name="STRIKE RECTANGLE">	
		<Position X="0" Y="0"/>
		<Rectangle Width="122" Height="24" FillColor="#020702" Bright="Yes"/>			
	</Element>

 	<!-- Radio Altitude Colour coded TEXT -->
   <Element>
      <Visible>(L:Strike mode,enum) 0 ==</Visible>
        <Element>
          <Position X="72" Y="6"/>
           <Text X="22" Y="16" Bright="Yes" Length="6" Font="Arial" FontSize="10" Color="LIGHT_BLUE" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
            <String>%R.A%</String>
           </Text>
        </Element>
		
          <Element>
            <Visible> (A:RADIO HEIGHT, feet) 1001 &gt;</Visible>
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#6C8D7C"   Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
           </Element>
		   
           <Element>
            <Visible>(A:RADIO HEIGHT, feet) 1000 &lt; (A:RADIO HEIGHT, feet) 501 &gt; &amp;&amp;</Visible> 
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#00FF00"  Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
          </Element>		   

           <Element>
            <Visible>(A:RADIO HEIGHT, feet) 500 &lt; (A:RADIO HEIGHT, feet) 201 &gt; &amp;&amp;</Visible>
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#CECE55"  Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
          </Element>

          <Element>
            <Visible>(A:RADIO HEIGHT, feet) 200 &lt; (A:RADIO HEIGHT, feet) 101 &gt; &amp;&amp;</Visible>
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#CC9900"  Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
          </Element>

          <Element>
            <Visible>(A:RADIO HEIGHT, feet) 100 &lt;</Visible>
               <Position X="20" Y="5"/>
               <Text X="49" Y="14" Bright="Yes" Length="6" Font="Tahoma" FontSize="15"  Color="#FF3911"  Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
                  <String>%((A:RADIO HEIGHT, feet))%!6d!</String> 
               </Text>
          </Element>		  
   </Element>	  
	
	
 	<!-- Nearest Airport TEXT -->
   <Element>
      <Visible>(L:Strike mode,enum) 1 ==</Visible>	
	<Element>
        <Position X="3" Y="0" /> 
-       <FormattedText X="39" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%(0 (>@c:NearestAirportCurrentLine))%((@c:NearestAirportCurrentIdent, string))%!s!</String> 
        </FormattedText>
    </Element>
	
	<Element>
        <Position X="42" Y="0" /> 
-       <FormattedText X="45" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%((@c:NearestAirportCurrentDistance, NMiles))%!4.1f! nm</String> 
        </FormattedText>
    </Element>	
		
	<Element>
        <Position X="88" Y="0" /> 
-       <FormattedText X="35" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%((@c:NearestAirportCurrentTrueBearing, Degrees) (A:GPS MAGVAR, degrees) - d360)%!003.0f!%\{dplo= }%</String> 
        </FormattedText>
    </Element>
	
	<Element>
        <Position X="3" Y="12" /> 
-       <FormattedText X="118" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%((@c:FacilityName))%!s!</String> 
        </FormattedText>
    </Element>	
   </Element>
   
 	<!-- Nearest Airport  RUNWAY data TEXT -->
   <Element>
      <Visible>(L:Strike mode,enum) 2 ==</Visible>
	<Element>
        <Position X="3" Y="0" /> 
-       <FormattedText X="39" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%(0 (>@c:NearestAirportCurrentLine))%((@c:NearestAirportCurrentIdent, string))%!s!</String> 
        </FormattedText>
    </Element>

	<Element>
        <Position X="50" Y="0" /> 
-       <FormattedText X="65" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%RWY  %((@c:NearestAirportCurrentLongestRunwayLength, feet))%!d! ft</String> 
        </FormattedText>
    </Element>

	<Element>
        <Position X="4" Y="12" /> 
-       <FormattedText X="116" Y="12"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%RWY HDG  %((@c:NearestAirportCurrentLongestAirportDirection, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d!%\{dplo= }% - %((@c:NearestAirportCurrentLongestAirportDirection, degrees) (A:GPS MAGVAR, degrees) - 180 + d360)%!03d!%\{dplo= }%</String> 
        </FormattedText>
    </Element>	

   </Element>	  	

	<Mouse>
   <Area Left="0" Top="0" Width="50" Height="24">
  <Cursor Type="DownArrow"/>
    <Click>
      (L:Strike mode,enum) -- 0 max (&gt;L:Strike mode,enum)
    </Click>
  </Area>	
   <Area Left="51" Top="0" Width="71" Height="24">
  <Cursor Type="UpArrow"/>
    <Click>
      (L:Strike mode,enum) ++ 4 % (&gt;L:Strike mode,enum)
    </Click>
  </Area>
	</Mouse>
</Gauge>
 
Last edited:
Messages
542
Country
australia
A shot of the final data presentation.

Cheers
Karol

** IMPORTANT , refer to EDIT at previous post.

qF8Xi.jpg
 
Last edited:
Top