October 18, 20241 yr Hello, I would like to make a script for the FBW with which I can set the elevator trim to zero. My unsuccessful attempts: 1st attempt in the script editor :1 (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·<·if{·1·(>K:ELEV_TRIM_UP)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·>·if{·1·(>K:ELEV_TRIM_DN)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·!=·if{·g1} Result: The script runs once and the trim is adjusted once. 2nd attempt in the script editor :loop1 (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·<·if{·1·(>K:ELEV_TRIM_UP)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·>·if{·1·(>K:ELEV_TRIM_DN)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·!=·if{·(GOTO:loop1)} Ergbenis: Wie bei 1 Result: As with 1 3rd attempt in the script editor. Since I couldn't get the loop to work, I made 2 scripts that should call each other alternately until the target value is reached Scriptname: FBWA320N_PM_SUB-AFTER_LDG_ELEV_TRIM·LOOP1 script editor: (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·<·if{·1·(>K:ELEV_TRIM_UP)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·>·if{·1·(>K:ELEV_TRIM_DN)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·!=·if{·(CALL:FBWA320N_PM_SUB-AFTER_LDG_ELEV_TRIM·LOOP2)} Scriptname: FBWA320N_PM_SUB-AFTER_LDG_ELEV_TRIM·LOOP2 script editor (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·<·if{·1·(>K:ELEV_TRIM_UP)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·>·if{·1·(>K:ELEV_TRIM_DN)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,·Number)·22·!=·if{·(CALL:FBWA320N_PM_SUB-AFTER_LDG_ELEV_TRIM·LOOP1)} Result: The trim is adjusted as desired but at the end the trim wheel is moved back and forth around the zero point, the two scripts call each other endlessly. 4th attempt Script file created with Notepad Format UTF-8 Storage location: “C:\Users\Myname\Documents\LorbyAxisAndOhs Files\Scripts\LOOP1.txt” Contents: :loop1 (L:A32NX_HYD_TRIM_WHEEL_PERCENT,-Number)-22-<-if{-1-(>K:ELEV_TRIM_UP)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,-Number)-22->-if{-1-(>K:ELEV_TRIM_DN)(WAIT:250)} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,-Number)-22-!=-if{-(GOTO:loop1)} Create a script in the script editor to call the file Content: (SCRIPTFILE:LOOP1.txt) Result: No reaction Since this is my first program with LAAO and RPN I am at the end of my skills. It would be nice if someone could give me some advice where my error is so that I can go on. My workaround which is not pretty but works: I calculate the number of steps to the target value and then have that executed . Script in the editor: (L:A32NX_HYD_TRIM_WHEEL_PERCENT,-Number)-22---0.35-/-abs-(>L:S_TRIM_WHEEL_IT;Number) (L:A32NX_HYD_TRIM_WHEEL_PERCENT,-Number)-22-<-if{-(L:S_TRIM_WHEEL_IT;Number)-iterate{-1-(>K:ELEV_TRIM_UP)(WAIT:250)}next-} (L:A32NX_HYD_TRIM_WHEEL_PERCENT,-Number)-22->-if{-(L:S_TRIM_WHEEL_IT;Number)-iterate{-1-(>K:ELEV_TRIM_DN)(WAIT:250)}next-} Thanks for advice Stefan regards Stefan Liebe
October 18, 20241 yr Commercial Member 1. The AAO (GOTO: command will only work on multi-line scripts. Using "Enter" in the RPN Editor will not create a new line of code, it is just for formatting. You have to add the "\n" to each line explicitly to create a multiline script (see AAO manual) :loop1 \n (L:A32NX_HYD_TRIM_WHEEL_PERCENT, Number) 22 < if{ 1 (>K:ELEV_TRIM_UP) } \n (L:A32NX_HYD_TRIM_WHEEL_PERCENT, Number) 22 > if{ 1 (>K:ELEV_TRIM_DN) } \n (WAIT:250) \n (L:A32NX_HYD_TRIM_WHEEL_PERCENT, Number) 22 != if{ (GOTO:loop1) } \n 2. When creating script files, make sure that space characters are space characters, not the replacement "dots" from the Editor. You cannot copy & paste code from the white editor box, you have to take it from the grey compiled code - or remove and replace the dots manually in the script file. I'm not sure what you did there, but your script file contents are looking very wrong. Where are all those "-" characters coming from? They must be spaces :loop1 (L:A32NX_HYD_TRIM_WHEEL_PERCENT, Number) 22 < if{ 1 (>K:ELEV_TRIM_UP) } (L:A32NX_HYD_TRIM_WHEEL_PERCENT, Number) 22 > if{ 1 (>K:ELEV_TRIM_DN) } (WAIT:250) (L:A32NX_HYD_TRIM_WHEEL_PERCENT, Number) 22 != if{ (GOTO:loop1) } 3. Space characters in the correct places are very important. They must be around every operand, operator and command. You cannot write one command directly after the other, there must be a space between them. 4. In RPN, scripts variables are not re-calculated when used in a single line of code. Before the line is processed, the LVar is replaced with its current value - that is why this script can't work. Multiline is the way to go. When you are at odds with RPN, consider using JScript or VBScript instead. Might be easier to handle. Also, there is a German Discord, generously provided by the JayDee community, where several skilled authors hang out. https://discord.com/channels/797403613730177034/934489852253192192 Edit: word of caution: make sure that the LVar will actually reach the value 22 and can't "jump" over it. Know what I mean? Edited October 18, 20241 yr by Lorby_SI LORBY-SI
October 18, 20241 yr Commercial Member 37 minutes ago, Stefan01 said: My workaround which is not pretty but works: I like it, better than using GOTO. Why? Because this will definitely terminate, even when the LVar is for example 22.05 The GOTO script on the other hand can go wrong and run indefinitely - when the LVar doesn't reach the value 22.0 exactly. You never know. Another hint: LVars that you use internally, and that are not synchronized with the sim, don't have a unit. It is just (L:S_TRIM_WHEEL_IT) nothing more (you had a typo in there too). No need to weigh down the sim interface with variables that you don't need in the sim itself. Edited October 18, 20241 yr by Lorby_SI LORBY-SI
October 18, 20241 yr Author Thanks for the quick reply, I will try it out tomorrow regards Stefan regards Stefan Liebe
November 2, 20241 yr On 10/18/2024 at 10:58 AM, Lorby_SI said: ....When you are at odds with RPN, consider using JScript or VBScript instead. Might be easier to handle. SOLVED: Found the new manual!! Doesn't AAO only recognize RPN? Edited November 2, 20241 yr by mrm0508 | i7-14700KF - 4080 SUPER | 32 GB RAM | Win 11 Pro | HC Bravo | AAO | StreamDeck |
November 2, 20241 yr Commercial Member 52 minutes ago, mrm0508 said: SOLVED: Found the new manual!! Doesn't AAO only recognize RPN? Version 4.50 will have "real/proper" Javascript too. LORBY-SI
Create an account or sign in to comment