March 23, 200620 yr 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
March 23, 200620 yr 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
March 23, 200620 yr 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
March 23, 200620 yr 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
March 23, 200620 yr Hi,Gallons, but you are right.Jan"Beatus ille qui procul negotiis..." Jan "Beatus ille qui procul negotiis..."
March 23, 200620 yr 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
March 23, 200620 yr 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
March 25, 200620 yr 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
March 25, 200620 yr 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
March 25, 200620 yr 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. http://sibwings.com http://fsaircraft.net http://fsairport.net
March 25, 200620 yr 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