In another thread, Bjoern asked me if could post my code for a custom elevator trim system using XML tools. The default trim moves in increments that are too big for really accurate trim and moves too fast if the key or button is held down. This system works with the default trim commands made with the keyboard or joystick button. Some of the code relates to the animation of the "suitcase" trim handles on the DC8 and can be disregarded. That includes the timer -- it only relates to the handles.
Code:
<!-- Trim -->
'ELEV_TRIM_UP' (>C:XMLEVENTS:EventName,string)
'40 (>L:DC8_trim_hdl, number)
40 (>L:DC8_trim_hdl_rt, number)
(P:ABSOLUTE TIME,seconds) (>L:trim_time,seconds)
1 (>L:trim_up, bool)'
(>C:XMLEVENTS:EventString,string)
'ELEV_TRIM_DN' (>C:XMLEVENTS:EventName,string)
'0 (>L:DC8_trim_hdl, number)
0 (>L:DC8_trim_hdl_rt, number)
(P:ABSOLUTE TIME,seconds) (>L:trim_time,seconds)
1 (>L:trim_down, bool)'
(>C:XMLEVENTS:EventString,string)
(P:ABSOLUTE TIME,seconds) (L:trim_time, seconds) - 0.1 >
if{ 20 (>L:DC8_trim_hdl, number) }
(P:ABSOLUTE TIME,seconds) (L:trim_time, seconds) - 0.15 >
if{ 20 (>L:DC8_trim_hdl_rt, number) }
(L:trim_up, bool) 1 ==
if{ (L:elevator_trim_temp, radians) 0.00045 + (>C:SIMVARS:Elevator Trim Position,radians)
0 (>L:trim_up, bool)
(C:SIMVARS:Elevator Trim Position,radians) (>L:elevator_trim_temp, radians)
}
(L:trim_down, bool) 1 ==
if{ (L:elevator_trim_temp, radians) 0.00045 - (>C:SIMVARS:Elevator Trim Position,radians)
0 (>L:trim_down, bool)
(C:SIMVARS:Elevator Trim Position,radians) (>L:elevator_trim_temp, radians)
}




