Jump to content
Sign in to follow this  
n4gix

Incrementing a variable in xml

Recommended Posts

Guest depot_haldol

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Guest depot_haldol

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

Share this post


Link to post
Share on other sites

>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

Share this post


Link to post
Share on other sites
Guest Vorlin

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Guest Vorlin

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

>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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 * +Alex.

Share this post


Link to post
Share on other sites

>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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...