(Note that the ramp marshall is a modification of waldo from the bluebird - I redressed him, modeled a headset and glow sticks)
Early Development Animation Test
Aircraft Guidance Test at WSSS B8
That was a prototype only to test the general script and the animations. I'm working on a larger system similar to the animated jetways (but that looked like it had a lot of unecessary code in it) to generalize this and make the animations independant. I made some progress and had a lot of questions but figured them out myself so far. I suppose I could ask more questions here then?
Oh, and how exactly can I (would you want to have this?) add this to fgdata for the next release? So far, it only works with the WSSS Airport I'm working on, but with this system completed, you should be able to place the marshalls anywhere (at any airport) using the ufo and use a converter script to convert the stg into the xml file that contains the data.
Lol, I already ran into trouble... Here's the function I wrote that loads the ramps at a given airport from xml file -
- Code: Select all
var load_ramps = func(icao) {
var xml_file = getprop("/sim/fg-root") ~ "/AI/Airports/" ~ icao ~ "/ramps.xml";
var rampsTree = "/airports/"~icao~"/ramps";
setprop(rampsTree~"/loaded", 1); # Set Loaded flag so flightgear doesn't load again
io.read_properties(xml_file, rampsTree);
if(rampsTree == nil) {return;}
var ramps = props.globals.getNode(rampsTree).getChildren();
foreach(ramp; ramps) {
# General Runtime XML
var index = ramp.getIndex();
var base_model = getprop("/sim/fg-root") ~ "/Models/Airport/Ramp/ramp.xml";
var tmp = ramps.getNode("models",1).getNode("model", 1);
tmp.getNode("path", 1).setValue(base_model);
var tree = rampsTree ~ "/ramp[" ~ index ~ "]/";
var params = tmp.getNode("overlay", 1).getNode("params", 1);
params.getNode("left-arm-x", 1).setValue(tree~"left-arm-x");
params.getNode("left-arm-outer-x", 1).setValue(tree~"left-arm-outer-x");
params.getNode("left-arm-z", 1).setValue(tree~"left-arm-z");
params.getNode("right-arm-x", 1).setValue(tree~"right-arm-x");
params.getNode("right-arm-outer-x", 1).setValue(tree~"right-arm-outer-x");
params.getNode("right-arm-z", 1).setValue(tree~"right-arm-z");
params.getNode("toggle-ramp-marshall-script").setValue("ramp.toggle_marshall(" ~ index ~ ");");
var model_path = getprop("/sim/fg-home") ~ "/state/ramp-" ~ index ~ ".xml";
io.write_properties(model_path, tmp.getPath());
# Add model to FlightGear
addModel(model_path, ramp.getNode("latitude-deg").getValue(), ramp.getNode("longitude-deg").getValue(), ramp.getNode("altitude-m").getValue(), ramp.getNode("heading-deg").getValue());
}
}
I get the error: non-objects have no members at this line - var tmp = ramps.getNode("models",1).getNode("model", 1);
I'm not very familiar with the props class, I just looked at it from plausible.org earlier today. I was wondering how I can get/create the tree "/airports/WSSS/ramps/models/model/" and put the limb positions and toggle script in there.
Thanks a lot!