Save Current Flight
msfs_save_flightSave the current Microsoft Flight Simulator flight to a .FLT file, verifying the save completes before returning. Avoids false success by checking the file on disk and waiting for SimConnect to become responsive again.
Instructions
Save the current flight to a .FLT file.
Capture a known state so a later msfs_load_flight call can restore it. Refuses to replace an existing file unless overwrite=True.
The library's sm.save_flight() ends with an unconditional return False,
so its return value says nothing about success -- this checks whether
the file was actually written instead. Its body also reads the file
straight back (flight_to_dic) immediately after issuing an asynchronous
FlightSave; if MSFS has not finished writing yet, that read-back can
raise rather than return False. Both a clean return and a raised
exception are followed by the same polling existence check below, since
the file on disk is the only signal either path can be trusted to leave
behind.
Does not return once the file appears, either. MSFS keeps SimConnect
entirely unresponsive for a further ~14s (measured live) while it
actually finishes the save; this waits that out too, bounded, so a
caller never gets status: "ok" while the sim still cannot answer
anything -- see _wait_for_sim_responsive's docstring for the full
measurement and why the wait is structured the way it is.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path for the .FLT file to write | |
| title | Yes | Flight title shown in MSFS | |
| overwrite | No | Replace the file at `path` if one already exists there | |
| description | No | Flight description |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |