• 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.

FS2004 Animated Frequency Knobs

Messages
1,749
Country
unitedstates
I was wondering if someone could help me understand why
some parts will animate and other just do the function.

Heres what I need. I need a animated Knob for the
comm1 radio frequency.

I made 2 codes that work and don't work.

The first code just animates the knob wrong.
I used 100 frames, 0 50 and 100. It just moves
slightly right then returns.

The other code I made just lets the mouse wheel
change the frequency. Drag will work too.

I need it to click left and right. Hopefully animate too.

Here is the working code with no animation or click.


<part>
<name>Fract_Com2_Radio</name>
<animation>
<parameter>
<sim>
<variable>COM TRANSMIT:2</variable>
<units>bool</units>
<scale>50</scale>
</sim>
<lag>400</lag>
</parameter>
</animation>
<mouserect>
<cursor>Hand</cursor>
<help_id>HELPID_RADIO_COMM1_FREQ</help_id>
<tooltip_id>TOOLTIPTEXT_COMM2_FREQ</tooltip_id>
<mouse_flags>LeftSingle+RightSingle+LeftRelease+Wheel</mouse_flags>
<callback_jump_dragging>
<Xmovement>
<delta>3</delta>
<event_id_inc>COM2_RADIO_FRACT_INC</event_id_inc>
<event_id_dec>COM2_RADIO_FRACT_DEC</event_id_dec>
</Xmovement>
</callback_jump_dragging>
</mouserect>
</part>


Thanks Delivery Guy,
 
Your chief problem is that you are trying to animate a knob with a comm frequency. That will never work.

Understand that what you send to the sim has to translated into "keyframes..."

In this case, you need to send a value from 0 to 100 (or however you've keyframed your knob).

Code:
<part>
  <name>Fract_Com2_Radio</name>
  <animation>
    <parameter>
      <code>
        (L:Com2FracTuneKnob,enum)
      </code>
      <lag>400</lag>
    </parameter>
  </animation>
  <mouserect>
    <cursor>Hand</cursor>
    <tooltip_id>TOOLTIPTEXT_COMM2_FREQ</tooltip_id>
    <mouse_flags>LeftSingle+RightSingle+Wheel+Repeat</mouse_flags>
    <callback_code>
      <!-- RESET VARIABLE TO ALLOW FOR CONTINUOUS TURNS -->
      (L:Com2FracTuneKnob, enum) 50 == if{ 0 (>L:Com2FracTuneKnob, enum)
      (L:Com2FracTuneKnob, enum) 0 == if{ 50 (>L:Com2FracTuneKnob, enum)
      
      <!-- Left/Right Clicks or Mouse Wheel will inc/dec in steps of 1, from 0 to 50 -->
      (M:Event) 'RightSingle' scmp 0 ==
      if{ (L:Com2FracTuneKnob, enum) -- 0 max (>L:Com2FracTuneKnob, enum) (>K:COM2_RADIO_FRACT_DEC) }
      (M:Event) 'LeftSingle' scmp 0 ==
      if{ (L:Com2FracTuneKnob, enum) ++  50 min (>L:Com2FracTuneKnob, enum) (>K:COM2_RADIO_FRACT_INC) }
      (M:Event) 'WheelUp' scmp 0 ==
      if{ (L:Com2FracTuneKnob, enum) -- 0 max (>L:Com2FracTuneKnob, enum) (>K:COM2_RADIO_FRACT_DEC) }
      (M:Event) 'WheelDown' scmp 0 ==
      if{ (L:Com2FracTuneKnob, enum) ++  50 min (>L:Com2FracTuneKnob, enum) (>K:COM2_RADIO_FRACT_INC) }
    </callback_code>
  </mouserect>
</part>
 
Amazing

Hi N4gix,

I figured that the standard codes only work on common
default parts. I was thinking yesterday that I need a code
that will tell the animation to move in sequece. So it will turn
like real life. I saw your code and I am about to test it.
I can tell you added a real life animation (sequence).

You quoted: That will never work.

Will this type of code work?

I tested it and nothing happens!!!

Sincerely DG,
 
Last edited:
How did you keyframe animate the part?

Did you name the part "Fract_Com2_Radio"? (without the quotes of course).

This code came directly from my custom MakeMDL.parts.xml file, so I know it works... :D
 
update

yes,

Fract_Com2_Radio

I used animation 0 to 50 too.

what do you mean by keyframe the part. 0 to 50?

Any ideas!
 
Last edited:
what do you mean by keyframe the part. 0 to 50?

Any ideas!

In Max/GMax/FSDS (or whatever program!) you must place an animation key at frame 0, then rotate the part clockwise and set the final key at frame 50.

Then add at least one key at frame 25.
 
keyframes

I did use 0 to 50, but do i need a 25?

So I am lost?

I will try 0 25 and 50 for keframes today.



Sincerely DG,

Update: I have the freq switches able to click now using another type of code.
No animation, but this works fine. thanks for the help.
 
Last edited:
3 way switch

Update: I have the freq switches able to click now using another type of code.
No animation, but this works fine.

it also plays a sound.

<part>
<name>XPNDR_A</name>
<animation>
<parameter>
<code>(L:Var1,bool)</code>
<lag>200</lag>
</parameter>
</animation>
<mouserect>
<cursor>Hand</cursor>
<tooltip_text>TRANSPONDER_1000</tooltip_text>
<mouse_flags>LeftSingle+RightSingle+Wheel</mouse_flags>
<callback_code>
(L:Var1,bool) ! (&gt;L:Var1,bool) ! (&gt;L:Var1,bool) 0 (&gt;K:XPNDR_1000_INC,bool)

(&gt;K:SMOKE_ON,bool) (&gt;K:SMOKE_OFF,bool)
</callback_code>
</mouserect>
</part>



can we add animation to this?

thanks for the help.
 
Last edited:
Working

How did you keyframe animate the part?

Did you name the part "Fract_Com2_Radio"? (without the quotes of course).

This code came directly from my custom MakeMDL.parts.xml file, so I know it works... :D

Thanks N4Gix,

I managed to get the code to work. I had to move the upper code
for looping, mixed into the code below. Also it works with 0 to 50
and 0, 25 and 50. So doesn't matter which one.


Any reason I had to do this. The first thing i did is try the code without
the loop and it worked.

Anyways it works 100% and i wanted to say thanks.

DG,
 
Back
Top