Save properties between sessions
Jump to navigation
Jump to search
You can make properties persistent between flying sessions on the same Aircraft, using the aircraft.data system.
Nasal example
So I want the properties /sim/bla1 and /sim/bla2 to be persistent.
I run this nasal code once:
aircraft.data.add("sim/bla1", "sim/bla2");
aircraft.data.save();
Then the properties are saved when that code is run, and also at every reinit and exit.
If I want it to be saved every 30 seconds in addition to the above, then I change the last line to:
aircraft.data.save(0.5);
Now to make sure the properties are also read at the startup I will modify the xml declarations of the properties to read something like this:
<bla1 userarchive="y" type="bool">true</bla1>
<bla2 userarchive="y" type="int">56</bla2>