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.

Send current position to GPS via Execute Calculator Code

Featured Replies

  • Commercial Member

In a C gauge, how does one send info to the GPS using Execute Calculator Code?Reading something via Exec Calc Code (like ATC ID) is not a prob, but writting I'm not so sure.For context, I'm trying to send the aircraft's current position to the GPS so I can determine the nearest airport by reading data out of the GPS.Cheers,Bryan

Hi,You could try PCSTRINGZ szCode;szCode = "(A:Plane Latitude,degrees) (>C:fs9gps:NearestAirportCurrentLatitude)";execute_calculator_code(szCode,NULL,NULL,NULL);Same with Plane Longitude and NearestAirportCurrentLongitude.etc,etcTom

  • Moderator

>Bill,>>When I click that link it says: "There is currently no text in>this page, you can search for this page title in other pages>or edit this page"Strange... There was a "period" at the end of the link that doesn't belong... This one works:http://forums.flightsim.com/fswiki/index.p...les_in_C_Gauges

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author
  • Commercial Member

Hi Tom,I tried your code in Visual Studio:szCode = "(A:Plane Latitude,degrees)(>C:fs9gps:NearestAirportCurrentLatitude)";execute_calculator_code(szCode,NULL,NULL,NULL);sprintf(pelement->string,"%s", szCode );However, she doesn't work I'm afraid.I returned the szCode in my gauge as a string and the text on my gauges was literally: (A:Plane Latitude, degrees...."Any ideas?Cheers,Bryan

Hi Bryan,Well, that's correct!. szCode should contain "(A:Plane Latitude,degrees) (>C:fs9gps:NearestAirportCurrentLatitude)" which is the assingment you are sending to the gps engine. Remember execute_calculator_code is not only an XML variable interactor but a complete scripting system's operator.Tom

  • Author
  • Commercial Member

Hi Tom,Still no joy I'm afraid.I don't think the info was sent to the GPS engine via Exec Calc Code.The returned string was not a number, but literally the text exactly as printed to the right here: "A: Plane Latitude, degrees)......Any ideas?Cheers,Bryan

Bryan,There is no return code. Do you really understand how this function works?In this case, szCode is a string passed to the scripting system that won't return anything because it has a triple NULL for the passing pointers (FLOAT,INT and STRING). If you wish I can give you later a real example on what you need to code.Tom

  • Moderator

>Hi Tom,>>Still no joy I'm afraid.>>I don't think the info was sent to the GPS engine via Exec>Calc Code.>>The returned string was not a number, but literally the text>exactly as printed to the right here: "A: Plane Latitude,>degrees)......Bryan, in very simple terms, you are sending a COMMAND to the fs9gps.dllYou are "seeing" the command that was sent!You need to follow that COMMAND with a SHOW ME request... ;)Before the fs9gps.dll can return anything at all, you must first send the COMMAND strings for your current lattitude and longitude......THEN you need to send a SHOW ME request (this is where you ask fs9gps.dll to paint you a picture and send it back for display......or, a SHOW ME request for some data, such as a list of nearest airport ICAO codes, etc. ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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.