Archived

This topic is now archived and is closed to further replies.

byork

Send current position to GPS via Execute Calculator Code

Recommended Posts

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

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

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

Share this post


Link to post
Share on other sites

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"Cheers,Bryan

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

>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. ;)

Share this post


Link to post
Share on other sites

Thanks for "Showing Me" the way :-)Apologies for the terrible word play :-)Cheers,Bryan

Share this post


Link to post
Share on other sites