* 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel