* Josh Babcock -- Saturday 18 March 2006 03:26: > loadBombs = func { > # Find out which bomb configuration we are now using. > loadout_index = getprop('/sim/weapons/current-loadout');
If this is the listened to property, then you should IMHO use this here instead: loadout_index = cmdarg().getValue(); This avoids that you have to type the exact same path twice (once here and once in the setlistener() command) and it makes clear that this is the listened to property. Also, you can use all the nice props.Node methods on cmdarg() directly. > loadout = > props.globals.getNode('/sim/weapons/loadout['~$loadout_index~']'); What's the $ sign supposed to do here? This is not BASH or Perl! This won't work. You could also use this loadout = props.globals.getNode('/sim/weapons').getChild('loadout', loadout_index); OK, it's longer, but the string concatenation for the index isn't pretty either. But that's just cosmetics, and I've used both. :-) > bombs = loadout.getChildren(); > foreach (bomb, bombs) { > dropped = bomb.getNode(dropped); You probably mean dropped = bomb.getNode("dropped"); mind the quotes! > dropped.setBoolValue(false); false isn't defined by Nasal. You have to define it yourself or just use: dropped.setBoolValue(0); You can't use "false" as string here either, because every non-empty string is true IIRC. And then there are the wrong comma separators in the "foreach" that should be semicolons, but you already noticed. :-) 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