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

MSFS20 3 Position Spring Switch

Messages
153
Country
us-california
Hi all. After months of time off not messing with code I am diving back in to working on my aircraft. Not that I was ever good at it, but now I am very rusty and my brain is fried. My issue is with creating a 3 position spring switch( Up-Down) that returns to center. I have created something that works with templates but it uses the mouse wheel movement and timer return which I dont like the looks of its operation.

I am working with this code and its semi-successful. Issue #1- it doesn't start centered and issue #2 it springs back only from the Top to center not bottom to center also. I'm sure I'm missing something simple, but I've been staring at this for too long and my brain is spaghetti. Any help would be greatly appreciated.

Code:
        <Component ID="S2T_LL_PL_Switch" Node="S2T_LL_PL_Switch">
            <UseTemplate Name="ASOBO_GT_Anim_Code">
                <ANIM_NAME>S2T_LL_PL_Switch</ANIM_NAME>
                <PART_ID>S2T_LL_PL_Switch</PART_ID>
                <ANIM_LENGTH>100</ANIM_LENGTH>
                <ANIM_CODE>
                        50 (L:s2t_Pulse_Landing_switch,enum) 50 *
                </ANIM_CODE>
                <ANIM_LAG>400</ANIM_LAG>
            </UseTemplate>
            <UseTemplate Name="ASOBO_GT_MouseRect">
                <TOOLTIPID>Landing Lights</TOOLTIPID>
                <MOUSEFLAGS>LeftSingle+LeftRelease</MOUSEFLAGS>
                <UPARROW>UpArrow</UPARROW>
                <DOWNARROW>DownArrow</DOWNARROW>
                <CALLBACKCODE>
                        (M:Event) 'LeftSingle' scmp 0 ==
                        if{
                            (M:RelativeY) 0 &gt;
                            if{
                                (L:s2t_Pulse_Landing_switch, number) ++ (&gt;L:s2t_Pulse_Landing_switch, number)
                                (L:s2t_Pulse_Landing_switch, number) 2 &gt; if{ 2 (&gt;L:s2t_Pulse_Landing_switch, number) }
                            }
                            els{
                                (L:s2t_Pulse_Landing_switch, number) -- (&gt;L:s2t_Pulse_Landing_switch, number)
                                (L:s2t_Pulse_Landing_switch, number) 0 &lt; if{ 0 (&gt;L:s2t_Pulse_Landing_switch, number) }
                            }
                        }
                        (M:Event) 'LeftRelease' scmp  0 ==
                        if{
                            (L:s2t_Pulse_Landing_switch, number) 1 &gt; if{ 1 (&gt;L:s2t_Pulse_Landing_switch, number)
                        }                       
                </CALLBACKCODE>
            </UseTemplate>
        </Component>
 
Back
Top