Jump to content
Sign in to follow this  
P1NBA11ER

Triggering multiple events with one button push?

Recommended Posts

I'm trying to set up my own profile for my X-Touch to use with a couple planes but currently focusing on the PMDG 737. What I'd like to do is assign one button to turn on the lights for engine start (beacon only), one for taxi lights (beacon, taxi, runway turn maybe) and one for takeoff (basically everything). I'd like each button to switch the lights to specific states, for example, after landing I want to go from takeoff light config to taxi light config. I can't seem to find a tutorial or even any suggestion for how to do this. I'm assuming the correct way would be to create a script that sets each desired state and then assign this new script to a button push. I've been going through all the pre-made scripts that I can find and I see lots of "toggle" scripts for lights and a few "set" scripts. The set scripts don't seem to be doing anything and while the toggle scripts work they won't work for my purpose since going from say taxi to take off would then again toggle the taxi lights to the wrong position.

I'm also not great with coding/scripting in general but I can follow instructiosn well and usually can figure out how to modify stuff. Any help would be greatly appreciated!

Share this post


Link to post
Share on other sites

Below is the scripts that I use for Landing Lights on and off, it also does a few other things like turn the ignition switches to continuous. You can find the K events Here https://aviation.allanville.com/misc/fsx-pmdg-737-ngx they are the same as FSX.

Simply go to Script editor and create a new script and place the below scripts into it (Not the name "LAND ON" but the portion below it) save as new. Then assign it to a button/switch.

LAND ON
2 (>K:#69751) (SLEEP:400) 2 (>K:#69753) (SLEEP:250) 2 (>K:#69736) (SLEEP:250) 1 (>K:#69742) 2 (>K:#69743) 2 (>K:#69744) 2 (>K:#69745) 2 (>K:#69746) (SLEEP:400) 1 (>K:#69747) (SLEEP:400) 1 (>K:#69748)
 

LAND OFF
0 (>K:#69743) 0 (>K:#69744) 0 (>K:#69745) 0 (>K:#69746) (SLEEP:400) 0 (>K:#69747) (SLEEP:400) 0 (>K:#69748) (SLEEP:250) 1 (>K:#69751) (SLEEP:400) 1 (>K:#69753) 


 ________________________________________________________________________________

 

i9 10800K | 16GB RAM | RTX 3080 | Windows 10 | 

Saitek x-45 | Bravo Throttle | Alpha Yoke | CH Pedals | Logitech Radio Panel | SmoothTrack | AAO

Share this post


Link to post
Share on other sites

Thanks so much!! This is doing exactly what I want. I did discover that I can also put a space, and a note after each number as a sort of comment for what the switch is and it seems I can use line breaks instead of spaces in the script so I can see the items as list and that seems to work too. So my first test looks like so...

2·(>K:#69754·LIGHTS_LOGO)·(SLEEP:50)
2·(>K:#69755·POS_STROBE)·(SLEEP:150)
1·(>K:#69756·ANT_COL)·(SLEEP:250)

Any reason this might break something and I should leave the string separated by spaces and without the notes?

Share this post


Link to post
Share on other sites
40 minutes ago, P1NBA11ER said:

(>K:#69754·LIGHTS_LOGO)

This is wrong, AAO will not recognize this command. The parentheses are not for decoration, they are part of the command.

2·(>K:#69754)·(SLEEP:50)··//·LIGHTS_LOGO
2·(>K:#69755)·(SLEEP:150)·//·POS_STROBE
1·(>K:#69756)·(SLEEP:250)·//·ANT_COL

No other text etc. allowed. If you want to add comments, you have to do it at the end of the line, with "// my comment"

In AAO, the RPN implementation is

- Case sensitive
- Allergic to space characters missing or being in the wrong place
- Angry when you start putting parentheses or braces in funny places because you think that you have to "structure" the code (they are part of the commands and cannot be used any other way)
- Generally unforgiving of any syntax errors or experiments. You cannot think or type outside the box, it must be exactly like specified in the AAO manual, chapter "Scripting" and in the simulator's SDK documentation.

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

So if I want to add a comment would it look like this?

1·(>K:#69749)·(SLEEP:50)·//TAXI·1·(>K:#69757)·(SLEEP:90)·//WING·2·(>K:#69754·)·(SLEEP:50)·//LIGHTS_LOGO

 

Share this post


Link to post
Share on other sites
4 minutes ago, P1NBA11ER said:

So if I want to add a comment would it look like this?


1·(>K:#69749)·(SLEEP:50)·//TAXI·1·(>K:#69757)·(SLEEP:90)·//WING·2·(>K:#69754·)·(SLEEP:50)·//LIGHTS_LOGO

 

No. Comments are only possible at the end of a line, not right in the middle of the code (how would the parser know where the comment ends?)

1·(>K:#69749)·(SLEEP:50)·//TAXI
1·(>K:#69757)·(SLEEP:90)·//WING
2·(>K:#69754·)·(SLEEP:50)·//LIGHTS_LOGO
Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

Ah yes, got it. So I can use a comment and then a line break, so I'm just moving my "note" on which switch I'm firing to the end. This is all very exciting. So many new possibilities for my X-Touch.

Share this post


Link to post
Share on other sites
2 minutes ago, P1NBA11ER said:

So I can use a comment and then a line break

Correct. The entire part after the // is treated as a comment up to the line break.

If your scripts get bigger, consider using script files instead.


LORBY-SI

Share this post


Link to post
Share on other sites
On 5/24/2022 at 5:39 PM, P1NBA11ER said:

What would be the advantage to using these over the ones I've set up already?

Each has an advantage. The number on a ROTOR_BRAKE event breaks down as XX(X)YY where X is the related L:var in the format of (L:switch_XX(X)_73X, number) so by looking at the event you immediately know the related READ variable. The YY is the action (01 and 02) for up/down switches, (07 and 08) for left/right knob rotation. For example:

event 39701(>K:ROTOR_BRAKE) arms/disarms the LNAV button on the MCP

to read the state, L:switch_397_73X, number would give the state (Armed of OFF)

The equivalent hash tag event would be 69632+397 ->  1(>K:#70029)

For the hash tag events you have to subtract 69632 (PMDG base constant) from the event number to get the related L:var. However, the hash tag event is easier to use with the SET events. To SET the MCP altitude window to 31,000' you would use:

31000 (>K:#14505)

The ROTOR_BRAKE event is harder to use for parameter passing


WW5130.png

| i9-10900F - 2080Ti | 32 GB RAM | Win 11 Pro | HC Bravo | AAO | StreamDeck | Air Manager |

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

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