On Sun, Jan 01, 2006 at 08:07:40AM -0600, Curtis L. Olson wrote: > >>Paul Surgeon wrote: > >>>Has anybody thought of a way to be able to call functions > >>>inside FG via the network interface?
> With a little wrapping, this can be done now. We have wrapped up a few > functions, but perhaps need to add some more. One could use a command property and attach a listener to it. I'm not at my fgfs machine, but in (probably *very* wrong) nasal code this could look something like this: cmd = args = nil; execute = func { fgcommand(cmdargs().getValue(), args) } INIT = func { cmd = props.globals.getNode("/sim/cmd/name", 1); args = props.globals.getNode("/sim/cmd/args", 1); # add some cmd arg children for the different # available commands; they expect children with # specific names, like "filename" or something: args.setStringValue("filename", "dummy"); # ... setlistener(cmd, execute); } settimer(INIT, 0); Then you would only have to set the respective args via telnet or whatever, and then write the command name into /sim/cmd/name, which triggers the 'execute' function. No need for polling. Unfortunately, there's a bug left in setlistener() that I'll have to sort out with Andy (sorry :-), but the above code should work nevertheless. I'll try it as soon as I'm back again (and then I'll probably be very embarrassed ;-) m. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel