August 1, 200817 yr 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 B. York FS2Crew Web Site / FS2Crew Facebook Page / FS2Crew Discord
August 1, 200817 yr 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
August 1, 200817 yr Moderator >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
August 1, 200817 yr Author Commercial Member 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 B. York FS2Crew Web Site / FS2Crew Facebook Page / FS2Crew Discord
August 2, 200817 yr 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
August 4, 200817 yr 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 B. York FS2Crew Web Site / FS2Crew Facebook Page / FS2Crew Discord
August 4, 200817 yr 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
August 4, 200817 yr 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 B. York FS2Crew Web Site / FS2Crew Facebook Page / FS2Crew Discord
August 4, 200817 yr 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
August 4, 200817 yr 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
August 5, 200817 yr Author Commercial Member Thanks for "Showing Me" the way :-)Apologies for the terrible word play :-)Cheers,Bryan B. York FS2Crew Web Site / FS2Crew Facebook Page / FS2Crew Discord
Create an account or sign in to comment