flygutt Posted June 20, 2013 Report Posted June 20, 2013 Ive made a Lua script for putting throttle handles to idle position in different phases of flight. Its supposed to work with PMDG737NGX and my throttle quadrant. I have problems with the throttle handles inside FSX not being put fully back at idle when my TQ handles are put all the way back even after calibrating of the TQ. On landing I cant activate the reversers because of the engines not running at idle. So Ive made a script that should send a button press command for idling them when hardware TQ handle are moved inside a specified range. When coming outside of the range FSUIPC is set to kill the script. Im relatively novice in Lua maybe there are better ways to organize the script. Im not sure if I can do a new IF check inside another IF. WHILE loop inside IF? The script checks if aircraft is on the ground and if the reverser is not active then idle the throttle. Reverser check is revInd variable. If the aircraft is in the air do nothing if Radio Altitude is more than 100 feet. If it is below 100 feet do a loop until the aircraft has landed then idle if reverser is not active. Ive also added functionality for checking that the aircraft is still on the ground and has not bumped back in the air, landIdleRepeat1 variable. When the reversers are active there should be no idling command sent. The script is attached. In my opinion this script should work but errors are awaiting when testing. First off is error at line 5 where 'end' is expected. Thr1Idle_NGX.lua.txt
Pete Dowson Posted June 20, 2013 Report Posted June 20, 2013 Ive made a Lua script for putting throttle handles to idle position in different phases of flight. Its supposed to work with PMDG737NGX and my throttle quadrant. I have problems with the throttle handles inside FSX not being put fully back at idle when my TQ handles are put all the way back even after calibrating of the TQ. And did you leave a definite gap, a dead zone, when clicking the idle point during calibration? In other words, do NOT set idle when the throttles are fully back but when pushed slightly forward. That is the only way to guarantee a zero value being sent when they are fully pulled back, and it exactly wty this is part of the numbered steps to good calibration in the FSUIPC user guide. On landing I cant activate the reversers because of the engines not running at idle. Depends how your reversers are controlled. Basically the FSX revesre facility is by a negative value for the throttles, so such a value would replace the positiive value in any case. Some aircraft, however, seem to be programmed to ignore the controls which allow negative throttle values, but then these accept "Throttle Decrement" controls to allow both throttle reduction to aidle and into the reverse area. So repeated use of Throttle Decrements should always get you reverse not matter what throttle position you left -- provided the throttle axes aren't jittering and sending positive values which override this. That can't happen if they are parked in the calibrated "dead" zone for idle. Im not sure if I can do a new IF check inside another IF. WHILE loop inside IF? You can nest conditions as much as you like. The script is attached. In my opinion this script should work but errors are awaiting when testing. First off is error at line 5 where 'end' is expected. No, there's no error reported there. There is this: *** LUA Error: E:\FSX\Modules\Thr1Idle_NGX.lua:31: 'end' expected (to close 'if' at line 5) near '<eof>' which is surely self explanatory? You certainly have a missing 'end'. Count the "if'" and the "whiles" and see if they match the number of "ends". There are 9 ifs and whiles and only 8 ends! I think there is a missing end between lines 14 and 15, to end the first if on the radioalt. BTW this seems a complicated way of fixing what shouldn't be a problem at all. How are you assigning reversers? Pete
flygutt Posted June 22, 2013 Author Report Posted June 22, 2013 Got it working :) The missing 'end' was put in its place but the script still did not work so I did some adjustments to it. Seemed some of the variables did not update inside WHILE loops so I redifined the variable inside the loop and then they worked. I.e. line 16 and 17 went into an infinite loop after aircraft had landed. Line 1 had to be repeated inside this WHILE for it to be FALSE and the script could move along. PMDG737NGX requires me to calibrate throttles through FS own controller assignments for autothrottle to work properly together with TQ motoring. On joystick calibration in Windows I did not put the throttle handle all the way back resulting in 16383 readout in FSUIPC every time its moved back. With 16383 the NGX still dont idle. If you hit F1 they will jump a little step back and the engine N1 value also decrease about one percent.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now