December 17, 200520 yr Commercial Member Is there a variable (or a set of variables) that tells me whether the GPS is opearating in Enroute, Terminal or Approach modes? For Term and Enr, I supposed I could simply look at the distance from the waypoint and conclude the mode from that, however, "App" mode is supposedly within 2NM from the FAF (at least in the real world), but how does one determine this distance arbitrarily in MSFS for any waypoint? Or is there simply a flag variable that tells me the mode?
December 17, 200520 yr Author Moderator >>Is there a variable (or a set of variables) that tells me>whether the GPS is opearating in Enroute, Terminal or Approach>modes? For Term and Enr, I supposed I could simply look at>the distance from the waypoint and conclude the mode from>that, however, "App" mode is supposedly within 2NM from the>FAF (at least in the real world), but how does one determine>this distance arbitrarily in MSFS for any waypoint? Or is>there simply a flag variable that tells me the mode?Directly? No. The default GPS calculates it this way: (A:GPS IS ACTIVE WAY POINT, bool) if{ (A:GPS IS APPROACH ACTIVE, bool) if{ 3 } els{ (A:GPS FLIGHT PLAN WP COUNT, number) (A:GPS FLIGHT PLAN WP INDEX, number) ++ == (A:GPS WP DISTANCE, nmiles) s0 30 ;)Although these variables are "XML" they are easily fetched in a C gauge using execute_calculator_code:FLOAT64 adf1_frequency = 0;execute_calculator_code("(A:ADF ACTIVE FREQUENCY:1, MHz)",&adf1_frequency,NULL,NULL);adf1_frequency = adf1_frequency*1000;This is the fs9gauges.h prototype:BOOL (FSAPI *execute_calculator_code) (PCSTRINGZ code, FLOAT64* fvalue, SINT32* ivalue, PCSTRINGZ* svalue);Note that only one of the three parameters is used, based on the data type of the XML variable: (float), (integer) or (string)... ;)All of the XML GPS variables are listed in the Parameters.doc of the SDK. Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
December 18, 200520 yr Commercial Member Thanks! Geeez, it's so simple now that I see it. Feel like I asked a stupid question lol.
December 18, 200520 yr Author Moderator >>Thanks! Geeez, it's so simple now that I see it. Feel like>I asked a stupid question lol.Well, thanks go to Arne Bartels, and several others who've been absent for a very long time, because none of this was documented at all!They found it through trial and error (heavy emphasis on the error!), and good guess work... ;)In fact, long before the SDKs were released, they had already sussed out all the XML variables and Arne had even written a tutorial on XML gauge coding!I must add that one of the neat features of using the XML variables vice the native C variables is that you can specify what units you want returned, rather than having to jump through fify-five hoops to convert the return to something usable... ;) Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
Create an account or sign in to comment