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.

SliderGauge and script for 3 positions switch

Featured Replies

Hi,
I'm learning how to create scripts to complement Stream Deck profiles. I'm starting with a profile for the Miltech MH60.
First challenge: a 3-position switch:
(>IE:INSTRUMENT_OVD_AIR_SOURCE_SWITCH)
1 = OFF, 2 = ENGINE and 0 = APU
Unless I'm mistaken, you need to use a SliderGauge on the Stream Deck, but beyond that, I don't know. My attempts (based on examples from other scripts) have been unsuccessful.
My Test : (>IE:INSTRUMENT_OVD_AIR_SOURCE_SWITCH, number) 1 == if{ 0 (>IE:INSTRUMENT_OVD_AIR_SOURCE_SWITCH, number) ) els ( 1 (>IE:INSTRUMENT_OVD_AIR_SOURCE_SWITCH, number) }

Thanks for help

  • Commercial Member

1. "(IE:" reads from the variable, "(>IE:" writes to it (this is the same for all variables, A: L: B:, whatever)
2. IE's don't have units, they aren't variables in the true sense of the word
3. Make sure that when you read from the IE you really get these values. It doesn't have to be that way.

(IE:INSTRUMENT_OVD_AIR_SOURCE_SWITCH) 1 == if{ 0 (>IE:INSTRUMENT_OVD_AIR_SOURCE_SWITCH) ) els ( 1 (>IE:INSTRUMENT_OVD_AIR_SOURCE_SWITCH) }

For a tri-state switch (or more), you would use the "seq" or "iseq" RPN operators. I'm not at my computer at the moment, so this is off the top of my head, untested:

0 1 2 1 (IE:INSTRUMENT_OVD_AIR_SOURCE_SWITCH) (L:OvdAiSoSw) 4 iseq (>IE:INSTRUMENT_OVD_AIR_SOURCE_SWITCH) (>L:OvdAiSoSw)

or

0 1 2 1 (B:INSTRUMENT_OVD_AIR_SOURCE_SWITCH) (L:OvdAiSoSw) 4 iseq (>B:INSTRUMENT_OVD_AIR_SOURCE_SWITCH_Set) (>L:OvdAiSoSw)

The LVar is just an invented internal one. You need a different LVar for every iseq script.

The correct SD Action would be either a Slider or a MultiGauge (Slider is more performance friendly)

Edited by Lorby_SI

LORBY-SI

  • Author

Thank you for your explanation, I will test it this evening.

  • Author

Test successful, thank you for your help. Now I have to make the icons.

  • Author

The script works perfectly now. But I'm having trouble with the Stream Deck section. Here are my settings:
Read Variable L:MH60-Air Source
X Multiplier: -144

Button Setting K:MH60-Air Source

Background image: upload Sliding the attached image

spacer.png

 

But I only get states 0 <-> 2, never state 1.

 

Thanks for help

  • Author

The script : 0·2·1·0·(B:INSTRUMENT_OVD_AIR_SOURCE_SWITCH)·(L:OvdAiSoSw)·4·iseq·(>B:INSTRUMENT_OVD_AIR_SOURCE_SWITCH_Set)·(>L:OvdAiSoSw)

And the correct assign is = 1 = OFF, 2 = APU and 0 = ENG

  • Commercial Member
6 hours ago, pascalmartin said:

Read Variable L:MH60-Air Source

This is wrong. First, the script does not return a value (and if it did you would use type S:). Using the script variable here makes no sense, sorry.

Read variable must be the actual state variable of the switch: B:INSTRUMENT_OVD_AIR_SOURCE_SWITCH
 

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.