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

I need a nudge in the right direction

Messages
278
Country
ca-britishcolumbia
Ok, just an update

So I dropped the (>@c:IcaoSearchStartCursor) and
(>@c:IcaoSearchEnterChar), created an (L:Var) in their place.

Code:
     'A' (>L:GETAltAPICAO, enum))	
    (L:ALT-AP-4,number) chr (L:ALT-AP-3,number) chr 
    (L:ALT-AP-2,number) chr (L:ALT-AP-1,number) chr scat scat scat (>L:GetAltAPICAO, enum)

tested it and it displays the keyboard entry and does not effect the operation of the what I am trying to achieve. So going to assume at this point it is a (won't say correct) but a good avenue to persue.

From there I am, once again assuming I need to start with

Code:
(@c:FlightPlanNewWaypointICAO) and  if{

to retrieve the information I want to display on the Flight Planner Display.

from there:
Code:
if { Greg needs to learn Cycle Counting to make this work 
     (page 19 of the guide) }

This is the path I am travelling right now, and hope it is the right one!

Keep you posted

Thanks Again
Greg
 
Messages
1,564
Country
thailand
But as I work through this using Bob's suggested approach, and if I understand Bob correctly using

Code:
 (@c:FlightPlanNewWaypointICAO)

Eliminates the need for Shift Registers, ICAO transfers, etc. while providing the results that I am looking.
I dont think you understood everything I was getting at. You are using a shift register technique to store the individual keystrokes as L:Vars as the Ident is entered. In the same On Key section, you are also creating and saving the ICAO string that is needed for the alternate airport which will later become a new waypoint if Divert is pressed, so I said you would no longer need an ICAO Search. I didn't say ICAO Transfer. Search and Transfer are not the same thing.

My thoughts on what is happening with this method is I am still storing an airport for use at a later time because all I have done is created an New Waypoint,
That's essentially right. All you did was to create the ICAO of the alternate airport, but until it is added to the Flight Plan, it's not a new waypoint ... not yet.

Although I now see the point (or better no point) of having (@c:FlightPlanNewWaypointICAO) within the mouse, because where else is the new waypoint going to be created from.
FlightPlanNewWaypointICAO was created and saved into memory in the On Key section.

Where I went wrong with the above was when that happened I assumed that the Alternate Airport would disappear and when it didn't I added the

Code:
0 (>L:ALT-AP-1,enum) 0 (>L:ALT-AP-2,enum) 0 (>L:ALT-AP-3,enum) 0 (>L:ALT-AP-4,enum)

and the chasing began, .... Unfortunately, I forgot, missed, or not thinking was all my problems started with the addition of 0 (>L:ALT-AP-1,enum).......
That's not right. Your problems did not begin with the addition of 0 (>L:ALT-AP-1,enum)... That line of code was just in the wrong place. Your problems had to do with mis-application of gps variables.
 
Messages
1,564
Country
thailand
So I dropped the (>@c:IcaoSearchStartCursor) and
(>@c:IcaoSearchEnterChar), created an (L:Var) in their place.

Code:
     'A' (>L:GETAltAPICAO, enum))	
    (L:ALT-AP-4,number) chr (L:ALT-AP-3,number) chr 
    (L:ALT-AP-2,number) chr (L:ALT-AP-1,number) chr scat scat scat (>L:GetAltAPICAO, enum)

tested it and it displays the keyboard entry and does not effect the operation of the what I am trying to achieve. So going to assume at this point it is a (won't say correct) but a good avenue to persue.
Greg, that code is full of errors. Strings are not numbers and you can't store strings in L:Vars. Also, the logic and necessity of this appears wrong, so I would not pursue this line of thought.

From there I am, once again assuming I need to start with

Code:
(@c:FlightPlanNewWaypointICAO) and  if{

to retrieve the information I want to display on the Flight Planner Display.
This is the right way. I think you have now got the idea that FlightPlanNewWaypointICAO is the key, although I don't know what your and if{ is all about. FlightPlanNewWaypointICAO is the ICAO of your alternate airport and it is used when you hit the Divert button and

1 (>@c:FlightPlanAddWaypoint)

is executed.

FlightPlanNewWaypointICAO can also be transferred into the WaypointAirport group or the Facility group from which information like airport name and city name can be retrieved. The important word here is transferred. It's an ICAO Transfer and ICAO Transfers do not complete within the same gauge update cycle, so principles of Asynchronous Operation (pages 19-28 of the Guidebook) apply.

Bob
 
Messages
278
Country
ca-britishcolumbia
Thanks for clearing that up Bob and most of all thankfully I said If I understand you correctly!

One of my biggest problems besides coding is trying to explain things :eek:. I believe the spirit was there, just not the practicality.

You are right the use of gps varibles is a problem and I believe you once said the need to be diligent in de-bugging is critical and I need to spend more time on it, to which I believe I am better.

The use of 0 (>L:ALT-AP-1,enum)... was to clear the Alternate Information on the Flight Plan Display, Unfortuantly It went all down hill the minute I used it and I missed it. Wrong use and approach of it and it bit me in the :censored:, but thanks for re-directing me.

The mouse code I am working on is a blind work in progress, as I am sure you are aware. I understand that you cannot save strings to (L:vars) and thank you, I removed

Code:
'A' (>L:GETAltAPICAO, enum)	
    (L:ALT-AP-4,number) chr (L:ALT-AP-3,number) chr 
    (L:ALT-AP-2,number) chr (L:ALT-AP-1,number) chr scat scat scat (>L:GetAltAPICAO, enum)

and it didn't make a difference in the operation and displayed the characters in the input box, but somewhere I thought I needed something in the mouse section for the characters to display, regardless of if it was doing anything. So that hurrdle out of the way and knowing the key is FlightPlanNewWaypointICAO. In the mouse section I need to create a cycle counter with a an ICAO Search, kidding, a transfer to Facility and such as explained in your guide (page 19 to 28). Will post when I am closer to a working solution.

Thanks again Bob

Greg
 
Messages
1,564
Country
thailand
In the mouse section I need to create a cycle counter with a an ICAO Search, kidding, a transfer to Facility...

Don’t place cycle skipping code within a <Mouse> section. <Update> is the way to go. A mouse click is an “instantaneous” event. That is, the code within the <Click> is executed in the same gauge update cycle as the mouse click itself and in the next update cycle, the <Click> code is not executed at all. Consequently, a cycle counter within a <Mouse> section will never work properly.
 
Messages
542
Country
australia
Not sure of the necessity of cycle skipping in this function , I created a small test instrument that inserts a Alternate using Direct to and it works,
it does not store the Alternate as a L:Var as I cannot work out how
that is being done.

Cheers
Karol
HTML:
<Gauge Name="ALTERNATE" Version="1.0">
<Size X="160" Y="180" />	

<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>
	
	<Element Name="Alternate">	
		<Position X="0" Y="0"/>
		<Rectangle Width="160" Height="180" FillColor="#020702" Bright="Yes"/>			
	</Element>
<!-- Title Headline -->	
		<Element>
          <Position X="3" Y="2"/>
          <FormattedText X="154" Y="10" Font="Tahoma" FontSize="8" LineSpacing="10" Adjust="LEFT" Color="#349F34" Bright="Yes">
            <String>- %ALTERNATE TEST INSTRUMENT -%</String>
          </FormattedText>
        </Element>	  	

<!-- Flight Plan Display -->
		<Element Name="FltPln BOX">	
		  <Position X="2" Y="15"/>
		  <Rectangle Width="154" Height="37" Color="#1D581D" Bright="Yes"/>			
	    </Element>	  
		<Element>
          <Position X="6" Y="20"/>
          <FormattedText X="152" Y="10" Font="Tahoma" FontSize="8" LineSpacing="10" Adjust="LEFT" Color="#349F34" Bright="Yes">
            <String>- %CURRENT FLIGHT PLAN -%</String>
          </FormattedText>
        </Element>
		
        <Element>
          <Position X="20" Y="35" /> 
-         <FormattedText X="120" Y="20"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#349F34" Bright="Yes" FontSize="10">
            <String>%DEP %((A:GPS WP PREV ID, string))%!s!>%  %DEST %((A:GPS WP NEXT ID, string))%!s!</String> 
          </FormattedText>
        </Element>

<!-- ALTERNATE AREA-->
		<Element Name="ALTERNATE BOX">	
		  <Position X="2" Y="57"/>
		  <Rectangle Width="154" Height="83" Color="#1D581D" Bright="Yes"/>			
	    </Element>
		
		<Element>
          <Position X="4" Y="59"/>
          <FormattedText X="73" Y="12" Font="Tahoma" FontSize="8" LineSpacing="10" Adjust="Right" Color="#349F34" Bright="Yes">
            <String>%ALTERNATE ENTRY%</String>
          </FormattedText>
        </Element>
	
		<Element>
          <Position X="80" Y="59"/>
		  <Visible> (L:FPEntry, enum) 0 == </Visible>
          <FormattedText X="66" Y="12" Font="Tahoma" FontSize="10" LineSpacing="12" Adjust="Right" Color="#349F34" Bright="Yes">
            <String>%INACTIVE%</String>
          </FormattedText>
        </Element>
 
<Element>
      <Visible>(L:FPEntry, enum) 33 ==</Visible>
	  
		<Element>
          <Position X="80" Y="59"/>
          <FormattedText X="66" Y="12" Font="Tahoma" FontSize="10" LineSpacing="12" Adjust="Right" Color="#FF0000" Bright="Yes">
            <String>%ACTIVE%</String>
          </FormattedText>
        </Element>

		<Element>
          <Position X="4" Y="78"/>
          <FormattedText X="94" Y="12" Font="Tahoma" FontSize="8" LineSpacing="10" Adjust="Right" Color="#349F34" Bright="Yes">
            <String>%>> ENTER ALTERNATE%</String>
          </FormattedText>
        </Element>
		
		<Element Name="DESTINATION IDENT BORDER">	
		  <Position X="110" Y="78"/>
		  <Rectangle Width="33" Height="15" Color="#007293" Bright="Yes"/>			
	    </Element>
		
	    <Element Name="DESTINATION IDENT READBACK">
			<Position X="112" Y="80" /> 
				<FormattedText X="50" Y="16"  Adjust="left" Fixed="Yes" Font="Tahoma" Color="#93FF72" Bright="Yes" FontSize="10">
					<String>%((L:DDEST-DTO-4,enum) chr (L:DDEST-DTO-3,enum) chr scat (L:DDEST-DTO-2,enum) chr scat (L:DDEST-DTO-1,enum) chr scat)%!s!%</String>		
				</FormattedText>
	    </Element>		
</Element>

	<!-- PARTITION line -->
	      <Element>
         <Position X="2" Y="100"/>
         <Polygon Color="#1D581D" LineWidth="0.1" Bright="Yes">
           <Point X="0" Y="0"/> 
           <Point X="149" Y="0"/> 
         </Polygon>
      </Element>		

 	<!-- Button-open keyboard-enter -->
		<Element>
          <Position X="3" Y="150"/>
          <FormattedText X="30" Y="8" Font="Tahoma" FontSize="8" LineSpacing="8" Adjust="LEFT" Color="#A1A9A6" Bright="Yes">
            <String>%ALT%</String>
          </FormattedText>
        </Element>	
  		<Element Name="ButtonBox">	
		  <Position X="4" Y="160"/>
		  <Rectangle Width="15" Height="15" Color="#707070" FillColor="#404040" LineWidth="1" Bright="Yes"/>			
	    </Element>
		<Element>
          <Position X="36" Y="150"/>
          <FormattedText X="30" Y="8" Font="Tahoma" FontSize="8" LineSpacing="8" Adjust="LEFT" Color="#A1A9A6" Bright="Yes">
            <String>%CLR%</String>
          </FormattedText>
        </Element>		
  		<Element Name="ButtonBox">	
		  <Position X="35" Y="160"/>
		  <Rectangle Width="15" Height="15" Color="#707070" FillColor="#404040" LineWidth="1" Bright="Yes"/>			
	    </Element>
		<Element>
          <Position X="140" Y="150"/>
          <FormattedText X="30" Y="8" Font="Tahoma" FontSize="8" LineSpacing="8" Adjust="LEFT" Color="#A1A9A6" Bright="Yes">
            <String>%DVT%</String>
          </FormattedText>
        </Element>		
 		<Element Name="ButtonBox">	
		  <Position X="140" Y="160"/>
		  <Rectangle Width="15" Height="15" Color="#707070" FillColor="#404040" LineWidth="1" Bright="Yes"/>			
	    </Element>		
		 
<Mouse>	
<!-- ENTER ALTERNATE IDENT -->
                <Area Left="4" Top="160" Width="20" Height="20">
                <Cursor Type="Hand" /> 
                <Click>33 (>L:FPEntry, enum)</Click> 
                </Area>
<!-- Departure to Destination FLIGHT PLAN BUTTON -->
		<Area Left="140" Top="160" Width="20" Height="20">
			<Cursor Type="Hand"/>
			<Click>
                'A' (>@c:IcaoSearchStartCursor)
				(L:DDEST-DTO-4,number) chr (L:DDEST-DTO-3,number) chr 
				(L:DDEST-DTO-2,number) chr (L:DDEST-DTO-1,number) chr scat scat scat (>@c:IcaoSearchEnterChar)
				0 (>@c:FlightPlanWaypointIndex)
				(@c:IcaoSearchMatchedIcaosNumber,number) 0 &gt; 
					if{ (@c:IcaoSearchCurrentICAO) (>@c:FlightPlanNewWaypointICAO) } 
				1 (>@c:FlightPlanDirectToDestination)
                0 (>L:FPEntry, enum)
				0 (>L:DDEST-DTO-1,enum) 0 (>L:DDEST-DTO-2,enum) 0 (>L:DDEST-DTO-3,enum) 0 (>L:DDEST-DTO-4,enum)
			</Click>
		</Area>
<!-- CLR- CLEAR /ABORT and CANCEL KEYBD DIRECT ENTRY -->		
		<Area Left="33" Top="160" Width="33" Height="20">
			<Cursor Type="Hand"/>
			<Click>
				0 (>L:DDEST-DTO-1,enum) 0 (>L:DDEST-DTO-2,enum) 0 (>L:DDEST-DTO-3,enum) 0 (>L:DDEST-DTO-4,enum)
				0 (>L:FPEntry, enum)
			</Click>
		</Area>		
</Mouse>
        
<Keys>
		<On Key="Alphanumeric"> <!-- DIRECT TO IDENT DIRECT KEYBOARD ENTRY -->
		<Visible>(L:FPEntry, enum) 33 ==</Visible>
			(L:DDEST-DTO-3,enum) (>L:DDEST-DTO-4,enum)		
			(L:DDEST-DTO-2,enum) (>L:DDEST-DTO-3,enum)
			(L:DDEST-DTO-1,enum) (>L:DDEST-DTO-2,enum)
			(M:Key) (>L:DDEST-DTO-1, enum) 				
	</On>
</Keys>	
</Gauge>
 
Messages
1,564
Country
thailand
Not sure of the necessity of cycle skipping in this function , I created a small test instrument that inserts a Alternate using Direct to and it works, it does not store the Alternate as a L:Var as I cannot work out how that is being done.

Hi Karol,

Cycle skipping is an issue because an ICAO transfer, which is a multi-cycle operation, is needed. As I understand Greg's objectives, the ICAO transfer (FlightPlanNewWaypointICAO => WaypointAirportICAO or FacilityICAO, for example) is needed when Greg wants to display information about the alternate airport... name, city, runways, etc ... Technically, you can get away without cycle skipping code if the WaypointAirport or Facility information is simply displayed (pp 14-15 of Guidebook). Nevertheless, an ICAO transfer is multiple cycle and runs asynchronously with the host gauge.

In Greg's gauge, the User enters the desired alternate airport Ident via keyboard. The <Keys> shift register sequence shown previously creates the alternate airport ICAO and stores it as FlightPlanNewWaypointICAO as the User types the Ident. He really doesn't need L:Var storage of the alternate airport Ident characters, per se, because the ICAO is stored.

When the Greg hits his Divert button, then

1 (>@c:FlightPlanAddWaypoint)
2 (>@c:FlightPlanDeleteWaypoint)

edits the Flight Plan and a Direct To is not needed.

I also get the idea that Greg may want to retain the original departure airport in his flight plan even after he diverts to alternate destination. A Direct To will erase the original departure airport waypoint, but the method above will not. So, I would recommend the method above. Whatever floats your boat.

Bob
 
Messages
1,564
Country
thailand
HTML:
<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>

By the way, this shows two <Update> sections. AFAIK, we are limited to one ... am I correct about that?

Bob
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
You are correct. Only the last <Update> section will ever be evaluated. The first one will be ignored.
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
FS9 xml schema supports only one <Update> per gauge, being valid only the last one in the file, as Bill stated.

FSX xml schema supports multiple <Update> sections, but they all treated as a single script. Using this method (multiple)s could lead to problems in certain circumstances.

Tom
 
Messages
278
Country
ca-britishcolumbia
In Greg's gauge, the User enters the desired alternate airport Ident via keyboard. The <Keys> shift register sequence shown previously creates the alternate airport ICAO and stores it as FlightPlanNewWaypointICAO as the User types the Ident. He really doesn't need L:Var storage of the alternate airport Ident characters, per se, because the ICAO is stored.

When the Greg hits his Divert button, then

1 (>@c:FlightPlanAddWaypoint)
2 (>@c:FlightPlanDeleteWaypoint)

edits the Flight Plan and a Direct To is not needed.

I also get the idea that Greg may want to retain the original departure airport in his flight plan even after he diverts to alternate destination. A Direct To will erase the original departure airport waypoint, but the method above will not. So, I would recommend the method above. Whatever floats your boat.

Bob

Thanks Bob you completely understand what I am trying to and thank you very much for explaining it far better than I could.

I am currently sorting out the ICAO Transfer/Cycle counting issue, using the example provided on page 26, I am trying to work through the logic that has been provided by you and presented in the guide, I know I already have a couple question, but will wait to see where I get over the next few hours

Thanks Again
Greg
 
Last edited:
Messages
278
Country
ca-britishcolumbia
Ok need some guidance,

I am sorry Bob, this is my second kick at the can with cycle counting and the first one I stopped chasing to have one item displayed and although I am pleased to finally overcome this I am struggling to understand the whole concept and how to apply it to what I am trying to achieve. Like I said using page 26 in the guide as my example to create this I will attempt to walk through this and hopefully makes sense and hope you tell me I am at least on the right track. Your guide headers will be in green as a reference to what portion I am in.

<Update>
Code:
[COLOR="SeaGreen"]<!--ICAO Search Reset-->[/COLOR]
(L:DivertToAltAP, bool) 1 == if{
   1 (>L:AltAPCycleCounterInit, enum)
  -1 (>L:AltAPICAOXferIndexPointer, enum)
  -1 (>L:AltAPICAOCycleSkipCounter, enum) 
   35 (>L:AltAPICAOCyclesToSkip, enum)
   0 (>L:FacilityLatitude, degrees) }

Ok knowing this is not a search, but a transfer of one variable group to another. I have started this <update> using my (L: DivertToAltAP, bool) since I want this information to be displayed when an Alternate Airport has been selected. The rest are the pointers and skip counter items (I believe will be required), I created (L:FacilityLatitude, degrees) for testing purposes due to the fact you cannot save string data to a an (L:Var), yes I have it now.

Code:
[COLOR="seagreen"]<!--Set Search variables-->
500 (>@c:NearestAirportMaximumItems) 
375 (>@c:NearestAirportMaximumDistance, NMiles)[/COLOR]

In my mind, I don't need this as I am not asking for or completing a search. Using the @c:FlightPlanNewWaypointICAO I have already established my Airport ICAO in the <Keys> section

Code:
[COLOR="SeaGreen"]<!--Set Aircraft Position Reference Point-->
(A:PLANE LATITUDE, degrees) (>@c:NearestAirportCurrentLatitude, degrees) 
(A:PLANE LONGITUDE, degrees) (>@c:NearestAirportCurrentLongitude, degrees)[/COLOR]

Again I don't think this is necessary due to the use of @c:FlightPlanNewWaypointICAO

<!-- Loop Through the Nearest Airport List searching for Seaplane Base, AirportKind = 3 -->

Again I am not looping or searching through any lists, but if I am correct need to point this <update> in the right direction, so have this

Code:
(L:AltAPCycleCounterInit, enum) 1 == if{

(L:AltAPICAOXferIndexPointer, enum) ++ (>L:AltAPICAOXferIndexPointer, enum)
(L:AltAPICAOXferIndexPointer, enum) (>@c:FlightPlanNewWaypointICAO) 

[COLOR="Red"][B](DONT KNOW WHAT TO PUT HERE)[/B][/COLOR] and if{
(@c:FlightPlanNewWaypointICAO) (>@c:FacilityICAO)
2 (>L:AltAPCycleCounterInit, enum) } }

to point it to @c:FlightPlanNewWaypointICAO for the ICAO transfer. Do I just put an (L:Var) here? Something like

Code:
(L:AlternateAPWaypointICAO, enum) 0 !=

where I have (DONT KNOW WHAT TO PUT HERE), I don't know this just came to me and will try it when I complete this post. I then follow with the ICAO Transfer and activate the actual cycle counter.

Code:
[COLOR="SeaGreen"]<!--After ICAO Transfer, delay accessing Waypoint Group Variables using a cycle counting technique -->[/COLOR]

(L:AltAPCycleCounterInit, enum) 2 == if{
(L:AltAPICAOCycleSkipCounter, enum) ++ (>L:AltAPICAOCycleSkipCounter, enum)
(L:AltAPICAOCycleSkipCounter, enum) (L:AltAPICAOCyclesToSkip, enum) >= if{
(@c:FacilityLatitude, degrees) (>L:FacilityLatitude, degrees)
0 (>L:AltAPCycleCounterInit, enum)
 } }

Another point I am struggling with due to I can't save string Data to (L:Vars) so what do I put here to make the Facility Ident, Name and City to display, or does the transfer complete and the information display without any further input required?

Anyway that is where I am at, hopefully on the right track and am continuing to attempt to work the logic through.

Cheers
Greg
 
Messages
1,564
Country
thailand
Hi Greg,

I certainly understand your questions and frustrations about ICAO transfers and cycle skipping and why and under what circumstances one needs to, or doesn't need to, worry about them. It's a little complicated, isn't it? IMHO, GPS and moving map gauges such as the one you are writing represent relatively sophisticated, arguably high-end XML code that requires an adequate knowledge of flight simulator's XML and a lot of comfort with the gps variables before you have success.

Which brings me to those guidebooks. I spent a fair amount of time on explanations and examples, and all the issues you are currently working are dealt with in the guides and in various xml examples from the forums. Consequently, I often re-direct questions back to the guidebooks, as you know.

That said, why don't you give this a go:

Code:
<On Key="Alphanumeric"> 
 <Visible>(L:ALTAPEntry, enum) 1 ==</Visible> 
  (L:ALT-AP-3,enum) (>L:ALT-AP-4,enum)		
  (L:ALT-AP-2,enum) (>L:ALT-AP-3,enum)
  (L:ALT-AP-1,enum) (>L:ALT-AP-2,enum)
  (M:Key) (>L:ALT-AP-1,enum) 
  'A      '  // Letter A followed by six spaces
  (L:ALT-AP-4,enum) chr scat
  (L:ALT-AP-3,enum) chr scat
  (L:ALT-AP-2,enum) chr scat
  (L:ALT-AP-1,enum) chr scat	 d
  (>@c:FlightPlanNewWaypointICAO)
  (>@c:WaypointAirportICAO)			
</On>

I have not tested duplication of the top of the stack with a string value, but I believe it will work. This sequence of code constructs the airport ICAO and then stores it into both FlightPlanNewWaypointICAO and WaypointAirportICAO. Those are ICAO transfers, by the way.

Then, when you want to display alternate airport information, simply use something like:

Code:
<Element>
 <Visible>(L:DisplayAltAPInfo, bool) 1 ==</Visible>
 <Position X="5" Y="16"/>
  <FormattedText X="120" Y="20" Adjust="left" Font="Courier New" FontSize="14" Color="white" Bright="Yes">	
   <String>City: %((@c:WaypointAirportCity))%!s!</String>
  </FormattedText>
</Element>

Here, you avoid cycle skipping code for reasons explained on pages 14 and 15 of the gps guide.

It takes a while to master this. Look, I knew zero, ZERO, about the gps module when I posted my first gps question on the FreeFlight Design forum in October 2007. Tom Aguilo answered it and to be honest, I didn't understand it then. But, he also advised (which is his mantra), "Test, test, and re-test". It's the only way to understand and to learn.

Bob
 
Messages
278
Country
ca-britishcolumbia
Hi Greg,

I certainly understand your questions and frustrations about ICAO transfers and cycle skipping and why and under what circumstances one needs to, or doesn't need to, worry about them. It's a little complicated, isn't it? IMHO, GPS and moving map gauges such as the one you are writing represent relatively sophisticated, arguably high-end XML code that requires an adequate knowledge of flight simulator's XML and a lot of comfort with the gps variables before you have success.

Which brings me to those guidebooks. I spent a fair amount of time on explanations and examples, and all the issues you are currently working are dealt with in the guides and in various xml examples from the forums. Consequently, I often re-direct questions back to the guidebooks, as you know.

Thanks Bob,
And of course you are absolutely right, but have to say a "little complicated" is an understatement. I realize that we all have to start somewhere and fortunately, for me I have had, the support of yourself and many others to guide me as I continue to attempt to learn this. As with yourself in your beginnings , I started in this knowing nothing, As to say I didn't even know what the SDK or XML was. I started by manipulating a few gauges and learned a few what to and many NOT to do's. Spent many hours searching why my sim crashed when I opened the gauge.

My first serious attempt at creating a gauge was a "simple" auxiliary power unit gauge that while using the (A:APU GENERATOR SWITCH, bool) gives the user, when the aircraft is on the ground, a ground power unit feature "separate" from the APU. Bill was instrumental in helping learn the "basics" and walked me through the process. Then finding Doug's sound gauge and was really excited when he sent me the latest version at the time, finding out that I could then add sounds to APU start, run, shut down and have the GPU run in the background. well It hooked me.

I think it truly amazing what the capabilities of all things FS can provide, even with it's limitations. Now that I have spent many hours starring at code and scratching my head why something doesn't work, I find myself getting annoyed when flying in a session and someone is ripping somebodies gauge apart without the first bit of knowledge as to what it took to create it or even better what the gauge is actually for or capable of.

Although I know I took on a massive undertaking with the NAVRAD with very limited ability, it has become a something, well an obsession anyway to make it something that is functional, easy to use and pleasant look at. With the main focus of not having to leave the cockpit (Flight Planner, Map, etc) to which I hope I am on track. unfortunately my knowledge of coding becomes a road block.

I also fully understand why you re-direct people back to your guidebooks, because yes, you already explained it AND took the time and effort to make them available for everyone as a reference tool. and to say a "fair amount of time spent" well again I believe that an understatement. It is also a more than "fair" statement to say, although I know enough to be dangerous and potentially disabling, I truly don't understand the full workings of this.

But I am ranting, well procrastinating anyway, so moving on...

That said, why don't you give this a go:

Code:
<On Key="Alphanumeric"> 
 <Visible>(L:ALTAPEntry, enum) 1 ==</Visible> 
  (L:ALT-AP-3,enum) (>L:ALT-AP-4,enum)		
  (L:ALT-AP-2,enum) (>L:ALT-AP-3,enum)
  (L:ALT-AP-1,enum) (>L:ALT-AP-2,enum)
  (M:Key) (>L:ALT-AP-1,enum) 
  'A      '  // Letter A followed by six spaces
  (L:ALT-AP-4,enum) chr scat
  (L:ALT-AP-3,enum) chr scat
  (L:ALT-AP-2,enum) chr scat
  (L:ALT-AP-1,enum) chr scat	 d
  (>@c:FlightPlanNewWaypointICAO)
  (>@c:WaypointAirportICAO)			
</On>

I have not tested duplication of the top of the stack with a string value, but I believe it will work. This sequence of code constructs the airport ICAO and then stores it into both FlightPlanNewWaypointICAO and WaypointAirportICAO. Those are ICAO transfers, by the way.

Then, when you want to display alternate airport information, simply use something like:

Code:
<Element>
 <Visible>(L:DisplayAltAPInfo, bool) 1 ==</Visible>
 <Position X="5" Y="16"/>
  <FormattedText X="120" Y="20" Adjust="left" Font="Courier New" FontSize="14" Color="white" Bright="Yes">	
   <String>City: %((@c:WaypointAirportCity))%!s!</String>
  </FormattedText>
</Element>

I tried this when I first woke up, and on the surface it never worked "for me". I will admit haven't spent a lot of time and will pursue this more today, because I am sure it will work, just have to get the logic right.

but back to cycle counting and displays, if I may.

First I truly want to unravel the mystery in my head with this, because I think if I unlock this "mystery" in my head it could potentially open up huge potential when manipulating the gps module.

on my flight planner page the display string is this
Code:
<String>%FLIGHT PLANNER\n\n
          %DEPARTURE AIRPORT:\t\t\t%(0 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointIdent))%{if}%((@c:FlightPlanWaypointIdent))%!s!\t\t
          %{else}%Flight is Direct To%{end}%\n
          %(0 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:FacilityICAO) (@c:FacilityName))%!s!\t\t\t\t
          %(0 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:FacilityICAO) (@c:FacilityName) (@c:FacilityCity))%!s!\n\n
          %DESTINATION AIRPORT:\t\t\t%(1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointIdent))%!1s!\n
          %(1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:WaypointAirportICAO) (@c:WaypointAirportName))%!s!\t\t\t\t
          %(1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:WaypointAirportICAO) (@c:WaypointAirportCity))%!s!\n\n
          %ALTERNATE AIRPORT:\t\t\t%((L:DivertToAltAP,bool) 1 ==)%{if}%((@c:FacilityIdent))%!s!\n
          %((@c:FacilityName))%!s!\t\t\t\t
          %((@c:FacilityCity))%!s!%{else}
          %NOT SELECTED%{end}%\n\n
          %DISTANCE TO DESTINATION:\t\t%((@c:FlightPlanWaypointDistanceTotal, nmiles))%!.1f!\{dpl=nm}\n
          %HEADING TO DESTINATION:\t\t%((@c:FlightPlanWaypointMagneticHeading, degrees))%!03d!\{dplo=M}\n    
        </String>

Now the hurdle I face, If I understand it right, is displaying multiple incidents of the same data groups in the same display page, which I originally overcame by:

Code:
0 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:FacilityICAO) (@c:FacilityName)
1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:WaypointAirportICAO) (@c:WaypointAirportName)

Having 0 (>@c:FlightPlanWaypointIndex) utilize the Facility Group and 1 (>@c:FlightPlanWaypointIndex) utilize the Waypoint Airport Group which alleviated any conflict of the two by separating the ICAO transfers to their respective Data Groups.

With the Edition of the Alternate Airport, I now have created a situation where I need to access the information of the same data group, enter cycle counting.

It would be so much simpler if I could:

Code:
0 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:FacilityICAO) (@c:FacilityName)
1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:WaypointAirportICAO) (@c:WaypointAirportName)
(@c:FlightPlanNewWaypointICAO) (>@c:WaypointAirportICAO) (@c:WaypointAirportName)

No point going here, because I can't, so back to cycle counting.

When I awoke this morning from the couch where I fell asleep with the guidebook, Ironically woke up to page 15. When I realized my

Code:
(L:AltAPCycleCounterInit, enum) 1 == if{

(L:AltAPICAOXferIndexPointer, enum) ++ (>L:AltAPICAOXferIndexPointer, enum)
(L:AltAPICAOXferIndexPointer, enum) (>@c:FlightPlanNewWaypointICAO) 
(L:AlternateAPWaypointICAO, enum) == if{
(@c:FlightPlanNewWaypointICAO) (>@c:FacilityICAO)
2 (>L:AltAPCycleCounterInit, enum) } }

will never work, because I am not dealing with an Index Pointer I am dealing with a set variable, although the information is stored there the gps has nothing to index to, I really hope this is right.

Originally that is why I thought about using Robbie's macros to avoid any conflict by adding the ability to store string data to (L:Vars) and just inserting
@ToString(L: DisplayThis) and @ToString(L: DisplayThat), because I could not figure out cycle counting on my last round.

So if I pursue this approach, after I work with you latest suggestion Bob, I need to figure out how to access my stored information in the cycle counter update.

My thoughts, but really need to stop procrastinating and get to work on this.

Thanks Again for everything,

Greg
 
Last edited:

taguilo

Resource contributor
Messages
1,585
Country
argentina
Greg,

I've spent some time inspecting your code and trying to figure out your intentions with this gauge.

If it may be of some usefulness, I think you can follow this approach:

(1) The user wants to enter an alternate airport, then:
-Press the SET ALT AP Button

Code (Button):
Code:
<Area etc>
  <Visible>(L:SetAltApButton,bool)</Visible> 
  <Click>
    0   (>L:ALT-AP-4,enum) 
    0   (>L:ALT-AP-3,enum)
    0   (>L:ALT-AP-2,enum)
    0   (>L:ALT-AP-1,enum)
    0 (>L:SetAltApButton,bool)
    1 (>L:EnterAltApButton,bool)
<Click>

(2) A visual frame displays, where the user enter the Airport ident by typing:

Code:
<Keys>
  <Visible>(L:EnterAltApButton,bool)</Visible>
  (L:ALT-AP-3,enum) (>L:ALT-AP-4,enum)		
  (L:ALT-AP-2,enum) (>L:ALT-AP-3,enum)
  (L:ALT-AP-1,enum) (>L:ALT-AP-2,enum)
  (M:Key) (>L:ALT-AP-1,enum)  
</Keys>

There is NO gps transfer here because it is not needed yet.

As the user types the code, it is shown within the frame:

Code:
<Element>
  <Visible>(L:EnterAltApButton,bool)</Visible>
  <String>%((L:ALT-AP-4,enum) chr (L:ALT-AP-3,enum) chr scat (L:ALT-AP-2,enum) chr scat (L:ALT-AP-1,enum) chr scat)%!s!%</String>

Once finished, the user presses the Confirm Alternate Airport button:

Code:
<Area etc>
  <Visible>(L:EnterAltApButton,bool)</Visible>
  <Click>
     'A      '  // Letter A followed by six spaces
     (L:ALT-AP-4,enum) chr scat
     (L:ALT-AP-3,enum) chr scat
     (L:ALT-AP-2,enum) chr scat
     (L:ALT-AP-1,enum) chr scat	
     (>@c:FacilityICAO,string) 
     1 (>L:SetAltApButton,bool)
     0 (>L:EnterAltApButton,bool)
     1 (>L:DivertToAltAP,bool)
 <Click>

ICAO transfer is commanded at this stage.

Now, the FLIGH PLANNER page shows both Destination and Alternate:
(From your code)

Code:
<String>%FLIGHT PLANNER\n\n
          %DEPARTURE AIRPORT:\t\t\t%(0 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointIdent))%{if}%((@c:FlightPlanWaypointIdent))%!s!\t\t
          %DESTINATION AIRPORT:\t\t\t%(1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointIdent))%!1s!\n
          %(1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:WaypointAirportICAO) (@c:WaypointAirportName))%!s!\t\t\t\t
          %(1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:WaypointAirportICAO) (@c:WaypointAirportCity))%!s!\n\n
          %ALTERNATE AIRPORT:\t\t\t%((L:DivertToAltAP,bool) 1 ==)%{if}%((@c:FacilityIdent))%!s!\n
          %((@c:FacilityName))%!s!\t\t\t\t
          %((@c:FacilityCity))%!s!%{else}
          %NOT SELECTED%{end}%\n\n
          %DISTANCE TO DESTINATION:\t\t%((@c:FlightPlanWaypointDistanceTotal, nmiles))%!.1f!\{dpl=nm}\n
          %HEADING TO DESTINATION:\t\t%((@c:FlightPlanWaypointMagneticHeading, degrees))%!03d!\{dplo=M}\n    
        </String>

If the user needs to divert to the Alternate, just:
-Press DIVERT TO ALTERNATE button:

Code:
<Area etc>
  <Visible>(L:DivertToAltAP,bool)</Visible>
  <Click>
     (@c:FacilityICAO,string) (>@c:FlightPlanNewWaypointICAO,string)	
     (@c:FlightPlanWaypointsNumber,number) (>@c:FlightPlanAddWaypoint,number)
     (@c:FlightPlanWaypointsNumber,number) 1 - (>@c:FlightPlanDeleteWaypoint,number)
     0 (>L:DivertToAltAP,bool)
  <Click>

This is a basic layout, extra code should be added to manage routine controls (ie Alternate not found, etc)

Hope this helps,

Tom
 
Last edited:
Messages
278
Country
ca-britishcolumbia
Thanks Tom,
I apologize for the delayed response, family responsibilities prevented me from working on this yesterday. I will try your approach today and post my results later. Thanks again to everyone for providing me with your time and efforts.

Greg
 
Messages
278
Country
ca-britishcolumbia
First and foremost I would like to thank EVERYONE, that has helped me. Really this post and all the others has provided me with a wealth of information, unfortunately for me my experience level is not there to truly understand it and make it work, but that has not stopped anyone from prodding me along, for that I am truly grateful.

So what I ended up doing is, and sorry Bob I just could not get it at this point, was use Robbie McElrath's set of macros. I understand it may not be the best course of action, but it eliminated the need for cycle counting and any conflicts on the Flight Planner Page. I fully intend to pursue the cycle counting route, because I think If I can figure that out, it would open up a whole new world to me with items I would like to have my gauges display. This Post is already saved in my favorites to continue to develop my skills, because everything I need is here, just need to put it all in perspective or understand it anyway.

So what the code turned out like is the following:

Element Section:
Code:
        <String>%FLIGHT PLANNER\n\n
          %DEPARTURE AIRPORT:\t\t\t%(0 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointIdent))%{if}%((@c:FlightPlanWaypointIdent))%!s!\t\t
          %{else}%Flight is Direct To%{end}%\n
          %(0 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:FacilityICAO) (@c:FacilityName))%!s!\t\t\t\t
          %((@c:FacilityCity))%!s!\n\n
          %DESTINATION AIRPORT:\t\t\t%(1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointIdent))%!1s!\n
          %(1 (>@c:FlightPlanWaypointIndex) (@c:FlightPlanWaypointICAO) (>@c:WaypointAirportICAO) (@c:WaypointAirportName))%!s!\t\t\t\t
          %((@c:WaypointAirportCity))%!s!\n\n
          %ALTERNATE AIRPORT:\t\t\t%((L:DivertToAltAP,bool) 1 ==)%{if}%(@ToString(L:AltAP_IDENT))%!s!%\n
          %(@ToString(L:AltAP_Name))%!s!\t\t\t\t
          %(@ToString(L:AltAP_City))%!s!%{else}
          %NOT SELECTED%{end}%\n\n
          %DISTANCE TO DESTINATION:\t\t%((@c:FlightPlanWaypointDistanceTotal, nmiles))%!.1f!\{dpl=nm}\n
          %HEADING TO DESTINATION:\t\t%((@c:FlightPlanWaypointMagneticHeading, degrees))%!03d!\{dplo=M}\n    
        </String>

Mouse Section - For the Flight Planning Portion
Code:
<!--**************** Flight Planner Display for Version 2****************-->
<!-- ENTER DESTINATION IDENT -->
  <Area Left="648" Top="635" Width="100" Height="25">
  <Visible>(L:FlightPlanDisplay,bool)</Visible>
  <Cursor Type="Hand" /> 
  <Click>
  1 (>L:EnterFPDest, bool)
  1 (>L:FPEntry, enum)  
</Click>  
  </Area>
<!-- Departure to Destination FLIGHT PLAN BUTTON -->
  <Area Left="478" Top="635" Width="100" Height="25">
    <Visible>(L:EnterFPDest, bool)</Visible>
    <Cursor Type="Hand"/>
    <Click>
(A:SIM ON GROUND,bool) 1 == if{
    0 (>L:EnterFPDest, bool)
    'A' (>@c:IcaoSearchStartCursor)<!-- STEP 1  -->	
    (L:DDEST-DTO-4,number) chr (L:DDEST-DTO-3,number) chr 
    (L:DDEST-DTO-2,number) chr (L:DDEST-DTO-1,number) chr scat scat scat (>@c:IcaoSearchEnterChar) 
    0 (>@c:FlightPlanWaypointIndex)
    (@c:IcaoSearchMatchedIcaosNumber,number) 0 &gt; 
    if{ (@c:IcaoSearchCurrentICAO) (>@c:FlightPlanNewWaypointICAO) } 
    1 (>@c:FlightPlanDirectToDestination)
    0 (>L:FPEntry, enum)
    0 (>L:DDEST-DTO-1,enum) 0 (>L:DDEST-DTO-2,enum) 0 (>L:DDEST-DTO-3,enum) 0 (>L:DDEST-DTO-4,enum)				
    0 (>@c:NearestAirportCurrentLine)
    (@c:NearestAirportCurrentICAO) (>@c:FlightPlanNewWaypointICAO)
    1 (>@c:FlightPlanAddWaypoint)
    0 (>@c:FlightPlanWaypointIndex) (>@c:FlightPlanDeleteWaypoint) }
els{  0 (>L:EnterFPDest, bool)
    'A' (>@c:IcaoSearchStartCursor)<!-- STEP 1  -->	
    (L:DDEST-DTO-4,number) chr (L:DDEST-DTO-3,number) chr 
    (L:DDEST-DTO-2,number) chr (L:DDEST-DTO-1,number) chr scat scat scat (>@c:IcaoSearchEnterChar) 
    0 (>@c:FlightPlanWaypointIndex)
    (@c:IcaoSearchMatchedIcaosNumber,number) 0 &gt; 
    if{ (@c:IcaoSearchCurrentICAO) (>@c:FlightPlanNewWaypointICAO) } 
    1 (>@c:FlightPlanDirectToDestination)
    0 (>L:FPEntry, enum)
    0 (>L:DDEST-DTO-1,enum) 0 (>L:DDEST-DTO-2,enum) 0 (>L:DDEST-DTO-3,enum) 0 (>L:DDEST-DTO-4,enum) }
</Click>
  </Area>
<!-- CLR- CLEAR /ABORT and CANCEL KEYBD DIRECT ENTRY -->		
  <Area Left="308" Top="635" Width="100" Height="25">
  <Visible>(L:EnterFPDest, bool)</Visible>
  <Cursor Type="Hand"/>
  <Click>
  0 (>L:DDEST-DTO-1,enum) 0 (>L:DDEST-DTO-2,enum) 0 (>L:DDEST-DTO-3,enum) 0 (>L:DDEST-DTO-4,enum)
  </Click>
 </Area>		
  <Area Left="132" Top="635" Width="100" Height="25">
  <Visible>(L:EnterFPDest, bool)</Visible>
  <Cursor Type="Hand"/>
  <Click>
  0 (>L:FPEntry, enum)
  0 (>L:EnterFPDest, bool)
  </Click>
 </Area>

At this point when the Flight Planning Feature is activated the initial screen appears like this:

attachment.php


When the "Create Button is pushed, the user enters the Ident of the desired "Destination Airport" and presses "Enter"

attachment.php


Which gives them the Departure Airport and Destination Airport information. The Departure Airport utilizes a nearest search of airports while the aircraft is on the ground. Should the aircraft be in the air when a Flight Plan is created the "Departure Airport" will display "Flight Plan is Direct To"

attachment.php


Now the user may push the "SET ALT AP" button and a new screen appears providing a list of ten airports near the programmed "destination".

Element Section:
Code:
      <String>
        AIRPORTS NEAREST TO DESTINATION\n\n
        %((@c:NearestAirportItemsNumber) s2 0 !=)
	%{if}
	%((L:AltAPScrollStart,enum) sp1 (L:AltAPScrollEnd,enum) l2 min sp3)
        %{loop}
        %(l1 (>@c:NearestAirportCurrentLine))\{clr}%((@c:NearestAirportCurrentLine))%!-5d!\t
        %((@c:NearestAirportCurrentIdent))%!1s!%\{nr}\t\t-\t
        %((@c:NearestAirportCurrentLine) (>@c:NearestAirportSelected) (@c:NearestAirportSelectedAirportName))%!s!\n
        Class:\t%((@c:NearestAirportCurrentLine) (>@c:NearestAirportSelected) (@c:NearestAirportCurrentAirportKind))%{case}
        %{:0}Unkown%{:1}Hard%{:2}Soft%{:3}Water%{:4}Helipad%{:5}Private%{end}\n
        Longest Runway Direction:\t%((@c:NearestAirportCurrentLongestAirportDirection, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d!\{dplo=m}\n\n%
        Bearing:\t\t\t%((@c:NearestAirportCurrentTrueBearing, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d!\{dplo=M}\t\t\t\t\t
        Distance:\t\t\t%((@c:NearestAirportCurrentDistance, nmiles))%!.1f!\{dpl=nm}\n\n
        Recommended\tApproach:\t\t
        %((@c:NearestAirportCurrentLine) (>@c:NearestAirportSelected) (@c:NearestAirportCurrentBestApproachEnum))%{case}
        %{:0}SALS%{:1}VFR%{:2}HEL%{:3}TACAN%{:4}NDB%{:5}LORAN%{:6}RNAV%{:7}VOR%{:8}GPS%{:9}SDF%{:10}LDA%{:11}LOC%{:12}MLS%{:13}ILS%{end}\n
        Elevation:\t\t
        %((@c:NearestAirportCurrentLine) (>@c:NearestAirportSelected) (@c:NearestAirportSelectedAirportElevation, feet))%!d!\{dpl=ft}\n
        Runway\tLength:\t\t
        %((@c:NearestAirportCurrentLongestRunwayLength, feet))%!d!\{dpl=ft}\n
        Runway\tType:\t\t
        %((@c:NearestAirportCurrentLine) (>@c:NearestAirportSelected) (@c:NearestAirportSelectedRunwaySurface))%{case}
        %{:1}Concrete%{:2}Asphalt%{:101}Grass%{:102}Turf%{:103}Dirt%{:104}Coral%{:105}Gravel%{:106}Oil%{:107}Steel
        %{:108}Bituminus%{:109}Brick%{:110}Macadam%{:111}Planks%{:112}Sand%{:113}Shale%{:114}Tarmac%{:115}Snow%{:116}Ice%{:201}Water%{end}\n\n
        Communications:\n\n
        %((@c:NearestAirportCurrentComFrequencyName))%!5s!\t\t\t\t\t\t
        %((@c:NearestAirportCurrentComFrequencyValue, MHz))%!8.2f!
        %(l1 ++ s1 l3 &lt; d)
        %{end}
        %{next}
        %{end}
      </String>

Mouse Section:
Code:
<!--**************** Flight Planner (MAin Menu) Page for Version 2****************-->

<Area Left="365.000" Top="350.000" Width="200" Height="40">
  <Visible>(L:AirportInfoMenu,bool)</Visible>
  <Cursor Type="Hand"/>
  <Tooltip>DESTINATION AIRPORT INFO</Tooltip>
  <Click>
    0 (>L:AirportInfoMenu,bool) 
    0 (>L:MFDMainMenu,bool)
    1 (>L:FlightPlanDisplay, bool)
    0 (>L:SetAlternateAP,enum) 
    0 (>L:AltAirportInit,bool)
    0 (>L:NearestAirportInit,bool)
    1 (>L:FPAirportInit,bool)
  </Click>  
</Area>
<Area Left="132.000" Top="635.000" Width="100" Height="25">
    <Visible>(L:FlightPlanDisplay, bool) 1 == (L:EnterFPDest, bool) 0 == &amp;&amp;</Visible>
    <Cursor Type="Hand"/>
    <Tooltip>DEPARTURE AIRPORT INFO</Tooltip>
    <Click>
    0 (>L:FlightPlanDisplay, bool)
    1 (>L:DepAirportDisplay,bool)
    </Click>  
  </Area>
<Area Left="308.000" Top="635.000" Width="100" Height="25">
    <Visible>(L:FlightPlanDisplay, bool) 1 == (L:EnterFPDest, bool) 0 == &amp;&amp;</Visible>
    <Cursor Type="Hand"/>
    <Tooltip>DESTINATION AIRPORT INFO</Tooltip>
    <Click>
    0 (>L:FlightPlanDisplay, bool)
    1 (>L:DestAirportDisplay,bool)
    </Click>  
  </Area>
<Area Left="478.000" Top="635.000" Width="100" Height="25">
  <Visible>(L:FlightPlanDisplay, bool) 1 == (L:EnterFPDest, bool) 0 == &amp;&amp;</Visible>
  <Cursor Type="Hand"/>
  <Tooltip>ALTERNATE AIRPORT INFO</Tooltip>
  <Click>
    0 (>L:FlightPlanDisplay, bool)
    1 (>L:SetAlternateAP,bool) 
    1 (>L:SetAlternateAP,enum)
    0 (>L:NearestAirportInit,bool)
    0 (>L:FPAirportInit,bool)
    1 (>L:AltAirportInit,bool)
  </Click>  
</Area>
 <Area Left="685.000" Top="725.000" Width="100" Height="45">
    <Visible>(L:SetAlternateAP,bool)</Visible>
    <Cursor Type="UpArrow" Repeat="Yes"/>
    <Tooltip>SCROLL UP</Tooltip>
    <Click Kind="LeftSingle" Repeat="Yes">
      (L:AltAPScrollStart,enum) --  max (>L:AltAPScrollStart,enum)
      (L:AltAPScrollStart,enum) ++ (>L:AltAPScrollEnd,enum)
    </Click>  
  </Area>
  <Area Left="685.000" Top="770.000" Width="100" Height="45">
    <Visible>(L:SetAlternateAP,bool)</Visible>
    <Cursor Type="DownArrow" Repeat="Yes"/>
    <Tooltip>SCROLL DOWN</Tooltip>
    <Click Kind="LeftSingle" Repeat="Yes">
      (L:AltAPScrollEnd,enum) ++ (@c:NearestAirportItemsNumber) min (>L:AltAPScrollEnd,enum)
      (L:AltAPScrollEnd,enum) -- (>L:AltAPScrollStart,enum)
    </Click>  
  </Area>
<!-- Select Alternate AP-->
  <Area Left="648" Top="635" Width="100" Height="25">
  <Visible>(L:SetAlternateAP,bool)</Visible>
  <Cursor Type="Hand" /> 
  <Click>
  1 (>L:EnterAltAP, bool)
  1 (>L:ALTAPEntry, enum)
  0 (>L:ALT-AP-1,enum) 0 (>L:ALT-AP-2,enum) 0 (>L:ALT-AP-3,enum) 0 (>L:ALT-AP-4,enum)
  @Clear(L:AltAP_IDENT) @Clear(L:AltAP_Name) @Clear(L:AltAP_City)
</Click>  
  </Area>
<!-- Set Alternate Airport BUTTON -->
  <Area Left="478" Top="635" Width="100" Height="25">
    <Visible>(L:EnterAltAP, bool)</Visible>
    <Cursor Type="Hand"/>
<Click> 
 @Clear(L:AltAP_IDENT) (@c:WaypointAirportIdent, string) @FromString(L:AltAP_IDENT)
 @Clear(L:AltAP_Name) (@c:WaypointAirportName, string) @FromString(L:AltAP_Name)
 @Clear(L:AltAP_City) (@c:WaypointAirportCity, string) @FromString(L:AltAP_City)
    0 (>L:EnterAltAP, bool)
    0 (>L:ALTAPEntry, enum) 
    0 (>L:SetAlternateAP,bool)	
    1 (>L:FlightPlanDisplay,bool)			
    1 (>L:DivertToAltAP,bool)		
</Click>
</Area>
<Area Left="308" Top="635" Width="100" Height="25">
  <Visible>(L:EnterAltAP, bool)</Visible>
  <Cursor Type="Hand"/>
  <Click>
   0 (>L:ALT-AP-1,enum) 0 (>L:ALT-AP-2,enum) 0 (>L:ALT-AP-3,enum) 0 (>L:ALT-AP-4,enum)
   @Clear(L:AltAP_IDENT) @Clear(L:AltAP_Name) @Clear(L:AltAP_City)
  </Click>
 </Area>		
  <Area Left="132" Top="635" Width="100" Height="25">
  <Visible>(L:EnterAltAP, bool)</Visible>
  <Cursor Type="Hand"/>
  <Click>
  0 (>L:ALTAPEntry, enum) 
  0 (>L:EnterAltAP, bool) 
  </Click>
 </Area>
  <Area Left="648" Top="325" Width="100" Height="25">
  <Visible>(L:FlightPlanDisplay, bool) 1 == (L:DivertToAltAP,bool) 1 == &amp;&amp;</Visible>
  <Cursor Type="Hand" /> 
  <Click> 
    1 (>@c:FlightPlanAddWaypoint)
    2 (>@c:FlightPlanDeleteWaypoint)
    0 (>L:EnterAltAP, bool)
    0 (>L:DivertToAltAP,bool) 
</Click>  
  </Area>

Key Section:
Code:
<!--**************** Set Alternate Airport ****************-->
<On Key="Alphanumeric"> 
 <Visible>(L:EnterAltAP, bool) 1 ==</Visible> 
  (L:ALT-AP-3,enum) (>L:ALT-AP-4,enum)		
  (L:ALT-AP-2,enum) (>L:ALT-AP-3,enum)
  (L:ALT-AP-1,enum) (>L:ALT-AP-2,enum)
  (M:Key) (>L:ALT-AP-1,enum) 
  'A      '
  (L:ALT-AP-4,enum) chr scat
  (L:ALT-AP-3,enum) chr scat
  (L:ALT-AP-2,enum) chr scat
  (L:ALT-AP-1,enum) chr scat    d
  (>@c:FlightPlanNewWaypointICAO)
  (>@c:WaypointAirportICAO)
  @ReadKB(L:AltAP_IDENT)
  @ReadKB(L:AltAP_Name)	
  @ReadKB(L:AltAP_City)		
</On>

attachment.php


From this point the user may enter an Ident from the provided list or any Ident of there choice, for that matter, by pressing the "Set Alt" button

attachment.php


When the "Enter" button is pressed the gauge returns to the Flight Planner page now displaying the Alternate Airport information as well as a "Divert" button.

attachment.php


Now all the user has to do to re-direct to the inputted alternate is press the "Divert" button and the Flight Planner resets the Alternate Airport segment and changes the destination airport.

attachment.php



I know this was not the recommended approach, but after countless hours trying to make the other approaches succeed, I will admit I threw in the towel. Although I feel all is not lost with this route, because it does open some doors to add other information inputs without the need for cycle counting. At the end of the day I feel really need to learn and UNDERSTAND what I am actually doing instead of "winging it".

Which leads me to another question. I know there is no "XML Coding for Dummies" available, but does anyone know of a self study guide for beginners that would provide a solid basis when approaching similar coding. I looked on-line at the continuing studies at our University and College, but they appear to offer nothing as far as an introduction to coding goes.

Again I thank you all, and really could not have made it this far without any of you.

Take care and all the best
Greg
 

Attachments

  • Screenshot.jpg
    Screenshot.jpg
    140.6 KB · Views: 678
  • Screenshot1.jpg
    Screenshot1.jpg
    147 KB · Views: 725
  • Screenshot2.jpg
    Screenshot2.jpg
    156 KB · Views: 649
  • Screenshot3.jpg
    Screenshot3.jpg
    133 KB · Views: 688
  • Screenshot4.jpg
    Screenshot4.jpg
    143.3 KB · Views: 677
  • Screenshot5.jpg
    Screenshot5.jpg
    153.2 KB · Views: 705
  • Screenshot6.jpg
    Screenshot6.jpg
    141.7 KB · Views: 686
Last edited:
Messages
129
Country
us-indiana
Hello Swift39. I can't tell but did you get your alternate airport to work? Have you looked at F111's DAT49? I must be honest, I gleaned much from F111 Dat49.xml. I do not know from whom he learned but he did a great job of adding an airport. I didn't really need the military look so I made an "Add Airport" gauge to learn. I looked at the above code and if you got it working, that is great! It seems really complicated though. Perhaps for someone who wants something simpler, I'm attaching a working gauge, again most of the the logic credit goes to F111. This gauge was a stepping stone to be able to add any waypoint to an existing FS's *.pln while flying. The default GPS500 really has a lot going on, except adding and deleting waypoints. I also don't like its knobs so I made a CDU for the GPS500 so I could use a keypad. I have a touchscreen monitor so this was easier. When I insert the added airport after the previous destination airport, GPS500 automatically makes available the last airport's approach procedures. The purchased FMC's from Friendly Panels, the UFMC I got from avsim.su, and the HoneywellFMC do not do this. They obviously show the new waypoint but if the destination airport's approach procedure was loaded or active, it stays there. They are xml gauges so I suppose one could modify them but I like many of the GPS500's features. I also added features from UFMC of NAVDATA to my modified GPS500 so its about as a complete FMC as can be using FS's flight plan and its associated autopilot. I do have one area of confusion of the UFMC (and others). I cannot determine how the blinker gets setup. I see the macros and (for DTO) the data entry line, but I can't tell how the setup is done. Fortunately when I imported them, the blinker fell in a convenient place. But I can't see how to position the blinker and get it ready for input - the next hurdle. Hmm. just found out I can't add a *.cab file. Strange for an FS website. Let's try a *.zip file.. Maybe someone knows why a cab is used in FS. For me, every cab is opened and the contents are put into a folder as I attempt to either learn or make modifications. I have a slow and old computer but I do not see any slowdown in FS9 to do so.
 

Attachments

  • AddAprt.zip
    27 KB · Views: 168
Messages
1,564
Country
thailand
Greg may not pick up this thread as it's been years since he was active.

Anyway, it's trivial to delete or add waypoints to a flight plan. In the case of an alternate airport, it's simple to delete the original destination airport and replace it with an alternate, or just add an alternate after the original if you don't want to delete the original destination airport waypoint.

Likewise, it's very simple to list the approaches and transitions of the new (alternate) airport, select the ones you want, load and activate.

In the guidebook, read through the pages on NewWaypointGroup: Creating and Editing a Flight Plan and NewApproach Group: Adding or Changing an Approach.

Bob
 
Messages
129
Country
us-indiana
Hello. Thank you for your reply. Yes, I must agree that the Guidebook is very useful. I think people that make up the Guidebooks are extremely smart. However, people that write these guidebooks, like Pete Dowson of FSUIPC, etc., know so much and for them, what seems simple or intuitive to that person may not be to others. Sometimes it can be a manner of an interpretation of a word. or phrase as well. So when you say it's trivial, it may be to you but I assure you, it has not been for me. But I also could not do it without the Guidebook, so thanks is in order. Also thanks to many of the XML gauge makers (like F111).
I was wondering, are you the same person associated with the: CustomDraw Map Guidebook?
If so, starting on page 106, I saw the math for: the short axis (Y axis) scale but not for the long side. In addition, it is shown that a 1600 x 900 monitor had a 4:2.25 ratio. Wouldn't had been easier to say 16:9? And finally, I also could not get the mouse part on examplestationarymap1.xml to work when trying to get mouse coordinates. It wasn't intuitive to me anyway but I will get back and try again. It does seem to be a complicated way though, for me at least. Any time I need to find coordinates with any gauge or panel, I use a couple of tools - more comment on this later. The first thing I do is find out the size of the gauge or panel [*.bmp size (MSPaint's attributes)] . I then use MB-Ruler and referencing that gauge or panel, with FS running, I re-size that panel or gauge to fit it's pixel information I got from MSPaint. And this works for the GPS500 as well. Starting with a gauge called: Nav Info, I modified the gauge where I can select which waypoint of an FS flight plan I want to be shown in the center. Many paid gauges have this feature in their ND as plan mode. But I also wanted to see the aircraft in its current location. I used the above technique to find pixel locations between two known coordinates and then, with some math, move the aircraft to its appropriate place. I've attached a picture. To be honest, by doing it this way, the GPS500's map was small but MB-Ruler has a magnifier and it worked out well and is relatively fast to do. Now about tools for FS. I am not a graphics person at all. All of my gauges could use professional aesthetics. I have found many tools that make working with FS easier. I do not know if fsdeveloper has a list or place for these tools but it could be handy for others - just a thought. Again, thank you very much for your valuable time and information.
 

Attachments

  • NavMap Center.JPG
    NavMap Center.JPG
    144.9 KB · Views: 235
Top