Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AAO Script - Very Basic Beginner Question

Featured Replies

Button Type:  Lorbi-SI AxisAndOhs:  TextGuage
Title:  Condition
Variable 1:  S:  MyScripts-Cessna 208B Condition Lever Position

Script Title: Cessna 208B Condition Lever Position
Script Group:  MyScripts

RPN SCRIPT (likely wrong):
(TURB ENG CONDITION LEVER POSITION:1) 2 == 'HIGH' (TURB ENG CONDITION LEVER POSITION:1) 1 == 'LOW' (TURB ENG CONDITION LEVER POSITION:1) 0 == 'CUTOFF' ? 'UNKNOWN'

 

Basically, just trying to learn how AaO and a very basic script works so I can learn from that and keep going, hopefully.

I would like the StreamDeck Button (details above) to display:

TURB ENG CONDITION LEVER POSITION:1 = 2 then display HIGH
TURB ENG CONDITION LEVER POSITION:1 = 1 then display LOW
TURB ENG CONDITION LEVER POSITION:1 = 0 then display CUTOFF

What am I missing to get this working?  Also, what other languages can be used with AaO?  I saw in the documentation a couple other choices, is there a way to extend this to other languages, such as LUA?

I really appreciate any help getting this script working so I can make other buttons with a If Then Else statement and change the button display based on the value returned.  Maybe it is just text, like this time, or maybe this image or that image based on the value.

Thanks
 

  • Commercial Member

AAO basically replicates the MS Flightsim RPN, the same dialect that MSFS itself uses. See spec here:

Reverse Polish Notation

In the AAO manual, chapter "Scripting", there is the adapted spec for the application, the dialect has been expanded with more operators and the AAO specific commands.

8 hours ago, IrwinMFletcher said:

What am I missing to get this working?

1. The variables have neither Type nor Unit. Proper syntax is "(Type:Name, Unit)" (see spec). Make sure to check the value range of the variable so you get your conditions right.  The Value range depends on the Unit that you supply, the simulator converts between Units internally (example: Degrees/Radians or Feet/Meters) Use "Scripting->Watch simulator variables" to check this.
2. The script doesn't contain any conditional operators - if{..} els{...}
3. Personally, I would use a MulitGauge for something like this. Only recently I made one for the thrust levers, maybe that will help getting you started.
https://www.dropbox.com/scl/fi/xvofp5a14u4jfihc3vrk3/PWR_Multi.zip?rlkey=fd2jon0e7trfwoxmuc3rq6tsk&st=sswdo4es&dl=0

I'm not at the computer, so I can't test this, but theoretically the script should look like this:

(A:TURB ENG CONDITION LEVER POSITION:1, Number) 2 == if{ 'HIGH' } els{ (A:TURB ENG CONDITION LEVER POSITION:1, Number) 1 == if{ 'LOW' } els{ (A:TURB ENG CONDITION LEVER POSITION:1, Number) 0 == if{ 'CUTOFF' } els{ 'UNKNOWN' } } }

Or more elegant, using registers

(A:TURB ENG CONDITION LEVER POSITION:1, Number) s0 'UNKNOWN' ss0 l0 2 == if{ 'HIGH' ss0 } l0 1 == if{ 'LOW' ss0 } l0 0 == if{ 'CUTOFF' ss0 } sl0

 

8 hours ago, IrwinMFletcher said:

Also, what other languages can be used with AaO?  I saw in the documentation a couple other choices, is there a way to extend this to other languages, such as LUA?

Javascript, JScript and VBScript. No LUA, sorry. Theoretically it can process whatever you get working in the Windows Scripting Host - provided that the language follows the same syntax guidelines as the three mentioned.

These other languages can only be used in AAO internal scripts, not in the StreamDeck action - that is RPN only. 

 

 

Edited by Lorby_SI

LORBY-SI

  • Author

Wow!  Thanks for such a great and detailed answer!  Your script seems to do exactly what I would like, at least when using AaO > Test and Debug Window.

Now, how do I get the StreamDeck button to display the HIGH LOW or CUTOFF as opposed to the number 0, 1, 2?

I played with your multiguage but that is a bit advanced for me, today.  

Thanks!

 

  • Commercial Member
28 minutes ago, IrwinMFletcher said:

Now, how do I get the StreamDeck button to display the HIGH LOW or CUTOFF as opposed to the number 0, 1, 2?

Type S: on the StreamDeck Action is for entering actual RPN code, not a script ID. You copy and paste the script code into the contents box of Variable 1

(A:TURB ENG CONDITION LEVER POSITION:1, Number) s0 'UNKNOWN' ss0 l0 2 == if{ 'HIGH' ss0 } l0 1 == if{ 'LOW' ss0 } l0 0 == if{ 'CUTOFF' ss0 } sl0

You cannot call a script in AAO by its ID and expect a return value, that is not how this works. If you want to execute a script in AAO, use K: (see AAO manual about how to call scripts). This is "write-only" and can only be used for the button actions. You could create a toggle script for this action, so you can cycle through the Condition lever settings by pressing the button. That you would implement and test in AAO and then call with K: scriptgroup-scriptname

Edited by Lorby_SI

LORBY-SI

  • Commercial Member
1 hour ago, Lorby_SI said:

You could create a toggle script for this action, so you can cycle through the Condition lever settings by pressing the button.

I would do it like this:

Text gauge Variable 1:
Type S:
Code: (A:TURB ENG CONDITION LEVER POSITION:1, Number) s0 'UNKNOWN' ss0 l0 2 == if{ 'HIGH' ss0 } l0 1 == if{ 'LOW' ss0 } l0 0 == if{ 'CUTOFF' ss0 } sl0

Text gauge button settings,

Key Down event:
Type S: 
Code: (A:TURB ENG CONDITION LEVER POSITION:1, Number) 1 == if{ 1 (>B:FUEL1_Condition_Lever_High_Idle) } els{ 1 (>B:FUEL1_Condition_Lever_Low_Idle) }
Event value: 1

Long press down:
Type B:
Code: FUEL1_Condition_Lever_Cut_Off

-> Submit/Alt-S

What this does is, every time you press the button normally, it will cycle between high and low. When you keep the button pressed down, it will go to the cut off position. Pressing it short again, will go up to low.

Here is the complete action on a SD profile:

https://www.dropbox.com/scl/fi/xvofp5a14u4jfihc3vrk3/PWR_Multi.zip?rlkey=fd2jon0e7trfwoxmuc3rq6tsk&dl=0

Edited by Lorby_SI

LORBY-SI

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.