Jump to content

Recommended Posts

Posted

I am trying to work out how to chain multiple commands together.

For example, when I press button 1, I want it to send CTL+F12, followed by Numpad 6.

When I press the same button again, I want it to send CTl+F11, followed by Numpad 5.

 How do I achieve this?

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

Posted (edited)

Ok, as I find RPN really difficult to understand, could you please give me an example based on my chain? So that I can learn how to use RPN? 
 

I don't understand how to send keyboard commands in an RPN script.

 

I have read this doc at the SDK page but it has not answered my question.

https://docs.flightsimulator.com/html/Additional_Information/Reverse_Polish_Notation.htm


thank you

Edited by toby23

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

  • Commercial Member
Posted (edited)
1 hour ago, toby23 said:

I don't understand how to send keyboard commands in an RPN script

On the AAO script editor there is a button "Insert vKey"

The RPN dialect in AAO has been expanded massively over the default simulator spec. The AAO manual contains lists with all the extra operators and commands.

If you feel more comfortable with Javascript, JScript or VBScript, you can use those too.

 

Edited by Lorby_SI

LORBY-SI

  • Commercial Member
Posted (edited)
1 hour ago, toby23 said:

could you please give me an example based on my chain?

Not at the moment, sorry. Making a button do different things, every time you press it, is a complex use case that requires some serious thought. And the use of a control LVar. Any some reset criteria (what happens when you don't follow through with the sequence)

It would probably be best split into several parts calling each other.

Remember to include the (FOCUS: command to set the Windows app focus on MSFS before sending virtual keys.

Edited by Lorby_SI

LORBY-SI

Posted (edited)
17 minutes ago, Lorby_SI said:

On the AAO script editor there is a button "Insert vKey"

The RPN dialect in AAO has been expanded massively over the default simulator spec. The AAO manual contains lists with all the extra operators and commands.

If you feel more comfortable with Javascript, JScript or VBScript, you can use those too.

 

Appreciate you are trying to help but why is it so complicated to send a series of keyboard inputs?
I could do this easily with the Thrustmaster Target software 15 years ago. All that I am trying to do is this...

Press Button = Pause Track-IR > View Custom Camera

Press Button again = Unpause Track-IR > View a different Custom Camera

Surely something that simple can be accomplished with AAO easily?

Edited by toby23

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

  • Commercial Member
Posted (edited)
1 hour ago, toby23 said:

why is it so complicated to send a series of keyboard inputs

It is what it is. AAO scripts are the way to go, and once you know your way around them, they are only as complex as you make them.

I can't give you an example right now because I am still at work and can only write on my phone. But there are examples in the AAO manual.

Edited by Lorby_SI
  • Like 1

LORBY-SI

  • Commercial Member
Posted (edited)

A script would look something like this:

(FOCUS:flightsimulator)·(SPLIT:100)
(L:tirswitch)·0·==·if{·
(VKD:29-157-162)·(VKD:88-216-123)·(SPLIT:100)·(VKU:88-216-123)·(VKU:29-157-162)·
(SPLIT:100)·(VKD:77-205-102)·(SPLIT:100)·(VKU:77-205-102)·}·els{·
(VKD:29-157-162)·(VKD:87-215-122)·(SPLIT:100)·(VKU:87-215-122)·(VKU:29-157-162)·
(SPLIT:100)·(VKD:76-204-101)·(SPLIT:100)·(VKU:76-204-101)·}·
1·(L:tirswitch)·-·(>L:tirswitch)

Assuming that we are talking about MSFS 2020 - otherwise the FOCUS statement is different. It sets the Windows focus on the app that you specify, so all key presses end up there and not somewhere else (with Windows, the focused app is "eating" all keyboard input)

But these are the scan codes of MY keyboard, they don't have to be the same of YOURs. Internationally, keyboards are not the same, they all have different things painted on them and trigger different internals. Which is why AAO uses the low level scan codes. These you get with the aforementioned button on the Script Editor dialog in AAO. Meaning, you probably can't just copy and paste this code, you will have to re-type it and insert your own scan codes using the button. VKD is "virtual key down", VKU is "virtual key up". The 100ms SPLITs are necessary because MSFS can't handle key events that are coming in too fast.

(L:tirswitch) is the control variable that makes the script react differently each time you call it. The variable alternates between 0 and 1 with each call. LVars can just be invented at any time, they don't have to "exist", they don't have to be registered. AAO will use them the first time they come up in a script, same as the sim.

Make sure to read the AAO manual chapter about scripting (and LVars).

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...