July 16, 2025Jul 16 Hello to everyone, I'm still a newbie in RPN and in AAO. I already annoyed you with a problem about the simrate. Now, I have a new one with the trim. I would like to reset it using a button on my stream deck. I tried using this code but it never stops. I would like it to exit the script when the trim reaches 0 or-0 but it loops between 0 and 1 or so. Do you have any idea ? In this one, the script name is RESET_TRIM : if(·0·<>(P:AILERON·TRIM·PCT,·percent)(GOTO:·srloop)·)·\n :srloop·\n (P:AILERON·TRIM·PCT,·percent)·(L:Scripts-RESET_TRIM)·<·if{·0·(>K:AILERON_TRIM_RIGHT)·(GOTO:srloop)·}·\n (P:AILERON·TRIM·PCT,·percent)·(L:Scripts-RESET_TRIM)·>·if{·0·(>K:AILERON_TRIM_LEFT)·(GOTO:srloop)·}·\n (END)·\n In this second one, the script name is RESET_TRIM_test (L:Scripts-RESET_TRIM_test)·2·log·near·-2·max·7·min· (P:AILERON·TRIM·PCT,·percent)·2·log·-·sp0· l0·0·<·if{·l0·abs·iterate{·1·(>K:AILERON_TRIM_LEFT)·}next·} l0·0·>·if{·l0·iterate{·1·(>K:AILERON_TRIM_RIGHT)·}next·}
July 16, 2025Jul 16 Commercial Member 22 minutes ago, PiLVaLK said: P:AILERON This is wrong. These are A: variables, not P: Why not just do this? 0.0·(>A:AILERON·TRIM·PCT,·Percent) The variable is not read-only, check the SDK documentation. Or in your case (L:Scripts-RESET_TRIM)·(>A:AILERON·TRIM·PCT,·Percent) Just make sure that the LVar is in the correct value range for this AVar (see SDK documentation or try it out) Edited July 16, 2025Jul 16 by Lorby_SI LORBY-SI
July 16, 2025Jul 16 Commercial Member 25 minutes ago, PiLVaLK said: Do you have any idea ? Most likely the result is never exactly 0.0, that is why your loop doesn't terminate. You would have to implement a "range" that stops it. I'm also not sure what the first line is supposed to do, the if- code is wrong and it doesn't really make sense to advance to the label when that is in the next line anyway. I also have no idea what your second script is supposed to achieve. This looks like a clone of a sim rate script that I've seen somewhere - which has a completely different value range and purpose. For a script like this to work you would have to figure out by how many percent the K-Events change the trim -exactly. Only then can you calculate how many Ks you would need to dial in a specific value. But I am pretty sure that this increment will be different for different aircraft, so not really suitable. Edited July 16, 2025Jul 16 by Lorby_SI LORBY-SI
July 16, 2025Jul 16 Author The second code is a clone of a script you made for me a few weeks ago for the sim rate. I will try to make it simple as you suggested. I didn't know how to do so, once again, thank you !!
July 16, 2025Jul 16 Author 22 minutes ago, Lorby_SI said: This is wrong. These are A: variables, not P: Why not just do this? 0.0·(>A:AILERON·TRIM·PCT,·Percent) The variable is not read-only, check the SDK documentation. Or in your case (L:Scripts-RESET_TRIM)·(>A:AILERON·TRIM·PCT,·Percent) Just make sure that the LVar is in the correct value range for this AVar (see SDK documentation or try it out) OK, you suggested to make it simple.... It works. I used the first suggestion. Thanks a lot !!
Create an account or sign in to comment