December 16, 200817 yr Moderator It is easy enough to obtain the ICAO code and remaining distance from the stock FS variables:A:GPS WP NEXT ID, string(A:GPS WP DISTANCE, nmiles)It is also possible to get the same information from the fs9gps.dll using these GPS variables:@c:FlightPlanWaypointIdent@c:FlightPlanWaypointRemainingDistance,nmilesHowever, you need to set @c:FlightPlanWaypointIndex first, otherwise you get only the departure Airport ICAO (it defaults to index of zero).I need to continuously update the current waypoint + 1 for a display. Does anyone have any suggestions on how to keep the @c:FlightPlanWaypointIndex updated as one progresses through the waypoints of a flightplan?In the screenshot below, you can see that I've got the "current waypoint" (magenta) and the "next waypoint" (white) displayed, but that's only because I set the @c:FlightPlanWaypointIndex manually in the script: <Element> <Position X="140" Y="505"/> <FormattedText X="54" Y="16" Font="Arial Bold" FontSize="16" Adjust="Center" VerticalAdjust="Top" Color="White" Bright="Yes"> <Font FontSize="14"/> <String>%(2 (>@c:FlightPlanWaypointIndex))%((@c:FlightPlanWaypointIdent))%!s!%</String> </FormattedText> <Shift> <Value Minimim="0" Maximum="20"> (@c:FlightPlanWaypointRemainingDistance,nmiles) </Value> <Scale X="14.75"/> </Shift> </Element> <Element> <Position X="168" Y="526"/> <Image Name="B787_LNav_WPTNext1Bar.bmp" Bright="Yes"/> <Shift> <Value Minimim="0" Maximum="20"> (@c:FlightPlanWaypointRemainingDistance,nmiles) </Value> <Scale X="14.75"/> </Shift> </Element> Shot at 2008-12-15When done, it will look something like this:Shot at 2008-12-15 Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
December 16, 200817 yr Once (@c:FlightPlanWaypointRemainingDistance,nmiles) starts increasing, you have in fact passed it and you should then be looking at the next waypoint.Doug
December 16, 200817 yr Author Moderator Once (@c:FlightPlanWaypointRemainingDistance,nmiles) starts increasing, you have in fact passed it and you should then be looking at the next waypoint.DougUm, normally @c:FlightPlanWaypointRemainingDistance,nmiles is the "remaining distance" to the currently being flown waypoint, but in my case it's the next waypoint following the "current waypoint," so I'm not sure that's entirely true......but in any case, since there's no way to retrieve the actual, current "index" of the currently being flown waypoint, how can I keep track of the "index?"(@c:FlightPlanApproachWaypointsNumber,number) only tells me how many wpts are in the flightplan.This is especially true if one files an enroute flightplan, and could wind up entering the flightplan at any given waypoint (typically the closest wpt to the current a/c location)... :( Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
December 16, 200817 yr Fr. Bill,This is a rather silly way, but it worksThis is the active waypoint:%((@c:FlightPlanIsDirectTo))%{if}- - - - -%{else}%((@c:FlightPlanActiveWaypoint) s3)%((@c:FlightPlanIsActiveFlightPlan) (@c:FlightPlanWaypointsNumber) s2 0 != and)%{if}%((@c:FlightPlanActiveWaypoint) sp1)%{loop}%(l1 (>@c:FlightPlanWaypointIndex,number))%((@c:FlightPlanWaypointRemainingDistance,nmiles) 0 !=)%{if}%((@c:FlightPlanWaypointIdent))%!s!%(l1 ++ s1 (@c:FlightPlanWaypointsNumber) < l1 l3 < and)%{next}%{end}%{end}%{end}And this one the next:%((@c:FlightPlanIsDirectTo))%{if}- - - - -%{else}%((@c:FlightPlanActiveWaypoint) 1 + s3)%((@c:FlightPlanIsActiveFlightPlan) (@c:FlightPlanWaypointsNumber) 1 + s2 0 != and)%{if}%((@c:FlightPlanActiveWaypoint) 1 + sp1)%{loop}%(l1 (>@c:FlightPlanWaypointIndex,number) 1 + )%((@c:FlightPlanWaypointRemainingDistance,nmiles) 0 !=)%{if}%((@c:FlightPlanWaypointIdent))%!s!%(l1 ++ s1 (@c:FlightPlanWaypointsNumber) 1 + < l1 l3 < and)%{next}%{end}%{end}%{end}Sure it can be done more simpleHope it helps,Jan Jan "Beatus ille qui procul negotiis..."
December 16, 200817 yr Commercial Member Um, normally @c:FlightPlanWaypointRemainingDistance,nmiles is the "remaining distance" to the currently being flown waypoint, but in my case it's the next waypoint following the "current waypoint," so I'm not sure that's entirely true......but in any case, since there's no way to retrieve the actual, current "index" of the currently being flown waypoint, how can I keep track of the "index?"(@c:FlightPlanApproachWaypointsNumber,number) only tells me how many wpts are in the flightplan.This is especially true if one files an enroute flightplan, and could wind up entering the flightplan at any given waypoint (typically the closest wpt to the current a/c location)... :(// flight plan itemsFlightPlanIsActiveFlightPlan - a flight plan is loaded.FlightPlanWaypointsActiveWaypont - index to active (current) leg.FlightPlanWaypointsNumber - total number of legs.FlightPlanWaypointIndex - index used to step through each leg of a flight plan// approach itemsFlightPlanIsLoadedApproach - an approach is loaded (flight plan may/may not be loaded)FlightPlanIsActiveApproach - an approach is loaded AND active.FlightPlanActiveApproachWaypoint - index to active (current) approach leg.// Direct To itemsFlightPlanIsDirectTo - 'flight plan' is currently a Direct To.FlightPlanDirectToWaypoint - index to waypoint in flight plan that the Direct To points to.Use of the FlightPlanWaypointIndex appears to be 'instant' as in you don't have to wait for the data to be returned. Set the index in the FlightPlanWaypointIndex and all the "FlightPlanWaypointXX" variables are valid for the selected waypoint. Ed Wilson Mindstar AviationMy Playland - I69
December 16, 200817 yr This works ok for all in FP <String> %((@c:FlightPlanWaypointsNumber) s2 0 !=) %{if} %(0 sp1) %{loop} %(l1 (>@c:FlightPlanWaypointIndex)) %((@c:FlightPlanWaypointRemainingTotalDistance,nmiles) s33 9.9 >= )%{if}%(l33)%!d!%{else}%(l33 9.9 < )%{if}%(l33)%!2.1f!%{end}%{end} etc. etc. Paul EGLD
December 16, 200817 yr I need to continuously update the current waypoint + 1 for a display. Does anyone have any suggestions on how to keep the @c:FlightPlanWaypointIndex updated as one progresses through the waypoints of a flightplan?Bill, this is very simple:(@c:FlightPlanActiveWaypoint) s0 (>@c:FlightPlanWaypointIndex)...Show needed data for Active Waypointl0 ++ (@c:FlightPlanWaypointsNumber) 1 - min (>@c:FlightPlanWaypointIndex)...Show needed data for NEXT Waypoint (Active +1)That's it! No need to test remaining distance, etc. You should decide what to show for next wp when active becomes the last...Tom
December 16, 200817 yr Author Moderator Bill, this is very simple:<snipped for brevity>That's it! No need to test remaining distance, etc. You should decide what to show for next wp when active becomes the last...Thanks everyone for the replies. Tom, your solution is indeed simple and easy to implement, as usual. I needed only to add some checks to suppress the display if the "remaining distance" is > 20nm so it won't appear on the display: <String> %((@c:FlightPlanActiveWaypoint) s0 (>@c:FlightPlanWaypointIndex)) %((@c:FlightPlanWaypointRemainingDistance,nmiles) 20 <) %{if} %((@c:FlightPlanWaypointIdent)) %!s! </String>...and... <String> %(l0 ++ (@c:FlightPlanWaypointsNumber) 1 - min (>@c:FlightPlanWaypointIndex)) %((@c:FlightPlanWaypointRemainingDistance,nmiles) 20 <) %{if} %((@c:FlightPlanWaypointIdent)) %!s! </String> Now I can move on to the next "challenge," the a/c symbol (easy!) and the vector line showing the vertial profile (hard!) :( The vertical profile vector is simple enough in C++/GDI+, but I'm thinking it will be really a challenge in XML... :( Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
Create an account or sign in to comment