Hey thanks, But just to get me going could you write it out as if it was doing the following in script form. That should help me heaps to understand this and keep me busy too ;)
Say i wanted to monitor the /engines/engine[0]/cutoff property. If it ever changed to true i would like to erm just for the sake of it say turn /engines/engine[0]/reverse to true. I know this can't and wont happen but it would help me see how this works and give me a good start. Cheers in advance Justin Smithies On Monday 06 March 2006 12:19, Melchior FRANZ wrote: > * Justin Smithies -- Monday 06 March 2006 13:15: > > Is it possible to have a nasal script running and waiting for an event to > > happen , say watching a switch then if the condition is met do the > > required ? > > setlistener("/some/switch", func { > if (cmdarg().getBoolValue()) { > print("turned on"); > } else { > print("turned off"); > } > }); > > > You can also define the function elsewhere and just call it like that: > > on_switch = func { > ... > } > setlistener("/some/switch", on_switch); > > > cmdarg() returns the listened-to property as props.Node object, > so you can use it with all its methods (see $FG_ROOT/Nasal/props.nas), > for example: > > print(cmdarg().getPath(), " has been changed to ", cmdarg().getValue()) > > m. > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live > webcast and join the prime developer group breaking into this new coding > territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Flightgear-devel mailing list > Flightgear-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/flightgear-devel ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel