February 2, 201016 yr Hi all,If trying to apply this C++ logic to an Xml gauge <click> tag, I'm basically trying to get a switchto rotate through 3 positions (0,1,2)if(eng_switch == 0) eng_switch = 1;else if(eng_switch == 1) eng_switch = 2;else eng_switch = 0;I've tried this....<Click>(L:eng_switch,enum) 0 == if{ 1 (>L:eng_switch,enum) } els{ (L:eng_switch,enum) 1 == if{ 2 (>L:eng_switch,enum) } els{ 0 (>L:eng_switch,enum) }}</Click>But this seems to only toggle the switch between position 0 and 1.Anyone know what I am missing here ?Thanks.Regards.Ernie.
February 3, 201016 yr Ernie, Truly an honor :-) Here are some examples ( not tested ) but should be OK. Included with up/down, loop/no loop examples. With all have a value of 0-2Go up, stop at 2 <Click>(L:eng_switch,enum) ++ 2 min (>L:eng_switch,enum)</Click> Go down, stop at 0 <Click>(L:eng_switch,enum) -- 0 max (>L:eng_switch,enum)</Click> This is an example of increase only with a reset to the minimum, value IE loop. Could be done many other ways..... <Click>(L:eng_switch,enum) ++ (>L:eng_switch,enum) (L:eng_switch,enum) 3 == if{ 0 (>L:eng_switch,enum) }</Click> This is an example of decrease only with a reset to the maximum value, IE loop. Could be done many other ways..... <Click>(L:eng_switch,enum) -- (>L:eng_switch,enum) (L:eng_switch,enum) -1 == if{ 2 (>L:eng_switch,enum) }</Click> ++ in xml equals add 1-- in xml equals subtract 1Just in case.I hope this can help.. Highest Regards,Roman FS RTWR SHRS F-111 JoinFS Little Navmap
February 3, 201016 yr Moderator Roman's already given you the "best" solution, but just for the sake of example, formatting and spaces are everything in XML. You needed to add at least one space between the final curly braces: } }Here's how I format XML using indents to make it easier to read, and eliminating the unnecessary else if's: <Click> (L:eng_switch,enum) 0 == if{ 1 (>L:eng_switch,enum) } (L:eng_switch,enum) 1 == if{ 2 (>L:eng_switch,enum) } (L:eng_switch,enum) 2 == if{ 0 (>L:eng_switch,enum) }</Click> Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
February 4, 201016 yr Author Roman , Bill,Thanks very much, that's just what I needed.Thanks Bill was well regarding the formatting tips.Regards.Ernie.
February 5, 201016 yr Moderator Thanks Bill was well regarding the formatting tips.No problem!Just to complete the set, here's yet another method using Left/Right mouse clicks... :( <Click> (M:Event) 'RightSingle' scmp 0 == if{ (L:eng_switch,enum) -- 0 max (>L:eng_switch,enum) } (M:Event) 'LeftSingle' scmp 0 == if{ (L:eng_switch,enum) ++ 2 min (>L:eng_switch,enum) }</Click> Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
February 5, 201016 yr Ernie & BillJust adding a touch to Bill's response - To have a left/right click is it necessary to "declare before querying" multiple click styles in a <click> attribute? Maybe/maybe not, never tried. I guess tis all dependant on system ( not FS 9? maybe 10? ) and .net versions. Just adding the "known" way to do it in FS9. The very first line is the only line modified from Bill's post.Roman <Click Kind="LeftSingle+RightSingle"> (M:Event) 'RightSingle' scmp 0 == if{ (L:eng_switch,enum) -- 0 max (>L:eng_switch,enum) } (M:Event) 'LeftSingle' scmp 0 == if{ (L:eng_switch,enum) ++ 2 min (>L:eng_switch,enum) }</Click> FS RTWR SHRS F-111 JoinFS Little Navmap
February 5, 201016 yr Moderator Yes, Roman. That is a requirement for both FS9 and FSX.Of course, one could also simply declare this to cover every contingency: <Click Kind="LeftAll+MiddleAll+RightAll"> I don't really recommend this however, since occasionally some unexpected consequences may occur... :( Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
February 6, 201016 yr RGR that Bill. "Drag" for one... It worked well in FS02 on XP & FS04 XP pre update anything. Donot know what caused it, FS update, XP update.??????? Now I have a problem where the mouse activate on "drag" will not release properly & let go without going to a "hotspot" and activating that particular one. The code is trying to pull X/Y values during the OP. Yes, tested it too on a super simple "drag" command without the X/Y pull, still the same weird stuff, maybe a total focus for VC? with a loss for 2d? Total loss on this one... It was/is an 02 code. ( no known differences for 04 )But yes,,<Click Kind="LeftAll+MiddleAll+RightAll">NOT GOOD ! <- tried, tested & delivered.Roman FS RTWR SHRS F-111 JoinFS Little Navmap
Create an account or sign in to comment