I am in need of some sage advice on property listeners. Could someone enlighten me on the easiest way to convert the following type of function to respond to, for example, the "sim/model/lightning/controls/flight/ap_pitch" property?
Doing so with minimal changes to the existing code would be ideal (even though it's horrible and longwinded, it has the major advantage that I understand it :-) Obviously the lines that set that switching property would be redundant and need removed, but I've left them there for now. # Pitch Hold / Off autpilot_pitch = func { aircraftpitch = getprop('orientation/pitch-deg[0]'); on = arg[0]; if ( on != '1' ) { setprop("autopilot/locks/altitude[0]", ""); setprop("sim/model/lightning/controls/flight/ap_pitch", "0"); setprop("autopilot/gui/alt-active[0]", "false"); } else { setprop("sim/model/lightning/controls/flight/ap_pitch", "1"); setprop("autopilot/settings/target-pitch-deg[0]", aircraftpitch); setprop("autopilot/locks/altitude[0]", "pitch-hold"); } } # end function Please bear in mind that I have no programming background and find OO stuff about as intelligible as I do Mandarin... Cheers, AJ ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel