1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

NAV1/2 Active Indicators; how?

Discussion in 'Gauges' started by lionheart, 26/6/08.

  1. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,634
    Country:
    us-arizona
    Hey guys,

    I am hoping that someone might be able to shed some light on how this is done. What I am trying to do is make a 'drawn Rectangle' appear over the digital font of the active NAV1 and NAV2, and when this is working, over the COM1 and COM2 also.

    But, I cannot seem to see how to have them to appear over each other in the Nav1 and Nav2 active selections.


    Below is the latest one I did yesterday before going borderline luney and moving on to a different set of elements for the sake of staying sane..

    Code:
    <Element>
      <Position X="217" Y="42"/>
        <Visible>(A:NAV1_RADIO_SET, bool)! (>A:NAV1_RADIO_SET, bool)</Visible>
        <Rectangle Width="72" Height="22" LineWidth="2" Color="Blue" Bright="Yes" Fixed="Yes"/>
    </Element>
    
    
    <Element>
      <Position X="217" Y="72"/>
       <Visible>(L:NAV SWAP RECTANGLE, enum) 1 == (>L:NAV SWAP RECTANGLE, enum) 1 == &amp;&amp;</Visible>
       <Rectangle Width="72" Height="22" LineWidth="2" Color="Blue" Bright="Yes" Fixed="Yes"/>
    </Element>
    
    <Element>
      <Position X="217" Y="42"/>
        <Visible>(A:NAV1_RADIO_SET, bool)</Visible>
        <Rectangle Width="72" Height="22" LineWidth="2" Color="Blue" Bright="Yes" Fixed="Yes"/>
    </Element>
    
    
    There were many tries.... Many variants..

    I studied the FSX radios from the CRJ and the Airbus, but they have a different system from the FS9 series. The FSX version has button selections for NAV1, NAV2, COM1, and COM2. No 'switch' buttons to swap between active NAVs and COMs.

    I cant use the FS9 version, as its a GAU from the 737. (My kindergarten cigar box of tools, scissors, glue, etc, doesnt came with GAU software, etc).

    So.... Does anyone know how this might be simply accomplished? I did study someones 'version' of how they did it, and they used custom L Var's. I could not understand it at all and felt perhaps it was none of my business anyways, if you know what I mean. (Trying to use only FS9 and FSX gauges to work with/study from).

    But with their not being a way shown, and one person uses L: custom animations, it tells me this might be more difficult then I thought.

    I had used many versions of the Custom 'EventID's but the rectangles either stayed on or stayed off.

    If you fear to interact on this post, no worries.. I just about had a mass jettisoning of graying eyebrows yesterday over it, and I feared to come back to it actually. But if anyone has some advice, like a carreer change, I would be happy to hear your input.

    :eek:

    Bill

    K-1/Matrix labs/Room 101/front desk in the middle row with Bugatti etched on the side edge...
    Last edited: 26/6/08
  2. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,634
    Country:
    us-arizona
    Now, in going through the EventID's, I happened accross this key; KEY_COM_RADIO_SWAP However, the EventID is unsupported...

    :eek:


    Bill
  3. ronh

    ronh

    Joined:
    2/11/06
    Messages:
    429
    Country:
    canada
    Bill,

    I'll just play here in the sandbox with you ... til one of the big boys comes by.

    Not sure I understand - you want the draw a rectangle over the "active" one?

    Oh well,

    First, why are you trying to set the bool L:var during the visibility test? I would think this would keep flipping back and forth every frame. Don't you want to just read if the NAV is active or not and test.

    Code:
    <Visible>(L:NAV SWAP RECTANGLE, bool)</Visible>
    
    Some other part of the guage code will "set" the L:NAV SWAP RECTANGLE. Perhaps a moose click. Your visibility code returns the value of the L:var. If true then visible - if not the not visible.

    The other thing is the A:NAV1_RADIO_SET is not a bool - is it not a frequency set event? The freq is a bcd number.

    Correct me if I don't understand,

    Code:
    <Visible>(L:NAV SWAP RECTANGLE, enum) 1 == (>L:NAV SWAP RECTANGLE, enum) 1 == &amp;&amp;</Visible>
    
    the way I see this working is

    1. get the L:NAV SWAP RECTANGLE - place on stack => stack:enum value
    2. put 1 on stack => stack:enum value,1
    3. == compare and set top stack to result => stack:result
    4. put back in L:var => stack:?empty? - not sure about this - or is stack: result
    5. put 1 on stack => stack:result,1
    6. == compare and set top of stack to result2 => stack:result2
    7. && and result2 with ????

    I think you need to put another result (duplicate - d) after first evaluation.

    Code:
    <Visible>(L:NAV SWAP RECTANGLE, enum) 1 == d (>L:NAV SWAP RECTANGLE, enum) 1 == &amp;&amp;</Visible>
    
    This way you get result && with result2. Have I got this RPN correct?
    Last edited: 27/6/08
  4. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,634
    Country:
    us-arizona
    Hey Ron,

    Thanks for your input.

    A deeper explanation as to how the rectangles work is this. On the Garmin 900X (and G1000), you have a set of Nav's on the left, and Coms on the right in the top menu bar. A knob on the left top controls inputs to the Navs on the left, and a knob on the right manages the Coms. When you click on the knob (center, push down) you bounce from top to bottom to top of that side of radio. Left side knob, depress, and you swap from Nav1 to Nav2. Thus, the active will have a 'rectangle' around the active Nav. Same with the Com side. That is how you know which Nav or which Com is ready for input, which one is selected for changing.


    Thats how the real world Garmin works. Trying to get it to work in FS is pretty illusive...

    Bill
    LHC
  5. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,468
    Country:
    unitedstates
    Bill, what am I going to do with you? ;)

    This is from my GNS530 script...

    First, the easy part... the mouse code:

    Code:
          <Area Left="25" Right="50" Top="310" Bottom="335">
             <Cursor Type="Hand"/>
             <Tooltip>COM/VLOC Push to Select (%((L:GNS430_1_ComNavTune,enum))%{if}COM%{else}VLOC%{end})</Tooltip>
             <Click>(L:GNS430_1_ComNavTune,enum) 1 (&gt;L:XMLClick,enum) ! (&gt;L:GNS430_1_ComNavTune,enum) 1 (&gt;L:XMLClick,enum)</Click>
          </Area>
    
          <Area Left="53" Right="70" Top="38" Bottom="67">
             <Click>0 (&gt;K:COM_RADIO) 0 (&gt;K:SELECT_1) 0 (&gt;K:FREQUENCY_SWAP)</Click>
             <Tooltip>COM Frequency Swap</Tooltip>
             <Cursor Type="Hand"/>
          </Area>
          <Area Left="53" Right="70" Top="120" Bottom="150">
             <Click>0 (&gt;K:NAV_RADIO) 0 (&gt;K:SELECT_1) 0 (&gt;K:FREQUENCY_SWAP)</Click>
             <Tooltip>NAV Frequency Swap</Tooltip>
             <Cursor Type="Hand"/>
          </Area>
    
    Code:
                <!--COM Select Indicator Window-->
                <Element>
                   <Visible>(L:GNS430_1_ComNavTune,enum)  0 ==</Visible>
                   <Position X="89" Y="118"/>
                   <Rectangle Height="17" Width="61" FillColor="Cyan" Bright="Yes"/>
                </Element>
                <Element>
                   <Visible>(L:GNS430_1_ComNavTune,enum)  1 ==</Visible>
                   <Position X="89" Y="65"/>
                   <Rectangle Height="17" Width="61" FillColor="Cyan" Bright="Yes"/>
                </Element>
    
    Last edited: 27/6/08
  6. ronh

    ronh

    Joined:
    2/11/06
    Messages:
    429
    Country:
    canada
    Fr. Bill,

    I have to ask,

    Code:
    <Click>(L:GNS430_1_ComNavTune,enum) 1 (&gt;L:XMLClick,enum) ! (&gt;L:GNS430_1_ComNavTune,enum) 1 (&gt;L:XMLClick,enum)</Click>
    
    Do I understand this correctly. When the mouse is clicked.

    1. put L:GNS430_1_ComNavTune enum on the stack
    2. put 1 on the stack
    3. put 1 from stack into L:XMLClick
    4. NOT the GNS430_1_ComNavTune enum on the stack
    5. put 1 on the stack
    6. put 1 from stack into L:XMLClick

    I have to be missing something here.:confused: OR is XMLClick some other trigger for something else.

    Just trying to understand RPN.
  7. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,634
    Country:
    us-arizona
    Ron,

    You dont know how complicated it actually is... I have been wrestling with it for days now, lol..

    Fr. Bill, I am going to try this out now. I hope it works. It had me fried yesterday. Just got up at dawn with some idea's, which didnt work either.


    Bill
  8. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,468
    Country:
    unitedstates
    You have accurately stated the actual stack operations of the example as written.

    Actually, I had intended to remove the 1 (>L:XMLClick) from that example, as it's a red herring...

    ...and, although "understanding the stack system" is a worthy goal, it's not really necessary -and in fact can often obfuscate- what is critical for understanding.

    Here is the example as I had intended it:

    Code:
    <Click>(L:GNS430_1_ComNavTune,enum) ! (&gt;L:GNS430_1_ComNavTune,enum)</Click>
    
    Note that having been stripped of the "red herring", this is simply another example of "swapping states of an L:var" as has been posted before. The ! operation simply changes the contents of the L:var from 0 to 1 to 0 to 1 to... ad infinitim.

    The addition of 1 (>L:XMLClick,enum) to the above is used to set a "flag variable" for my XMLSound.gau module, telling it to play a specific sound; in this case, the "click.wav" file. I have to have the same entry on both "sides" of the ! operator so that the "click" will play on every keypress...

    ...Just for the sake of completeness, resetting the state of the (L:XMLClick,enum) variable is handled by the XMLSound.gau as part of its operations.

    ...that's why I called this a "red herring." It has absolutely nothing to do with the primary purpose of the mouse rectangle's operation... :D
    Last edited: 27/6/08
  9. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,468
    Country:
    unitedstates
    Bill, the EventIDs on the left side of the list are the "C code versions." The EventIDs in the center column are the XML equivalents... ;)

    Here is a list of currently active EventIDs:

    Code:
    COM_STBY_RADIO_SWAP.....Swaps COM 1 frequency with standby (note: does not work in FS9!)
    COM2_RADIO_SWAP.........Swaps COM 2 frequency with standby
    NAV1_RADIO_SWAP.........Swaps NAV 1 frequency with standby
    NAV2_RADIO_SWAP.........Swaps NAV 2 frequency with standby
    FREQUENCY_SWAP..........Swaps frequency with standby on whichever NAV or COM radio is selected.
    
    Note that the example I posted above uses the last example. That's why there's script to "set" the COM or NAV, 1 or 2 "active" before issuing the FREQUENCY_SWAP command.
    Last edited: 27/6/08
  10. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,634
    Country:
    us-arizona

    Ahhhhh.. I had thought the left side was for modelling mesh in Gmax, lol.. arrghh. Good to know.

    Thanks for posting the actual running ones concerning this subject.

    Can I ask why you put Zero's ahead of each set of bracketed Parameters? This totally baffled me. I dont think I have seen it yet and was curious what it does.

    <Click>0 (&gt;K:COM_RADIO) 0 (&gt;K:SELECT_1) 0 (&gt;K:FREQUENCY_SWAP)</Click>


    I have been asking so many questions that I am nervous about asking more, but in learning more, I have even more questions. Trying to find the ansers though as much on my own as possible.

    Many thanks for your help. Many thanks..

    Bill
    Last edited: 27/6/08
  11. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,634
    Country:
    us-arizona
    Well drats.. That isnt working either. I must have something mixed up somewhere else in my gauge code because oddly, it either shows up locked on, or does not appear except for a momentary blink and it will blink again in say 20 seconds. Very odd..


    Here is what I tried;

    <Visible>(A:NAV1_RADIO_SWAP, bool)</Visible>

    <Visible>(A:NAV1_RADIO_SWAP, bool) ! (>A:NAV1_RADIO_SWAP, bool)</Visible>

    <Visible>(A:NAV1_RADIO_SWAP, bool) (A:FREQUENCY_SWAP, bool) ! (>A:NAV1_RADIO_SWAP, bool) (>A:FREQUENCY_SWAP, bool)</Visible>


    Also, they seem to effect each other. What I am doing is using 2 Elements, one uses the NAV2_RADIO_SWAP call. When trying the variations with Nav1, the Nav2 would occasionally be on. However, they still do not turn off, but rather stay on.

    Reminds me of that danged blue and white checkered button in Gmax that hid my textures for ages....


    Bill
  12. ronh

    ronh

    Joined:
    2/11/06
    Messages:
    429
    Country:
    canada
    Fr. Bill,

    This is what I gathered. I had to ask to ensure that I understood what was happening ... hence my comment on triggering something else. Really do appreciate the response.
  13. ronh

    ronh

    Joined:
    2/11/06
    Messages:
    429
    Country:
    canada
    Lion Bill,:D

    Try this. This code is run for every frame (ie. as in framerate) to check visibility.

    Element Code for COM1 and COM2 - note in COM2 the different Y also change to 1 == - important - see explanation below. All you want to do here is read whether you should show the rectangle or not.

    Code:
    <Element>
      <Position X="217" Y="72"/>
       <Visible>(L:NAV SWAP RECTANGLE, enum) 0 ==</Visible>
       <Rectangle Width="72" Height="22" LineWidth="2" Color="Blue" Bright="Yes" Fixed="Yes"/>
    </Element>
    
    <Element>
      <Position X="217" Y="172"/>
       <Visible>(L:NAV SWAP RECTANGLE, enum) 1 ==</Visible>
       <Rectangle Width="72" Height="22" LineWidth="2" Color="Blue" Bright="Yes" Fixed="Yes"/>
    </Element>
    
    
    Add in the mouse code as in Fr. Bills example to actually "set" which COM (or NAV is active).

    Mouse code. Need a similar one for NAV1 NAV2 swap. The code below says when the mouse is clicked L:NAV SWAP RECTANGLE is retrieved (say it's 0 to represent COM1) - This value is NOTTED, meaning it flips from 0 to 1 and then you put it back into the L:NAV SWAP RECTANGLE variable as 1. The next frame is posted to the video screen and the element code is run, this time the L:NAV SWAP RECTANGLE is 1. The COM1 element code looks for 0 == so COM1 rect is NOT visible. The COM2 element code looks for 1 == yes it is equal so COM2 rectangle is visible.

    Every frame remains like this til you press the mouse on the button and L:NAV SWAP RECTANGLE flips from 1 back to 0 and COM1 has the rectangle.

    Code:
          <Area Left="25" Right="50" Top="310" Bottom="335">
             <Cursor Type="Hand"/>
             <Tooltip>COM1/COM2 Push to Select (%((L:NAV SWAP RECTANGLE,enum))%{if}COM2%{else}COM1%{end})</Tooltip>
             <Click>(L:NAV SWAP RECTANGLE,enum) ! (&gt;L:NAV SWAP RECTANGLE,enum)</Click>
          </Area>
    
    Fr. Bill's example with FREQ_SWAP is not what I think you want - that code SWAPS STANDBY FREQ with Active FREQ. You want COM1 COM2 swaping.
  14. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,634
    Country:
    us-arizona
    Hey Ron,

    Many thanks sir.

    It is confusing.. Swapping these or those. Wish it wasnt such a pain to get to work. I had tried to do this earlier on in the project and never got it to work. On doing a test flight 3 days ago, I realised how they were indeed needed, so I thought, well.. should only take about 15 min's max to do them, (especially now that I have learned so much on gauge code).. nope.. almost 4 days later.. still not working, lol.. arrghh.


    Bill
  15. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,468
    Country:
    unitedstates
    Oh, Jesu, Maria et Giuseppe! :eek:

    Bill, everything listed in EventID is a K:event (command)... You cannot use a K:event type in <Visible>...

    K:event are only used in <Click> events... :D

    The same thing holds true for the ! (not) operator. It makes no sense in a <Visible> tag. It is only used in "action scripts" such as conditional <Code> or <Click> events.
  16. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,468
    Country:
    unitedstates
    Bill, that's there to "force" the K:event to fire...
    ...don't ask me why it won't work without the zero,
    'cause I don't know! :yikes:

    What this "command sequence" does is this:

    1. Work with COM_RADIO(s)
    2. SELECT_1 = I wanna work with COM1
    3. FREQUENCY_SWAP = Swap COM1 and COM1_Standby freqs.

    Now a reasonable person might ask, why didn't you simply use K:COM_RADIO_SWAP? After all, that K:event works in FSX!

    Remember the FS9 SDK entry which states "unsupported?" That's why! :eek:

    Since I deliberately write XML that will work seamless in both FS9 and FSX, I chose to use the above "command script" for everything, just to keep everything similar.

    Code:
    // Swap COM1 Active/Standby Freqs
    <Click>0 (&gt;K:COM_RADIO) 0 (&gt;K:SELECT_1) 0 (&gt;K:FREQUENCY_SWAP)</Click>
    
    // Swap COM2 Active/Standby Freqs
    <Click>0 (&gt;K:COM_RADIO) 0 (&gt;K:SELECT_2) 0 (&gt;K:FREQUENCY_SWAP)</Click>
    
    // Swap NAV1 Active/Standby Freqs
    <Click>0 (&gt;K:NAV_RADIO) 0 (&gt;K:SELECT_1) 0 (&gt;K:FREQUENCY_SWAP)</Click>
    
    // Swap NAV2 Active/Standby Freqs
    <Click>0 (&gt;K:NAV_RADIO) 0 (&gt;K:SELECT_2) 0 (&gt;K:FREQUENCY_SWAP)</Click>
    
    Last edited: 27/6/08
  17. taguilo

    taguilo Resource contributor

    Joined:
    20/10/06
    Messages:
    1,052
    Country:
    argentina
    I'll give a little help :) = since FS9 it works without a 0 or even without any number, just

    (&gt;K:COM_RADIO) (&gt;K:SELECT_1) (&gt;K:FREQUENCY_SWAP)

    Those events that perform an action don't need a value assigned to execute, but there are others that actually need some data to be *passed* to them , for example those ending in _SET. I guess more details now would be too much ;)

    Tom
  18. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,468
    Country:
    unitedstates
    Bill, this might help you understand some of the above more clearly. Note that this is not complete, working code!

    I've only included the 'logic' and the actual <Click> events. This shows how I could use the same "knob" to either tune COM1 or COM2, depending on the value of (L:ComTune,bool).

    Code:
    // Swap COM1 Active/Standby Freqs
    <Click>0 (&gt;K:COM_RADIO) 0 (&gt;K:SELECT_1) 0 (&gt;K:FREQUENCY_SWAP)</Click>
    
    // Swap COM2 Active/Standby Freqs
    <Click>0 (&gt;K:COM_RADIO) 0 (&gt;K:SELECT_2) 0 (&gt;K:FREQUENCY_SWAP)</Click>
    
    // Swap NAV1 Active/Standby Freqs
    <Click>0 (&gt;K:NAV_RADIO) 0 (&gt;K:SELECT_1) 0 (&gt;K:FREQUENCY_SWAP)</Click>
    
    // Swap NAV2 Active/Standby Freqs
    <Click>0 (&gt;K:NAV_RADIO) 0 (&gt;K:SELECT_2) 0 (&gt;K:FREQUENCY_SWAP)</Click>
    
    // Select COM1 or COM2 Tuning
    <Click>(L:ComTune,bool) ! (>L:ComTune,bool)<click>
    
    // Tune COM1 or COM2
    <Click>
    	(L:ComTune,bool) 0 ==
    	if{
    		<Click Repeat="Yes">0 (&gt;K:COM_RADIO_WHOLE_INC)</Click>
    
    		<Click Repeat="Yes">0 (&gt;K:COM_RADIO_WHOLE_DEC)</Click>
    
    		<Click Repeat="Yes">0 (&gt;K:COM_RADIO_FRACT_INC)</Click>	
    
    		<Click Repeat="Yes">0 (&gt;K:COM_RADIO_FRACT_DEC)</Click>
    	 }
    	els {
    		<Click Repeat="Yes">0 (&gt;K:COM_STBY_RADIO_WHOLE_INCREASE)</Click>
    
    		<Click Repeat="Yes">0 (&gt;K:COM_STBY_RADIO_WHOLE_DECREASE)</Click>
    
    		<Click Repeat="Yes">0 (&gt;K:COM_STBY_RADIO_FRACT_INCREASE)</Click>
    
    		<Click Repeat="Yes">0 (&gt;K:COM_STBY_RADIO_FRACT_DECREASE)</Click>
    	     }
    
    
  19. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,634
    Country:
    us-arizona
    Well.. Its the end of the day, day 4 on this subject, and no progress, except that I can get 'one' rectangle to show up. I also temporarily had one up that would switch to the bottom, but not return up when the Radios were swapped back.

    I have put all your awesome input and advice and figures in there, so I feel its something in my gauge that is jamming the works. I'll find it though.

    Now that I see how Enum works with 0 == and 1 ==, etc, I think its really helped in my knowledge of multiple pop-ups. But in this case, 'nothing' worked. And thats ok.. Keeps me strong, a test on my eyebrows endurance, and blood pressure, lol..

    Awesome to have learned so much. I must have tried so many different variations that it worked for me on memorizing and being able to write raw code over and over. Good workout that way.

    Some of the last routes I tried was to entermix my own L:code into the Mouse button zone. Examples;

    (M:Event)(A:COM SWAP, enum) 0 == ! (A:COM SWAP, enum) 1 ==
    (M:Event)(L:COM SWAP, enum) 0 == ! (L:COM SWAP, enum) 1 ==
    (M:Event)(K: ......
    (M:Event)(L:SWAP COM SYSTEM)
    (M:Event)(L:SWAP COM SYSTEM, bool)
    (M:Event)(L:SWAP COM SYSTEM, enum) 0== (L:SWAP COM SYSTEM, enum) 1 ==
    etc, etc, etc.

    The Elements side were typical basic Rectangle renders such as;

    <Visible>(A:COM SWAP, enum) 0 ==</Visible>
    etc..

    I also tried a little custom tries too, just to see if the system thinks like me, lol.. such as...

    <Visible> (>A:COM SWAP, bool)! </Visible>
    <Visible> !(A:COM SWAP, enum) 0 ==</Visible
    <Visible> (A:COM SWAP, enum) 0 == ! (A:COM SWAP, enum) 1== </Visible>

    etc, etc....


    So, it was a hard days work for 4 days.. Earned my glass(es) of wine! Tomorrow morning, I will gently rub in some Grecian 44 hair anti graying into my eyebrows and doctor them. Poor dudes endured.. Strong chappies.... :D

    Thanks guys for your help on and input. Very thankful.


    Bill
    LHC
  20. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,468
    Country:
    unitedstates
    Good point, Tom. I forgot that the original gauge that XML script was written was... FS2002... :rolleyes:

Share This Page