Today I've added alias() and unalias() methods to the props.Node class: var foo = props.globals.getNode("/foo", 1); foo.alias("/sim/aircraft");
foo is now an alias to /sim/aircraft. It will have the same node type (STRING) and return the same value as /sim/aircraft. alias() does also accept a props.Node as argument. foo.unalias(); ... removes the alias link, after which node "foo" will be a regular node of type NONE, with no data relation to /sim/aircraft or any other node. You can make an alias to a tied node. alias()/unalias() exist since a long time in C++ space, but were not available on the Nasal side, because there was no need in the beginning. But now with MP aliases can be quite useful: Assume you want to transmit your aircraft's door position over MP. There are no pre-defined door MP properties, so you have to use a generic node. You define something like this in your *-set.xml file: <sim> <multiplay> <generic> <float n="0" alias="/sim/model/doors/door[0]/position-norm"/> </generic> </multiplay> </sim> But how does one get the generic values back to the remote aircraft's door property? So far one had to create a loop in the model animation XML file's <nasal><load> block, which reads the generic value and copies it to the door property. Now one can make an alias instead: <load> var self = cmdarg(); var door = self.getNode("sim/model/doors/door/position-norm", 1); var generic = self.getNode("sim/multiplay/generic/float", 1); door.alias(generic); </load> <unload> door.unalias(); </unload> The aliases do the "copying" (actually: redirecting) automatically and are much more efficient. m. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel