Jump to content
The simFlight Network Forums

Throttle to idle Lua script


Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.