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.

Incrementing a variable in xml

Featured Replies

Hi folks. I'm making an xml gauge that will display three different bitmaps depending on the state of . My rather basic problem is getting Dummy to increment in steps from 0 to 2. Here's what I'm trying to do in pseudo-code: If Dummy is greater than 1, then decrement Dummy by 1 <----- HELP If Dummy is less than 2, then increment Dummy by 1 <----- HELP I don't know how to do the If... then... statements in xml. The rest seems to be working okay. Any help would be appreciated, thanks.---Will

  • Author
  • Moderator

To decrease:(L:Dummy, enum) -- 0 max (>L:Dummy, enum)To increase:(L:Dummy, enum) ++ 3 min (>L:Dummy, enum)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Bill, that works like a charm. Thanks.---Will

  • Author
  • Moderator

>Bill, that works like a charm. Thanks.>---WillNo problem... I'm simply passing on what I've learned here myself!Note that this is perhaps the simplest and most flexible way to write this function. Here is the prototype for setting the ranges:To decrease:(L:Dummy, enum) -- lowest value max (>L:Dummy, enum)To increase:(L:Dummy, enum) ++ highest value + 1 min (>L:Dummy, enum)For example, you need a three position switch with "center off = 0" so that the switch will always load in the "off" position.(L:Dummy, enum) -- -1 max (>L:Dummy, enum)(L:Dummy, enum) ++ 2 min (>L:Dummy, enum)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Bill,I'm still grasping a lot of this. Thanks for your help with the SDK concern. I was wondering something about your example above:****For example, you need a three position switch with "center off = 0" so that the switch will always load in the "off" position.(L:Dummy, enum) -- -1 max (>L:Dummy, enum)(L:Dummy, enum) ++ 2 min (>L:Dummy, enum)****Am I missing something, or is that a four position setup instead of three?L:Dummy = -1(L:Dummy, enum) -- -1 max (>L:Dummy, enum)Returns -1, yes?andL:Dummy = 2(L:Dummy, enum) ++ 2 min (>L:Dummy, enum)Returns 2, yes?So, we have -1,0,1 and 2 for possible results.Or do I need more coffee?Scott / Vorlin

Hi,Gallons, but you are right.Jan"Beatus ille qui procul negotiis..."

Jan

 

 

 

"Beatus ille qui procul negotiis..."

LOL thanks Jan.I'm at that intermediate stage where I can grasp the advanced things if I read carefully and the things I find cause me to re-evaluate the thigns that I thought I knew. Methods I've been using may have functioned, but I now understand why much of it has been horrible.It's got me trying to pull apoart every little line that I see and I'm never quite sure if I understand it or if there is some tiny detail about stack operations that I'm missing.Scott / Vorlin

To increase - Right template: (L:dummy, enum) ++ "highest value" min (>L:dummy, enum)(Bill please stop playing with Gmax and posting on forums at the same time! :-lol )Tom

  • Author
  • Moderator

>To increase - Right template:>> (L:dummy, enum) ++ "highest value" min (>L:dummy,>enum)>> (Bill please stop playing with Gmax and posting on forums at>the same time! :-lol )Sorry! I keep forgetting that the XML for .mdl files is slightly different than XML for gauges! :-bang :-grr *:-* :-abduct

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author
  • Moderator

Oh, BTW Tom...I am using the code above to control a three position switch, center OFF, and need to scale the output to keyframe 0, 50, 100I tried this, but it doesn't work in the model: (L:Light_Right,enum) 50 50 * + 100if the L:var is -1, then (-1 * 50) + 50 = 0if the L:var is 0, then (0 * 50) + 50 = 50if the L:var is 1, then (1 * 50) + 50 = 100Any help for this old C-dog? ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author
  • Moderator

>Hello,>>After (L:Light_Right,enum) 50 50 * + >you have 2499-2501 numbers range in stack.>If you wanna have range from 0 to 100 write:>(L:Light_Right,enum) 50 * 50 + or 50 (L:Light_Right,enum) 50 *>+Thanks... as usual, my logic is sound, but my syntax sucks... ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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.