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

Set knob to start at certain position in sim

Messages
72
Country
canada
Hi,

I made an animation for a knob that has positions 1,2,3,4,5. In MCX I have it animated starting from the left (1) to the right (2). When I open it in sim, naturally the knob points to the far left (position 1). How can I code the animation to have in start in the center (position 3)?

Thanks
 
Messages
10,052
Country
us-arizona
I had a cool system for this for all my knobs and systems in a jet I did a couple of years back. I had a 'Systems_Sync' XML gauge that set up the planes knobs and systems when you booted up into a flight.

<Element> <Select> <Value> (L:Has_Initialized, bool) ! if{ (A:CIRCUIT HYDRAULIC PUMP ON,bool) 1 == if{ 1 (&gt;L:LJ24 HYDRAULIC PUMP, bool) } (A:ELECTRICAL MASTER BATTERY,bool) 1 == if{ 1 (&gt;L:LJ24B BATT MASTER LEFT, bool) 1 (&gt;L:LJ24B BATT MASTER RIGHT, bool) } 25 (&gt;L:EMER_POWER_SELECT_POS,number) 25 (&gt;L:GEAR_TEST_SELECT_POS,number) 25 (&gt;L:CABIN_UPDOWN_SELECT_POS,number) 25 (&gt;L:LEARJET FILL TRANSFER SW,number) 1 (&gt;L:LEARJET AUX HEAT SW,enum) 1 (&gt;L:LEARJET EMER POWER SW,enum) 5 (&gt;L:TANKSELECTION,enum) 1 (&gt;L:LEARJET LEFT RIGHT SWITCH,bool) 25 (&gt;L:LEARJET FAN COOL SW_POS,number) (A:GENERAL ENG GENERATOR SWITCH:1, bool) 1 == if{ 50 (>L:LEFT_GEN_SELECT_POS,number) } els{ 25 (>L:LEFT_GEN_SELECT_POS,number) } (A:GENERAL ENG GENERATOR SWITCH:2, bool) 1 == if{ 50 (>L:RIGHT_GEN_SELECT_POS,number) } els{ 25 (>L:RIGHT_GEN_SELECT_POS,number) } (A:GENERAL ENG FUEL VALVE:1,bool) 1 == if{ 1 (>L:LH_JetPump Switch,bool) } (A:GENERAL ENG FUEL VALVE:1,bool) 0 == if{ 0 (>L:LH_JetPump Switch,bool) } (A:GENERAL ENG FUEL VALVE:2,bool) 1 == if{ 1 (>L:RH_JetPump Switch,bool) } (A:GENERAL ENG FUEL VALVE:2,bool) 0 == if{ 0 (>L:RH_JetPump Switch,bool) } 1 (&gt;L:LJ24B YAW DISENGAGE SWITCH, bool) 1 (&gt;L:Has_initialized, bool) } </Value> </Select> </Element>
 

tgibson

Resource contributor
Messages
10,716
Country
us-california
The important parts of that code are the two Has_Initialized lines, and the lines above and below those. Place your own initialization code between them.
 
Messages
72
Country
canada
So this is my code:

<PartInfo>
<Name>knob_weather_radar_tilt</Name>
<AnimLength>70</AnimLength>
<Animation>
<Parameter>
<Code>
(L:weather_radar_tilt,number) 10 *
</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Weather Radar Tilt Knob</TooltipText>
<MouseFlags>WheelDown+WheelUp+DownRepeat+LeftSingle+MiddleSingle+RightSingle</MouseFlags>
<CallbackCode>
(M:Event) 'LeftSingle' scmp 0 == if{ (L:weather_radar_tilt, number) -- -3 max (&gt;L:weather_radar_tilt, number) }
(M:Event) 'RightSingle' scmp 0 == if{ (L:weather_radar_tilt, number) ++ 3 min (&gt;L:weather_radar_tilt, number) }

(M:Event) 'WheelDown' scmp 0 == if{ (L:weather_radar_tilt, number) -- -3 max (&gt;L:weather_radar_tilt, number) }
(M:Event) 'WheelUp' scmp 0 == if{ (L:weather_radar_tilt, number) ++ 3 min (&gt;L:weather_radar_tilt, number) }
</CallbackCode>
</MouseRect>
</PartInfo>

How do I get the knob to start in the position of keyframe 30 for example in MCX. So -3 clicks from center (30) goes to one end, then +3 clicks goes to the other end of the knob
 

tgibson

Resource contributor
Messages
10,716
Country
us-california
The way I would do it is to use an invisible 2D initialization gauge listed in the VCockpit section of the panel.cfg file that sets the value of (L:weather_radar_tilt,number) to 30 (see the examples above).
 
Messages
936
Country
australia
Code:
(L:weather_radar_tilt,number) 10 * 30 +

So when weather_radar_tilt is zero it shows keyframe 30. At -3 it will show keyframe 0 and at 3 it will show keyframe 60.
 
Top