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

FSXA 3D Fixed card ADF

mskhan1991

Resource contributor
Messages
935
Country
pakistan
I would like to know how to work with that, I am creating a fix card ADF and would like the card to move using the knob.
 
Just use the modified kohsmann knob code.
Remove the k:vars from that code.

Add the code to both the disk and the knob, or you can make a new code and tag the disk with that.
Both ways work, but to keep the modeldef to the minimal just apply code to both objects.
 
Last edited:
it also causes my altimeter and kollsman disc to be affected and won't work properly ... can't turn westward using this code:

Code:
   <PartInfo>
    <Name>MFI_ADF_CARD_KNOB</Name>
    <AnimLength>360</AnimLength>
    <Animation>
       <Parameter>
        <Code>
         (L:Kohlsman Knob co,enum)
        </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
        <MouseRect>
        <Cursor>Hand</Cursor>
        <TooltipText>ADF card knob</TooltipText>
           <MouseFlags>WheelUp+WheelDown</MouseFlags>
        <CallbackCode>
            (M:Event) 'WheelDown' scmp 0 ==
                if{
                    (L:Kohlsman Knob co, enum) -- 0 % (>L:Kohlsman Knob co, enum)
                     }
                    1 (>L:rotary_click,bool)
            (M:Event) 'WheelUp' scmp 0 ==
                if{
                    (L:Kohlsman Knob co, enum) ++ 100 % (>L:Kohlsman Knob co, enum)
                     }
                    1 (>L:rotary_click,bool)
        </CallbackCode>
    </MouseRect>

   </PartInfo>
 
Of course it will interfere with your kohlsman knop since you don't have altered the L:var. (using L:Kohlsman Knob co in both codes)

Make a new L:var, something that makes sense e.g L:ADF disk, enum

You can also just drop the 1 (>L:rotary_click,bool) because that is something I've been using to trigger Doug's sound gauge.
 
I am sorry I didn't understand, how do you exactly call new variables? The ones you make yourself?
 
No problem.
You can name the variable anything you want! Most important is that you name it something that makes sense to YOU :)

This code will work just good for you.

Code:
<PartInfo>
    <Name>MIP_ADF_DISK</Name>
    <AnimLength>360</AnimLength>
    <Animation>
      <Parameter>
        <Code>
         (L:Adf Disk, enum)
         </Code>
      </Parameter>
    </Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>ADF card knob</TooltipText>
<MouseFlags>WheelUp+WheelDown</MouseFlags>
<CallbackCode>
(M:Event) 'WheelDown' scmp 0 ==
if{ (L:Adf Disk, enum) -- 0 % (>L:Adf Disk, enum) }

(M:Event) 'WheelUp' scmp 0 ==
if{ (L:Adf Disk, enum) ++ 100 % (>L:Adf Disk, enum) }
</CallbackCode>
</MouseRect>
  </PartInfo>

As you can see, all that has changed is the variable names.

So when you tag the disk with this code the animation is controlled with :
Code:
    <Animation>
      <Parameter>
        <Code>
         (L:Adf Disk, enum)
         </Code>
      </Parameter>
    </Animation>

And the knob also need interaction with the mouse.
That is where the last part of the code comes in hand.
Code:
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>ADF card knob</TooltipText>
<MouseFlags>WheelUp+WheelDown</MouseFlags>
<CallbackCode>
(M:Event) 'WheelDown' scmp 0 ==
if{
(L:Adf Disk, enum) -- 0 % (>L:Adf Disk, enum)
}

(M:Event) 'WheelUp' scmp 0 ==
if{
(L:Adf Disk, enum) ++ 100 % (>L:Adf Disk, enum)
}
</CallbackCode>
</MouseRect>

So basically two parts using the same code.

If you where to make a ADF for the co-pilot side and wanted that to be independent of the captain side... then you would just use the same code and make some changes to the variable.. (L:Adf Disk CO, enum) e.g
 
oh how stupid of me, Just needed to rename the variable! thanks, makes some sense now.
 
I am running into a problem with this 0% and 100%.....

Mouse wheel up works flawlessly but when I use mouse wheel down, it quickly jumps back to frame 0 and doesn't move from that position, any ideas?

Code:
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>ADF card knob</TooltipText>
<MouseFlags>WheelUp+WheelDown</MouseFlags>
<CallbackCode>
(M:Event) 'WheelDown' scmp 0 ==
if{
(L:Adf Disk, enum) -- 0 % (>L:Adf Disk, enum)
}

(M:Event) 'WheelUp' scmp 0 ==
if{
(L:Adf Disk, enum) ++ 100 % (>L:Adf Disk, enum)
}
</CallbackCode>
</MouseRect>
 
This codes after removing a few things works a little but only between the keyframes.... so it doesn't rotate beyond 360 like it should!

But it works better than 0 % and 100 % code..... because that would result in my disc jumping back to frame 0 with wheel down although wheel up had no problem.

Code:
 <MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>ADF card knob</TooltipText>
<MouseFlags>WheelUp+WheelDown</MouseFlags>
<CallbackCode>
(M:Event) 'WheelDown' scmp 0 ==
if{ (L:Adf Disk, enum) -- (>L:Adf Disk, enum) }

(M:Event) 'WheelUp' scmp 0 ==
if{ (L:Adf Disk, enum) ++ (>L:Adf Disk, enum) }
</CallbackCode>
</MouseRect>
  </PartInfo>


</ModelInfo>
 
Add this snip to your callback code then.

Code:
(L:L:Adf Disk, enum) 0 &lt; if{ 100 (>L:Adf Disk, enum) }
(L:Adf Disk, enum) 100 &gt; if{ 0 (>L:Adf Disk, enum) }

That way you force it to return to 0 when it reaches more then 100, and to 100 when it reaches less then 0.
 
Since he's using 360 frames, the complete script should be:
Code:
<MouseRect>
  <Cursor>Hand</Cursor>
  <TooltipText>ADF card knob</TooltipText>
  <MouseFlags>WheelUp+WheelDown</MouseFlags>
  <CallbackCode>
    (M:Event) 'WheelDown' scmp 0 ==
    if{ (L:Adf Disk, enum) -- (>L:Adf Disk, enum) }
 
    (M:Event) 'WheelUp' scmp 0 ==
    if{ (L:Adf Disk, enum) ++ (>L:Adf Disk, enum) }
 
    (L:Adf Disk, enum) 0 &lt; if{ 360 (>L:Adf Disk, enum) }
    (L:Adf Disk, enum) 360 &gt; if{ 0 (>L:Adf Disk, enum) }
  </CallbackCode>
</MouseRect>
 
Back
Top