* Curtis Olson -- Friday 12 January 2007: > On 1/12/07, Melchior FRANZ <[EMAIL PROTECTED]> wrote: > > > > If writing the value is only required when exiting fgfs, then > > autosave.xml would be good enough. It would only miss flying > > hours that ended with a segfault, which shouldn't really happen > > anyway. ;-) > > > > Otherwise extra files would be needed. I could implement either, > > now that prop.setAttribute("USERARCHIVE", 1) is available. > > > We don't have the ability to write files in nasal though, do we? Or more > specifically, we haven't turned on that feature because of potential safety > concerns, right? > > Curt. > -- > Curtis Olson - University of Minnesota - FlightGear Project > http://baron.flightgear.org/~curt/ http://www.humanfirst.umn.edu/ > http://www.flightgear.org > Unique text: 2f585eeea02e2c79d7b1d8c4963bae2d >
BTW: this code put into $FG_ROOT/Nasal/aircraft.nas would write an aircraft specific value into autosave.xml. Not the operation hours, though, but just the time fgfs ran with that aircraft. var hobbs_store = nil; settimer(func { isletter = func(c) { c >= `a` and c <= `z` or c >= `A` and c <= `Z`} var aircraft = getprop("/sim/aircraft"); if (!isletter(aircraft[0])) { aircraft = "_" ~ aircraft; } hobbs_store = props.globals.getNode("/sim/time/hobbs/" ~ aircraft, 1); if (hobbs_store.getType() == "NONE") { hobbs_store.setDoubleValue(0); } hobbs_store.setAttribute("USERARCHIVE", 1); }, 0); setlistener("/sim/signals/exit", func { hobbs_store.setDoubleValue(hobbs_store.getValue() + getprop("/sim/time/elapsed-sec")); }); m. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel