Jump to content

Recommended Posts

Posted

I am trying to assign H:Vars included with the HPG H145 to a button press.

hvar.jpg-

When I click Test, it works as intended.

When I click Save, AAO changes the H:Var to and L:Var and the assignment no longer works, why?

lvar.jpg

And how do I keep the H:Var as supplied by the developer?

Thanks

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11

Posted (edited)

For anyone who comes here wondering the same, it's easier to create a script and assign that to the button.

Cut and paste the H:Var code using the syntax: (>H:VarCode, 1) and give the script a title and Save it and then assign the script to a button.

The script below closes the latch and switches Eng 1 to Flight in the HPG H145 for example.

script.jpg

script-button-assign.jpg

Edited by toby23

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11

  • Commercial Member
Posted
9 hours ago, toby23 said:

why?

You are probably using a older version. This should be fixed in the current 4.52

  • Like 1

LORBY-SI

  • Commercial Member
Posted
7 hours ago, toby23 said:

(>H:VarCode, 1)

No. This may work by accident, but this syntax is incorrect.

The correct syntax for the assignment operator "(>" is this:
value (>type:name, unit)

HVars don't require a unit and you can shorten the code to 

1 (>H:somename)

but

1 (>H:somename, Number) 

should also work.

Please note that you must supply a value, otherwise it will just be 0. That may work for some items, but in general the correct value for the intended variable or event must be supplied.

Additional note: small code like this can also be inserted directly on the button assignment when switchting to "MAN" and selecting "RPN".

LORBY-SI

Posted
8 hours ago, Lorby_SI said:

No. This may work by accident, but this syntax is incorrect.

The correct syntax for the assignment operator "(>" is this:
value (>type:name, unit)

HVars don't require a unit and you can shorten the code to 

1 (>H:somename)

but

1 (>H:somename, Number) 

should also work.

So I tried both of these but cannot get the 'green light' in the Edit Scripts window. Any idea why?
N.B. I have updated to the latest version.

new.jpg

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11

Posted

What did end up working (as well as my original version) was: (>H:H145_SDK_ECP_MAIN_1_FLIGHT)
 

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11

  • Commercial Member
Posted
1 hour ago, toby23 said:

Any idea why?

There must be a space between the value and the variable.

  • Like 1

LORBY-SI

  • Commercial Member
Posted
1 hour ago, toby23 said:

N.B. I have updated to the latest version.

What about your inital problem, that the direct assignment to a button would revert to L:? This doesn't happen to me.

LORBY-SI

Posted
11 minutes ago, Lorby_SI said:

There must be a space between the value and the variable.

Ok, that works. Thanks.

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11

Posted
5 minutes ago, Lorby_SI said:

What about your inital problem, that the direct assignment to a button would revert to L:? This doesn't happen to me.

I have a solution that works, no need for me to complicate this. I appreciate your help.

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11

  • Commercial Member
Posted
31 minutes ago, toby23 said:

I have a solution that works, no need for me to complicate this. I appreciate your help.

I still would like to know if the problem persists for you in 4.52
This was a known bug in previous versions, but it shouldn't be there in 4.52 - and I cannot reproduce it. So, at the moment, I don't know if there is something to fix or not.

Besides, using scripts requires yet another configuration step that you don't have to take when assigning things to a button directly.

LORBY-SI

Posted (edited)
On 4/16/2025 at 6:49 AM, Lorby_SI said:

Additional note: small code like this can also be inserted directly on the button assignment when switchting to "MAN" and selecting "RPN".

1. Selecting RPN and MAN (highlighted in black, not green?) and entering code for HVar e.g. H:H145_SDK_ECP_MAIN_LATCH_1_OFF does not work. Selection needs to be H: for it to work.

2. I can confirm that pasting an HVar into the entry field and selecting H: and Saving does work in 4.52. It does not revert to L:.

3. As I need multiple commands, e.g. Open Latch then Move Switch to Pos X, I am using Scripts as I believe your suggestion is for single commands only?

With Regards.

Edited by toby23

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11

  • Commercial Member
Posted
1 hour ago, toby23 said:

e.g. H:H145_SDK_ECP_MAIN_LATCH_1_OFF

"RPN" means proper script code

1 (>H:H145_SDK_ECP_MAIN_LATCH_1_OFF)

LORBY-SI

Posted (edited)

Ok, thanks for letting me know. I can't get my head round RPN. I have tried but find it very complicated and unintuitive.

Edited by toby23

Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11

  • Commercial Member
Posted (edited)
31 minutes ago, toby23 said:

I can't get my head round RPN. I have tried but find it very complicated and unintuitive.

RPN has been the Microsoft simulators' native language since forever, it needs next to zero overhead (compared to high tier languages) and thus can be processed very very fast. Most importantly, the Behavior code in MSFS 20/24 is still written in RPN, and the Behavior code is what operates knobs, levers and switches. Ideally you can simply replicate the behavior code (retrieved using the MSFS developer mode) in AAO and are set. Those are the reasons why it is the primary choice in AAO. You can write scripts in Javascript, JScript or VBScript too, but I can't recommend doing that for these tiny scripts that you are using.

RPN spec is in the MSFS SDK documentation:

Reverse Polish Notation

But make sure to read the AAO manual, chapter "Scripting" too. The dialect in AAO has been expanded over what is in the SDK spec, on the other hand it doesn't have some of the feature that make no sense in AAO (like processing I: or O: variables - we can't access those anyway)

Edited by Lorby_SI
  • Like 1

LORBY-SI

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...