• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

VHF/NAV Frequency set

Messages
36
Country
yugoslavia
Hello!
I'm trying to set VHF frequency using three local variables on click event. For example:
<Click Kind="LeftSingle">

4 (>L:NAV1,enum)
0 (>L:NAV2,enum)
5 (>L:NAV3,enum)

(L:NAV1,enum) (L:NAV2,enum) (L:NAV3,enum) (>L:NAV_Freq, khz)
(L:NAV_Freq, khz) (>K:NAV1_RADIO_SET)

</Click>

I want to use L:NAV1,enum,L:NAV2,enum,L:NAV3,enum as arguments to set NAV1 Frequency using (>K:NAV1_RADIO_SET)
I know that underline part of code is problem, any idea how to solve it?
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Hi,

First obtain a valid (L:NAV_Freq, Mhz) - How do you plan to do that using (L:NAV1,enum), (L:NAV2,enum) and (L:NAV3,enum) ? -

Then simply write (L:NAV_Freq,Frequency BCD16) (>K:NAV2_RADIO_SET)

Tom
 
Messages
36
Country
yugoslavia
Thank you for fast response taguilo.
I give 405 for example but as you said it's not good example, I agree.
I want to create 3D cylinders with numbers for setting NAV1 (active frequency) because I don't have NAV2. Here is a picture of panel which I want to create:
VHF_zpsgnwlhv4y.jpg

So all 6 cylinders have 10 positions (from 0 to 9) I have to convert those positions to your "L:NAV_Freq,Frequency" variable, how?
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Actually I believe you have 4 drums, two for the integer part (first digit is always 1) , one for the hundreths (0 to 9) and the last one for the carry (00, 25,50,75 ).

Then you can use, for example (L:NAV1_n,enum) being n 2 to 5 matching the proper drum and finally concatenate the four LVars to form the frequency:

Code:
100 (L:NAV1_2,enum) 10 * + (L:NAV1_3,enum) + (L:NAV1_4,enum) 10 / + (L:NAV1_5,enum) 100 / + (>L:NAV_Freq, Mhz)
(L:NAV_Freq,Frequency BCD16) (>K:NAV2_RADIO_SET)

Tom
 
Messages
36
Country
yugoslavia
Thank you!
But why you always use NAV2_RADIO_SET insted NAV1_RADIO_SET ? I have just active frequency...
 
Messages
36
Country
yugoslavia
Here:
Maybe it's going to be useful for someone...
3D Parts for modeldef.xml VHF station.

primer_zpsawdouvbd.jpg


Code:
<Animation name="gazelle_navpower" guid="" length="150" type="Sim" typeParam2="gazelle_navpower" typeParam="AutoPlay"/>

<PartInfo>
<Name>gazelle_navpower</Name>
<AnimLength>150</AnimLength>
<Animation>
<Parameter>
<Code>
(L:NAVOffOn,enum) 50 *
</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Turn NAV Off/On/Squelch/Test</TooltipText>
<CallbackCode>
(L:NAVOffOn,enum) ++ 4 % (>L:NAVOffOn,enum)
</CallbackCode>
</MouseRect>
</PartInfo>

<Animation name="gazelle_navstep" guid="" length="50" type="Sim" typeParam2="gazelle_navstep" typeParam="AutoPlay"/>

<PartInfo>
<Name>gazelle_navstep</Name>
<AnimLength>50</AnimLength>
<Animation>
<Parameter>
<Code>
(L:NAVStep,enum) 50 *
</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>NAV frequency step 25/50 KHz</TooltipText>
<CallbackCode>
(L:NAVStep,enum) ++ 2 % (>L:NAVStep,enum)
</CallbackCode>
</MouseRect>
</PartInfo>


<Animation name="gazelle_navkhz" guid="" length="100" type="Sim" typeParam2="gazelle_navkhz" typeParam="AutoPlay"/>

<PartInfo>
<Name>gazelle_navkhz</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>(L:NAVkhz,enum)</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Increments/Decrements NAV frequency by 25/50 KHz</TooltipText>
<MouseFlags>LeftSingle+LeftRelease+RightSingle+RightRelease</MouseFlags>
<CallbackCode>
       (M:Event) 'LeftSingle' scmp 0 == if{ (L:NAVStep) 0 == if{ (L:NAVkhz,enum) 25 + 100 % (>L:NAVkhz,enum) }
                                            (L:NAVStep) 1 == if{ (L:NAVkhz,enum) 50 + 100 % (>L:NAVkhz,enum) }
                                          
                                            (L:NAVkhz,enum) (&gt;L:NAV1_5,enum)
                                          
                                            (L:NAVkhz,enum) 0 == if{ (L:NAV1_4,enum) 1 + 10 % (>L:NAV1_4,enum) }
                                          
                                            100 (L:NAV1_2,enum) 10 * + (L:NAV1_3,enum) + (L:NAV1_4,enum) 10 / + (L:NAV1_5,enum) 100 / + (>L:NAV_Freq, Mhz)
                                            (L:NAV_Freq,Frequency BCD16) (>K:NAV1_RADIO_SET)
                                          
                                            }
                                          
       (M:Event) 'RightSingle' scmp 0 == if{ (L:NAVStep) 0 == (L:NAVkhz,enum) 0 &gt; and if{ (L:NAVkhz,enum) 25 - (>L:NAVkhz,enum) }
                                             (L:NAVStep) 1 == (L:NAVkhz,enum) 0 &gt; and if{ (L:NAVkhz,enum) 50 - (>L:NAVkhz,enum) }
                                           
                                             (L:NAVkhz,enum) (&gt;L:NAV1_5,enum)
                                           
                                             100 (L:NAV1_2,enum) 10 * + (L:NAV1_3,enum) + (L:NAV1_4,enum) 10 / + (L:NAV1_5,enum) 100 / + (>L:NAV_Freq, Mhz)
                                            (L:NAV_Freq,Frequency BCD16) (>K:NAV1_RADIO_SET)
                                          
                                            }
</CallbackCode>
</MouseRect>
</PartInfo>

<Animation name="gazelle_navmhz" guid="" length="450" type="Sim" typeParam2="gazelle_navmhz" typeParam="AutoPlay"/>

<PartInfo>
<Name>gazelle_navmhz</Name>
<AnimLength>450</AnimLength>
<Animation>
<Parameter>
<Code>(L:NAVmhz,enum) 50 *</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Increments/Decrements NAV frequency by 1 MHz</TooltipText>
<MouseFlags>LeftSingle+LeftRelease+RightSingle+RightRelease</MouseFlags>
<CallbackCode>
       (M:Event) 'LeftSingle' scmp 0 == if{ (L:NAVmhz,enum) 1 + 10 % (>L:NAVmhz,enum)
     
                                            (L:NAVmhz,enum) (&gt;L:NAV1_3,enum)
                                          
                                            (L:NAVmhz,enum) 0 == if{ (L:NAV1_2,enum) 1 + 10 % (>L:NAV1_2,enum) }
                                          
                                            100 (L:NAV1_2,enum) 10 * + (L:NAV1_3,enum) + (L:NAV1_4,enum) 10 / + (L:NAV1_5,enum) 100 / + (>L:NAV_Freq, Mhz)
                                            (L:NAV_Freq,Frequency BCD16) (>K:NAV1_RADIO_SET)
                                         }
                                          
       (M:Event) 'RightSingle' scmp 0 == if{ (L:NAVmhz,enum) 0 &gt; if{ (L:NAVmhz,enum) -- (>L:NAVmhz,enum) }
                                           
                                             (L:NAVmhz,enum) (&gt;L:NAV1_3,enum)
                                           
                                             100 (L:NAV1_2,enum) 10 * + (L:NAV1_3,enum) + (L:NAV1_4,enum) 10 / + (L:NAV1_5,enum) 100 / + (>L:NAV_Freq, Mhz)
                                            (L:NAV_Freq,Frequency BCD16) (>K:NAV1_RADIO_SET)
                                          
                                            }
</CallbackCode>
</MouseRect>
</PartInfo>

<Animation name="gazelle_cyl5" guid="" length="100" type="Sim" typeParam2="gazelle_cyl5" typeParam="AutoPlay"/>

<PartInfo>
<Name>gazelle_cyl5</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>(L:NAV1_5,enum)</Code>
</Parameter>
</Animation>
</PartInfo>

<Animation name="gazelle_cyl4" guid="" length="450" type="Sim" typeParam2="gazelle_cyl4" typeParam="AutoPlay"/>

<PartInfo>
<Name>gazelle_cyl4</Name>
<AnimLength>450</AnimLength>
<Animation>
<Parameter>
<Code>(L:NAV1_4,enum) 50 *</Code>
</Parameter>
</Animation>
</PartInfo>

<Animation name="gazelle_cyl3" guid="" length="450" type="Sim" typeParam2="gazelle_cyl3" typeParam="AutoPlay"/>

<PartInfo>
<Name>gazelle_cyl3</Name>
<AnimLength>450</AnimLength>
<Animation>
<Parameter>
<Code>(L:NAV1_3,enum) 50 *</Code>
</Parameter>
</Animation>
</PartInfo>

<Animation name="gazelle_cyl2" guid="" length="450" type="Sim" typeParam2="gazelle_cyl2" typeParam="AutoPlay"/>

<PartInfo>
<Name>gazelle_cyl2</Name>
<AnimLength>450</AnimLength>
<Animation>
<Parameter>
<Code>(L:NAV1_2,enum) 50 *</Code>
</Parameter>
</Animation>
</PartInfo>
 
Messages
1,407
Country
mexico
Hello Milos

Great coding my friend! Perhaps that "someone" could be me! ;)

Cheers,
Sergio.
 
Messages
36
Country
yugoslavia
Hi Sergio.
Be careful, there is a little mistake in upper code. I notice that but forgot to repost.
In all code you should replace:
Code:
(L:NAV1_5,enum) 100 /
with:
Code:
(L:NAV1_5,enum) 1000 /
 
Messages
1,407
Country
mexico
Hello Milos

Now I know what we were talking about... I couldn't recall this in that moment
And yes! I am that "Sergio":rotfl: :rotfl: :rotfl:

Quite apart from this personal joke, thanks for the head up!

Take care my friend,
Sergio.
:wave:
 
Top