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.

AMBIENT PRECIP STATE, Number - Display Different Images

Featured Replies

Hello,

I would like to create a button on my Streamdeck that displays an image based on the value AMBIENT PRECIP STATE, Number.

2 = None (image1)
4 = Rain (image2)
8 = Snow (image3)

I created a script located at MyScripts > Weather_State with the following:

(A:AMBIENT PRECIP STATE, Mask) 2 == if{'None'} els{ (A:AMBIENT PRECIP STATE, Mask) 4 == if{RAIN}
els{ (A:AMBIENT PRECIP STATE, Mask) 8 == if{SNOW} els{ '' } } }

Under Variable1 I have the following settings:

Variable A: ( I have tried them all A L P E S B )  MyScripts-Weather_State

Two questions.  One, the above still only displays the variable value 2, 4 or 8 why is it not displaying None, Rain or Snow?

Two, how do I get the above script to show an image based on the 2, 4 or 8 value that is returned?


Thanks in advance!

  • Commercial Member
1 hour ago, IrwinMFletcher said:

Two questions.  One, the above still only displays the variable value 2, 4 or 8 why is it not displaying None, Rain or Snow?

What action are you using? In general, a script doesn't return a value when you call it by "group-name". That syntax is only for executing it (>K:). 

For example, when using it i a TextGauge action the type would be S: and then paste the entire code into the box - after fixing the syntax errors, rain and snow aren't string literals. Also be mindful that this must be a single line of code, there can't be any line breaks in it (like there are in your script above)

(A:AMBIENT PRECIP STATE, Mask) 2 == if{ 'None' } els{ (A:AMBIENT PRECIP STATE, Mask) 4 == if{ 'RAIN' } els{ (A:AMBIENT PRECIP STATE, Mask) 8 == if{ 'SNOW' } els{ 'NONE' } } }

 

1 hour ago, IrwinMFletcher said:

Two, how do I get the above script to show an image based on the 2, 4 or 8 value that is returned?

Use either a SliderGauge or a MultiGauge and utilize the AVar directly, without a script. 

Here is a video about how a SliderGauge works, made by a fellow simmer

Edit: sorry, I just realized that it is in German. You will have to trust YouTube's AI CC translation .

 

Edited by Lorby_SI

LORBY-SI

  • Commercial Member

Btw and you will need a bit of math - just leaving this here in case you struggle with the SliderGauge.

To convert the bit mask (A:AMBIENT PRECIP STATE, Mask) into values 0,1,2 for easy multiplication you use the log operator to base 2 and subtract 1 from it:

(A:AMBIENT PRECIP STATE, Mask) 2 log 1 -

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.