Jump to content
Sign in to follow this  
Rhinozherous

Layman question about scripts

Recommended Posts

Hello! 

I am no programer, this could be the reason if this question sounds dumb or so. 

I wonder if it is possible with AAO to create a script that executes LVARs one after another with a set time in between. For example, I want to setup one button for some after takeoff items to be executed one after another when I push a hardwarebutton. There should be some time (1 or 2 sec) between the execution and I want to use LVARs that I use for normal button assignment. 

Can anyone give me an example if this is possible? 

Thank you very much! 


Klaus Schmitzer

i7-14700KF 5.6GHz Water Cooled /// ZOTAC RTX 4070 TI Super 16GB /// 32GB RAM DDR5 /// Win11 /// SSDs only

DCS - XP12 - MSFS2020

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, Rhinozherous said:

Can anyone give me an example if this is possible? 

Yes, of course that is possible. The scripting engine is very powerful. People have built their own virtual copilot/flight attendant/natural speech controlled ATC/etc. with AAO. There are several ways of doing this, but choosing the right one depends on the complexitiy of what you want to do. It would help if you gave a concrete example of what you actually want to happen. 

(For example, LVars are actually not assets for controlling something. Changing the value of an LVar may do something by accident on some aircraft, on others it my work by design because the aircraft developer made it so. But by and large controlling knobs and switches is not what LVars do. So it would be important to have an example of what you want to do with which aircraft in particular)

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, Lorby_SI said:

Yes, of course that is possible. The scripting engine is very powerful. People have built their own virtual copilot/flight attendant/natural speech controlled ATC/etc. with AAO. There are several ways of doing this, but choosing the right one depends on the complexitiy of what you want to do. It would help if you gave a concrete example of what you actually want to happen. 

(For example, LVars are actually not assets for controlling something. Changing the value of an LVar may do something by accident on some aircraft, on others it my work by design because the aircraft developer made it so. But by and large controlling knobs and switches is not what LVars do. So it would be important to have an example of what you want to do with which aircraft in particular)

I have nothing fancy in mind. For example my after takeoff items for the JustFlight BAE146 are:

  • Engine Air - All 4 ON
  • APU Air - OFF
  • APU Master - OFF
  • Both Packs - ON
  • AC Pump - OFF
  • PTU - OFF

I had in mind to start these actions with a single button press on my hardware. Right now I have most of the switches bound to several buttons on my MFDs with LVARs. So far the LVARs seem to do their job. In high workload situations it would be nice to not switch these buttons one by one... Just press one button and they all get set in that order.

Edited by Rhinozherous

Klaus Schmitzer

i7-14700KF 5.6GHz Water Cooled /// ZOTAC RTX 4070 TI Super 16GB /// 32GB RAM DDR5 /// Win11 /// SSDs only

DCS - XP12 - MSFS2020

Share this post


Link to post
Share on other sites
Posted (edited)
19 hours ago, Rhinozherous said:

I have nothing fancy in mind. For example my after takeoff items for the JustFlight BAE146 are:

  • Engine Air - All 4 ON
  • APU Air - OFF
  • APU Master - OFF
  • Both Packs - ON
  • AC Pump - OFF
  • PTU - OFF

I had in mind to start these actions with a single button press on my hardware. Right now I have most of the switches bound to several buttons on my MFDs with LVARs. So far the LVARs seem to do their job. In high workload situations it would be nice to not switch these buttons one by one... Just press one button and they all get set in that order.

I am not familiar with this plane (anymore). How do you operate these items when you assign them to a button? I have the 146, and I seem to remember that initially many things were done with LVars. But that was then, things may have changed. What are the names of these LVars?

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

OK, so here are some examples

This will turn all 4 Engine Air switches ON:

1·(>L:OVHD_AIRSUPPLY_Eng1,·Number)·1·(>L:OVHD_AIRSUPPLY_Eng2,·Number)·
1·(>L:OVHD_AIRSUPPLY_Eng3,·Number)·1·(>L:OVHD_AIRSUPPLY_Eng4,·Number)·

This will turn them OFF

0·(>L:OVHD_AIRSUPPLY_Eng1,·Number)·0·(>L:OVHD_AIRSUPPLY_Eng2,·Number)·
0·(>L:OVHD_AIRSUPPLY_Eng3,·Number)·0·(>L:OVHD_AIRSUPPLY_Eng4,·Number)·

This will turn them ON with a 500ms delay between actuations, then wait for 5 seconds and then turns them off again

1·(>L:OVHD_AIRSUPPLY_Eng1,·Number)·(WAIT:500)·1·(>L:OVHD_AIRSUPPLY_Eng2,·Number)·(WAIT:500)·
1·(>L:OVHD_AIRSUPPLY_Eng3,·Number)·(WAIT:500)·1·(>L:OVHD_AIRSUPPLY_Eng4,·Number)·(WAIT:5000)·
0·(>L:OVHD_AIRSUPPLY_Eng1,·Number)·(WAIT:500)·0·(>L:OVHD_AIRSUPPLY_Eng2,·Number)·(WAIT:500)·
0·(>L:OVHD_AIRSUPPLY_Eng3,·Number)·(WAIT:500)·0·(>L:OVHD_AIRSUPPLY_Eng4,·Number)·

 

  • Like 1

LORBY-SI

Share this post


Link to post
Share on other sites

And finally, this is probably the entire script (not sure if those are the correct buttons)

1·(>L:OVHD_AIRSUPPLY_Eng1,·Number)·(WAIT:500)·1·(>L:OVHD_AIRSUPPLY_Eng2,·Number)·(WAIT:500)·
1·(>L:OVHD_AIRSUPPLY_Eng3,·Number)·(WAIT:500)·1·(>L:OVHD_AIRSUPPLY_Eng4,·Number)·(WAIT:500)·
0·(>L:OVHD_AIRSUPPLY_Apu,·Number)·(WAIT:500)·0·(>L:OVHD_APU_StartStop,·Number)·(WAIT:500)·
1·(>L:OVHD_AIRCOND_Pack1,·Number)·(WAIT:500)·1·(>L:OVHD_AIRCOND_Pack2,·Number)·(WAIT:500)·
1·(>L:OVHD_HYD_AC_pump,·Number)·(WAIT:500)·0·(>L:OVHD_HYD_PTU,·Number)

With a delay because it looks nice, but you can also lose all the WAIT commands, no problem.

  • Like 1

LORBY-SI

Share this post


Link to post
Share on other sites
Posted (edited)

How did I do it:

  1. I loaded the 146, waited until I was sitting in the cockpit
  2. Then, after AAO was connected, I used "Scripting->Read LVars from sim"
  3. After that was complete, I opened the script Editor. Now I can use the "Insert sim var" button to open the selection dialog, and all the 146s LVars will be in there. I use the Filter box at the bottom to look for them. When the dialog opens, you can immediately start typing, for example "apu" and then press Enter. The treelist will be reduced to those groups that contain variables with "apu" in their name. Open "Local Simulator Variables", there you will find those from the 146
  4. After selecting the variable, it will be copied into the script as if you want to read from it. You now have to change the code, add the value in front of the LVar and add the ">" sign.
  5. Be mindful that AAO RPN scripts must use currect syntax, AAO does not tolerate any errors. The scripts must be written exactly as in my examples, space characters, upper/lower case, all of that is important.
Edited by Lorby_SI
  • Like 1

LORBY-SI

Share this post


Link to post
Share on other sites

Wow, thank you very much! I will play with these examples! 


Klaus Schmitzer

i7-14700KF 5.6GHz Water Cooled /// ZOTAC RTX 4070 TI Super 16GB /// 32GB RAM DDR5 /// Win11 /// SSDs only

DCS - XP12 - MSFS2020

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