Jump to content
Sign in to follow this  
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

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

>In a C gauge, how does one send info to the GPS using Execute>Calculator Code?Have you read my Wiki article?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

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"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

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


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...