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.

Format ETE as hh:mm:ss

Featured Replies

Hello,

Can someone please help me adjusting this code so that the variable:

GPS WP ETE, Minutes

Displays the ETE in this format:  hh:mm:ss ( 01:32:12 )

%(E:LOCAL TIME, Hours)%!02d! ':' scat %(E:LOCAL TIME, minutes) (E:LOCAL TIME, Hours) flr 60 *  -%!02d! scat

On variable 1 (A:) GPS WP ETE, Minutes will display the minutes with no problem.

Thanks

  • Commercial Member
1 hour ago, IrwinMFletcher said:

Displays

Display where? 

In your code snippet (which doesn't display seconds btw., this is just "HH:MM") I would just replace "LOCAL TIME" with "GPS WP ETE"

Edited by Lorby_SI

LORBY-SI

  • Author

Thank you for your reply and assistance, I greatly appreciate it!

So, when I try the above it displays NULL.

Here is what I am working with:

Text Gauge
Variable 1: 
A:   %(E:GPS WP ETE, Hours)%!02d! ':' scat %(E:GPS WP ETE, minutes) (E:GPS WP ETE, Hours) flr 60 *  -%!02d! scat

the result is 'null'.

Along the same lines, I tried to add the seconds (hh:mm:ss) with this edit:

%(E:GPS WP ETE, Hours)%!02d! ':' scat %(E:GPS WP ETE, minutes) (E:GPS WP ETE, Hours) flr 60 * -%!02d! ':' scat %(E:GPS WP ETE, seconds) (E:GPS WP ETE, minutes) flr 60 * -%!02d! scat
 
(it's on one line)

What simple thing am I missing?

  • Commercial Member
8 hours ago, IrwinMFletcher said:

What simple thing am I missing?

You want the app to evaluate a script, so the type must be "S:", not "A:"

A: means SDK simulator variable
L: is a local simulator variable
P: is an SDK program variable
E: is an SDK environment variable
S: is AAO specific for RPN script code
B: and IE: are MSFS specific input events (that can be read too)
DREF: is for X-Plane
PMDG: is for PMDG SDK variables
 

Check out the MSFS SDK documentation about variable types and RPN in general:

Reverse Polish Notation

AAOs dialect is almost identical. It doesn't support some variable types and certain features, like Mouse and Resource variables. Instead it has more operators and the AAO commands (see AAO manual, chapter "Scripting", there are lists with all of the commands.

Edited by Lorby_SI

LORBY-SI

  • 1 month later...
  • Author

I do not know why converting GPS WP ETE to hh:mm:ss and GPS WP ETA to hh:mm (sim time not pc time)

I am sure it has to by my attempt at some rpn scripting:

%(E:GPS WP ETE, Hours)%!02d! ':' scat %(E:GPS WP ETE, Minutes) (E:GPS WP ETE, Hours) 60 * - %!02d! ':' scat %(E:GPS WP ETE, Seconds) (E:GPS WP ETE, Minutes) 60 * - %!02d! scat    (this is on one line)

My StreamDeck displays null for GPS WP ETE instead of hh:mm:ss

same goes for:

%(E:GPS WP ETA, Hours)%!02d! ':' scat %(E:GPS WP ETA, Minutes) (E:GPS WP ETA, Hours) 60 * - %!02d! ':' scat %(E:GPS WP ETA, Seconds) (E:GPS WP ETA, Minutes) 60 * - %!02d! scat

What do I need to format GPS WP ETE as hh:mm:ss

AND

GPS WP ETA as hh:mm

I am using the S: type variable in the AAO StreamDeck plugin...  I did learn that much.

Again, thanks for your time.

  • Commercial Member
53 minutes ago, IrwinMFletcher said:

GPS WP ETE

Is an A: variable. It will only contain data when you have a flight plan loded in the in-sim GPS (=when you made the flight plan on the world map and are fyling with ATC). It will not work for 3rd party GPS or FMC instruments.

Did you check the variable first, to make sure that it contains the value that you are looking for? And did you test the script in the AAO script Editor, does it work?

Also, don't use so many different units, better to use maths. In your example, you are actually querying three different variables. I would suggest using either Seconds or Minutes for all calculations

Quote

My StreamDeck displays null for GPS WP ETE instead of hh:mm:ss

What does that mean? Which one of the Actions out of the AAO Plugin did you use and how has it been configured?

In general, your code is missing a "scat" and a few "flr" commands. You have to round down when subtracting the hours/minutes, otherwise the fraction digits will make the result go to 0! And I would probably lose the seconds, I don't think that the sim has that kind of accuracy in the first place, and they take up valuable space on the Action button. 

%(A:GPS WP ETE, Hours)%!02d! ':' scat %(A:GPS WP ETE, Minutes) (A:GPS WP ETE, Hours) flr 60 * - %!02d! scat ':' scat %(A:GPS WP ETE, Seconds) (A:GPS WP ETE, Minutes) flr 60 * - %!02d! scat

I am using a TextGauge Action, Variable 1 Type S:, code in the box, "Submit", no other changes. It displays 00:00:00 as expected.

Edited by Lorby_SI

LORBY-SI

  • Commercial Member

I've tested and fixed the script. The main problem was maths, not RPN, you need to get rid of the fractions before subtracting the hours or minutes. Otherwise they cancel each other out

(A:GPS WP ETE, Seconds) (A:GPS WP ETE, Minutes) 60 * - 

Let as assume that you have 90 seconds, that is 1.5 in Minutes. Using the script like it was the calculation is 90 (1.5 60 * = 90) - => 90 - 90 = 0

(A:GPS WP ETE, Seconds) (A:GPS WP ETE, Minutes) flr 60 * - 

"flr" (floor) is cutting off the fractions of the Minutes value, so the result is 90 (1.5 flr = 1.0 * 60 = 60) => 90 - 60 = 30.

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.