Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Setting Departure & Destination with XML?

Featured Replies

I believe you're saying that if I did: 'A_ _ _ _ _ _' (>@c:IcaoSearchStartCursor) should refine the search to just Airports - although I'm not sure I've got it perfectly right.
Not quite. If the airport ident is KORD for example, then its ICAO is 'A_ _ _ _ _ _KORD' - that's 'A' followed by six spaces followed by the airport Ident. There you have the full airport ICAO without doing an IcaoSearch. You can get away with using this shortcut only for airports.
'A  	' (L:FMC-UNIT-1,enum) chr scat (L:FMC-UNIT-2,enum) chr scat(L:FMC-UNIT-3,enum) chr scat(L:FMC-UNIT-4,enum) chr scat(>@c:WaypointAirportICAO)(@c:WaypointAirportRunwaysNumber) 0 >    	if{             	(@c:WaypointAirportLatitude, degrees) (>L:FMC-POS-REF-ARPT-LAT,degrees)            	(@c:WaypointAirportLongitude, degrees) (>L:FMC-POS-REF-ARPT-LON,degrees)    	}

So you're saying that I is impossible to set the departure airport and destination via xml? Even if I were to some how figure out a way to add a waypoint to the current flight and make that waypoint the departure airport?
Editing the Flight Plan to change the departure airport will not give you very satisfying results* even though editing a loaded Flight Plan to add a new waypoint is a very simple process. Adding a new waypoint to a loaded flight plan is a two step process that involves defining the latitude and longitude of the new waypoint to be added, followed by assigning a waypoint index for the new waypoint (where the new en route waypoint will be inserted in the Flight Plan). There are a few approaches for specifying Lat and Lon:
  • Enter the new waypoint lat and lon degrees or radians directly (necessary for custom waypoints)
  • Enter the new waypoint ICAO, from which lat and lon will automatically be accessed by fs9gps
    • Enter the full ICAO directly (usually not a very realistic experience).
    • Enter the new waypoint facility (airport, navaid or intersection) Ident followed by an ICAO search that determines the unique ICAO, from which lat and lon will be automatically accessed.
    • For airport waypoints, enter the airport Name followed by NameSearch which can be used to find the airport ICAO

The second step is the FlightPlanAddWaypoint statement. It requires an argument, which in your case, is 0 (zero - the Index pointer for a departure airport). The following would work:

'A  	' (L:FMC-UNIT-1,enum) chr scat (L:FMC-UNIT-2,enum) chr scat(L:FMC-UNIT-3,enum) chr scat(L:FMC-UNIT-4,enum) chr scat(>C:fs9gps:FlightPlanNewWaypointICAO)0 (>C:fs9gps:FlightPlanAddWaypoint)  

Now, your new airport is the departure airport in your Flight Plan.* Will you like the results? I doubt it.

  1. Whatever had been the departure airport before you added the new departure airport just became WaypointIndex 1. Simple enough to delete it using FlightPlanDeleteWaypoint.
  2. The Lat and Lon retrieved from WaypointAirportLatitude and Longitude is the center of the runway, or in the case of multiple runways, the center of the runway complex. So, you will begin your flight parked at the wrong place rather than at a gate or at the departure end of a runway. You could use WaypointAirportRunwayLatitude and Longitude instead, but then you will first need to specify which runway using WaypointAirportCurrentRunway. Add to that, you almost certainly will not be at the correct altitude -- maybe underground, maybe 500 feet above the airport. You would also have to take care of the new altitude.
  3. Actually, you won't even begin your flight there, because the aircraft is still at the original departure airport. How are you going to move the aircraft to the new departure airport?

Anyway, you can probably see that editing the Flight Plan (in xml) to change the departure airport is not necessarily going to be a realistic sim experience.Bob

  • Replies 89
  • Views 15k
  • Created
  • Last Reply

Top Posters In This Topic

  • Author
  • Commercial Member

Bob,It seems I've improperly explained my intentions. I did not intend to change the position of the aircraft in any sense, not mess with any structure such as that pertaining to FS. All I wished to achieve was to create a flight plan with a departure and destination airport as the first and last waypoints of a flight plan respectively with my gauge.In further detail all it is, is a FMC with a RTE page for which one I've entered the Origin and Destination airports and I click activate thence the EXEC button thus setting the first waypoint which would be index 0 to the four figure origin airport and the second waypoint index 1 to the destination airport.What you've explained I believe to be very useful for me and I will see to it to implement it within the following days, and will report back.Thank You for you help, I am greatly appreciative for all of your efforts.

Good Day,

Engjell Berisha

 

Angel-Simulations-Small.png

Editing the Flight Plan to add or delete an en route waypoint like a new destination airport is easy enough, its just that its problematic to consider doing this for the departure airport.Try it and you'll see what I mean.

  • 2 weeks later...
  • Author
  • Commercial Member
(L:FMC-RTE-1,enum) 1 == if{ (L:FMC-RTE-1-ACT,enum) 0 == (L:FMC-RTE-1-READY,enum) 1 == (L:FMC-RTE-1-ACTIVATE,enum) 1 == and and if{ 'A' (>@c:IcaoSearchStartCursor) (L:FMC-RTE-DEST-1,number) chr (L:FMC-RTE-DEST-2,number) chr (L:FMC-RTE-DEST-3,number) chr (L:FMC-RTE-DEST-4,number) chr scat scat scat (>@c:IcaoSearchEnterChar) (@c:IcaoSearchMatchedIcaosNumber) 0 > if{ (@c:IcaoSearchCurrentIcao) (>@c:FacilityICAO) } (@c:FlightPlanWaypointIndex) 0 == (@c:IcaoSearchMatchedIcaosNumber) 0 > (@c:IcaoSearchCurrentIcao) (@c:FacilityICAO) == and and if{ 1 (>@c:FlightPlanWaypointIndex) } (@c:FacilityICAO) (>@c:FlightPlanNewWaypointICAO) 'A' (>@c:IcaoSearchStartCursor) (L:FMC-RTE-ORGN-1,number) chr (L:FMC-RTE-ORGN-2,number) chr (L:FMC-RTE-ORGN-3,number) chr (L:FMC-RTE-ORGN-4,number) chr scat scat scat (>@c:IcaoSearchEnterChar) (@c:IcaoSearchMatchedIcaosNumber) 0 > if{ (@c:IcaoSearchCurrentIcao) (>@c:FacilityICAO) } (@c:IcaoSearchCurrentIdent) (>@c:FlightPlanNewWaypointIdent) 0 (>@c:FlightPlanAddWaypoint) ' ' (>@c:FacilityICAO) ' ' (>@c:IcaoSearchStartCursor) 1 (>L:FMC-RTE-1-ACT,enum)0 (>L:FMC-RTE-1-ACTIVATE,enum) quit } } 

Ok so the above code won't work. Neither the destination nor the origin airport will set. Is this because I don't have a loaded flight plan?I've taken long to respond to this as school has been taking up most of my time.I did get the Reference Airport feature working, just as we initially had thought I just hid the text.

Good Day,

Engjell Berisha

 

Angel-Simulations-Small.png

No problem about not responding sooner. School is priority. This is not.In the xml world, you need an open Flight Plan in order to use the gps variables FlightPlanNewWaypoint__, FlightPlanAddWaypoint. If you have an open Flight Plan, then:

  • If you are dealing with Airports only, you can shortcut the IcaoSearch steps (StartCursor, EnterChar, MatchedIcaosNumber, CurrentIcao), as I indicated earlier. This also avoids the ICAO Transfer and the cycle skipping code it needs.

  • If you still want to use IcaoSearch, then you do not need to first store IcaoSearchCurrentIcao into FacilityIcao, then later, FacilityIcao into FlightPlanWaypointNewIcao. Just go IcaoSearchCurrentIcao directly into FlightPlanNewWaypointIcao.

  • In your (@c:IcaoSearchCurrentIcao) (@c:FacilityICAO) == statement, you're trying to see if two strings equal each other, but to do that, you should use scmp rather than ==.

  • In the same statement, you use FlightPlanWaypointIndex, but when adding new Waypoints, you want FlightPlanAddWaypoint like you did for the Origin Airport further down.

It is possible to open a Flight Plan, delete all the Waypoints, and then add a new Destination and Origin Airport. If you go that route, you should add Waypoint 0 first rather than Waypoint 1. Again, you still might not be satisfied with the results. For starters, the Lat, Lon of an Airport facility is the center of the facility, not a gate or departure end of a runway. The center of the Airport facility could be located inside an airport building or between runways, or the center of a runway - all bad places to start the flight.Working with the fs9gps module is an aggressive undertaking especially if you are in school, so be very careful that this stuff does not consume more than discretionary time.

  • Author
  • Commercial Member

So you're saying that I won't be able to add multiple waypoints as if I would set a direct to then add a waypoint prior and a few waypoints in between, completely circumventing the flight planner? Or would I absolutely have to have a flight plan loaded?Schools not necessarily so tough as of late, but particularly time consuming. Flying a bunch most days.

Good Day,

Engjell Berisha

 

Angel-Simulations-Small.png

I have re-read my posts and discovered that I made a significant mistake on one point which I now shall attempt to rectify. Starting with no Flight Plan loaded (FlightPlanIsActiveFlightPlan = 0), you can create a Flight Plan using FlightPlanDirectToDestination, as follows:

'A  	KSFO' (>@C:FlightPlanNewWaypointIcao)(>@c:FlightPlanDirectToDestination)

will create a two-waypoint "Direct to KSFO" Flight Plan starting at your aircraft's current Lat, Lon and Alt (so, this can be done at any time, including in-flight), and, in this case, terminating at San Francisco International Airport. I do not think you have any flexibility with the starting point using FlightPlanDirectToDestination - it's the current aircraft position.FlightPlanDirectToDestination does not require an argument. The 'A_ _ _ _ _ _ KSFO' is the airport ICAO, but I know that you want to use ICAOSearch, which is fine as long as you pass the destination ICAO to FlightPlanNewWaypointICAO before the FlightPlanDirectToDestination statement. The destination does not need to be an airport. It could be any type of facility or even just a Lat Lon position not associated with a facility.At this point, you now have an active Flight Plan and you can use the FlightPlanNewWaypoint variables to add / remove / direct to Waypoints - all the things you can do when a Flight Plan is loaded.It looks like you indeed have the right idea and I am grateful for your previous post because it caused me to re-consider my statements. Good job.Maybe you just have a few syntax errors to fix and then you're on your way!

  • Author
  • Commercial Member
 (L:FMC-RTE-1,enum) 1 == if{  (L:FMC-RTE-1-ACT,enum) 0 == (L:FMC-RTE-1-READY,enum) 1 == (L:FMC-RTE-1-ACTIVATE,enum) 1 == and and if{  'A' (>@c:IcaoSearchStartCursor)  (L:FMC-RTE-DEST-1,number) chr (L:FMC-RTE-DEST-2,number) chr  (L:FMC-RTE-DEST-3,number) chr (L:FMC-RTE-DEST-4,number) chr scat scat scat (>@c:IcaoSearchEnterChar)  (@c:IcaoSearchMatchedIcaosNumber,number) 0 > if{ (@c:IcaoSearchCurrentIcao) (>@c:FlightPlanNewWaypointICAO) }  1 (>@c:FlightPlanDirectToDestination)  'A' (>@c:IcaoSearchStartCursor) (L:FMC-RTE-ORGN-1,number) chr (L:FMC-RTE-ORGN-2,number) chr  (L:FMC-RTE-ORGN-3,number) chr (L:FMC-RTE-ORGN-4,number) chr scat scat scat (>@c:IcaoSearchEnterChar)  0 (>@c:FlightPlanWaypointIndex) (@c:IcaoSearchMatchedIcaosNumber,number) 0 > if{ (@c:IcaoSearchCurrentICAO) (>@c:FlightPlanNewWaypointICAO) }  1 (>@c:FlightPlanAddWaypoint) ' ' (>@c:FacilityICAO) ' ' (>@c:IcaoSearchStartCursor) 1 (>L:FMC-RTE-1-ACT,enum) 0 (>L:FMC-RTE-1-ACTIVATE,enum) quit } } 

The above code works perfectly. It sets the FMC-RTE-DEST series to the second waypoint of the flight and FMC-RTE-ORGN as the first waypoint. Actually quite simple, I just had some syntax errors that I didn't understand enough to rid.Thanks everyone! Everything is working very well now, just have to continue coding some other small things. Rest assured I'll be back with more trivial things to ask soon!

Good Day,

Engjell Berisha

 

Angel-Simulations-Small.png

Glad you got it working. But, what are you doing with the aircraft position waypoint? Is that not still in your Flight Plan?

  • Author
  • Commercial Member

I'm not sure what you mean by aircraft position waypoint.

Good Day,

Engjell Berisha

 

Angel-Simulations-Small.png

hmmm...After you execute your code, how many Waypoints do you have in your Flight Plan? And, what are they? Is that what you were expecting?

  • Author
  • Commercial Member

If the origin is PHMK for example and the destination PHUP, if I activate then execute the code I get a resulting flight plan with two waypoints. Of which PHMK is the first waypoint of the flight plan and PHUP is the second. That's exactly what I was expecting.Although it was working fine the first day or so. I just tried it twice again and it crashed the simulator. This may be my own doing as I may have unintentionally edited some of the code without knowing so. I will check it as soon as I return from school tomorrow.

Good Day,

Engjell Berisha

 

Angel-Simulations-Small.png

Interesting. To me, it looks like your code should yield 3 waypoints. FlightPlanDirectToDestination produces two. FlightPlanAddWaypoint adds one. Total = 3.About the crash to desktop... you say this started after further edits. Does your code now include any of the following gps variables?

  • FlightPlanDescription
  • FlightPlanDepartureAirportIdent
  • FlightPlanDepartureName
  • FlightPlanDestinationAirportIdent
  • FlightPlanDestinationName

If so, comment them out and see if that fixes your crash.By the way, are you FS9 or FSX?Good luck

  • Author
  • Commercial Member
Interesting. To me, it looks like your code should yield 3 waypoints. FlightPlanDirectToDestination produces two. FlightPlanAddWaypoint adds one. Total = 3.About the crash to desktop... you say this started after further edits. Does your code now include any of the following gps variables?
  • FlightPlanDescription
  • FlightPlanDepartureAirportIdent
  • FlightPlanDepartureName
  • FlightPlanDestinationAirportIdent
  • FlightPlanDestinationName

If so, comment them out and see if that fixes your crash.By the way, are you FS9 or FSX?Good luck

FlightPlanDirectToDestination only yields one waypoint, in the example case it yields PHUP. And FlightPlanAddWaypoint allows for FlightPlanNewWaypointICAO to go through in the example of PHMK as the second waypoint but it comes in before PHUP.Actually, I'm not sure I've edited anything. I may have unintentionally but intentionally I've not made any changes. Only the code you see above your post. I've not used any of those variables you mentioned.I'm personally FS9 but this is made to work on both.

Good Day,

Engjell Berisha

 

Angel-Simulations-Small.png

FlightPlanDirectToDestination only yields one waypoint
If you are starting with no Flight Plan loaded, that is not possible.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.