PDA

View Full Version : How to get aircraft.cfg for current aircraft


DocMoriarty
07 Apr 2007, 19:02
Maybe i have missed something but if a simconnect client is loaded after the user loaded an airplane (thus missing the load aircraft event) then there is no really safe way to determine which aircraft the user is flying. All string data returned contains just stuff from aircraft.cfg's (Title, Model etc.) but nothing reliable to determine the directory of the aircraft.

I wish there would be a simulation variable that points to the SimObjects directory in which the current users airplane resides.

Currently i'm implementing heuristics to determine the aircraft using title, model etc. but that also means i have to scan the simobjects directory for installed stuff.

jcboliveira
08 Apr 2007, 03:39
I also need the aircraft.cfg location in a program. In FSX the task proved dificult since you can add new simobjects locations. This why still have the program in FSUIPC.

José

DocMoriarty
08 Apr 2007, 04:26
Glad i'm not alone :)

Since we are at it, how would it be if FS/SimConnect would provide information on the following files/directories via Simulation Variables:

- current loaded flight file
- current aircraft folder
- current flightplan file if one active
- current mission file if player is playing a mission

Currently for missions there is no way to determine whats active.

I consider this information vital and it's useful for a lot of possible applications that can't just live with the information provided by SimConnect.

Also the file loading events are great and should stay but if you missed the event since user was loading addon after the event took place there is no way to get the info.

For example i want to save the aircraft folder of the aircraft used in my flight log. If it's within FS root directory i save a relative path, if it's outside (if thats possible at all) i will save an absolute path (not great but better than nothing).

Currently i determine the aircraft used by searching the aircraft title returned by SimConnect in all aircraft.cfg's. Not the most performant and effective way to do it.

lc0277
08 Apr 2007, 04:30
Hi,

RequestSystemState with "AircraftLoaded" state.
You will get the full pathname of the currently used .air file. Works in most cases, where the .air file is in the same dir as main ac directory. Not 100% reliable though, but I've not seen many aircraft.cfg with aliased or foreign sim= directive. :confused:

You can also get notifications of aircraft changes (SubscribeToSystemEvent with the same state string)

DocMoriarty
08 Apr 2007, 05:17
Hi,

RequestSystemState with "AircraftLoaded" state.
You will get the full pathname of the currently used .air file. Works in most cases, where the .air file is in the same dir as main ac directory. Not 100% reliable though, but I've not seen many aircraft.cfg with aliased or foreign sim= directive. :confused:

You can also get notifications of aircraft changes (SubscribeToSystemEvent with the same state string)

Ah thanks, RequestSystemState was what i have been missing. Though as you mentioned it's also not perfect, so think some reliable basic file and folder info about files that make up the current situation in SimConnect wouldn't hurt.