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

FSX:SE Simple on/off switch - efficient

Messages
45
Country
australia
Hi all,

I'm working on animating the non-animated switches in the default 737 Virtual Cockpit. So far so good in respect of animations.

At this point in time, I just want the animations triggered by simple on/off switches. No other functionality coded.

I've come up with the below code which works, but I'm very interested to find out if there is a more efficient method which I should adopt.

Code:
    <PartInfo>
        <Name>switch_runway_turnoff_right</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
            <Code>
                  (L:Runway Turnoff Right, bool) 0 == if{ 0 } els{ 50 }
            </Code>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
        <MouseFlags>LeftSingle</MouseFlags>
            <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 == if{ (L:Runway Turnoff Right, bool) 0 == if{ 1 (&gt;L:Runway Turnoff Right, bool) } els{ 0 (&gt;L:Runway Turnoff Right, bool) } }
        </CallbackCode>
        </MouseRect>
    </PartInfo>

Any advice provided is gratefully received.

Trent
 
Code:
(M:Event) 'LeftSingle' scmp 0 == if{ (L:Runway Turnoff Right, bool) ! (&gt;L:Runway Turnoff Right, bool) }
 
In your click zone, you have some basic logic going. Do you need that?

If not, what Dave posted works well. Thats what I use for basics that are L:Vars.

(L:Runway Turnoff Right, bool) ! (&gt;L:Runway Turnoff Right, bool)


This is a typical fake switch which can be mildly modified and still does its basic job. You will need to assign it a mouse rect in Gmax/Blender/Max.


Code:
 <PartInfo>
  <Name>learjet24_yoke_atc_button</Name>
      <AnimLength>100</AnimLength>
      <Animation>
          <Parameter>
             <Code>(L:LEARJET24_YOKE_ATC_BUTTON, bool) 50 *</Code>
            <Lag>50</Lag>
          </Parameter>
       </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
    <TooltipText>Air Traffic Control (MIC) </TooltipText>
      <CallbackCode>
                 (L:LEARJET24_YOKE_ATC_BUTTON, bool) ! (>L:LEARJET24_YOKE_ATC_BUTTON, bool)
      </CallbackCode>
    </MouseRect>
</PartInfo>

If you wanted the above to turn on the Mic (ATC Window) then add this into the click zone... (for those dying of curiosity..)
(>K:ATC)
 
I have a 'generic template' that I use for any new modeldef.xml script entries. I keep in at the bottom of a guid.txt file, in which I keep around 1000 guid numbers, which I can then cut/paste to my working modeldef.xml file. It makes life so much simpler! :rotfl:
Code:
<Animation name="" guid="" length="" type="Sim" typeParam2="" typeParam="AutoPlay" />

<AnimationRef guid=""/>

  <PartInfo>
    <Name>PartName</Name>
    <AnimLength>5</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:somevarname,bool) 5 *
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <CallbackCode>
        (L:somevarname,bool) ! (>L:somevarname,bool)
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 
Hi all,

These are absolutely brilliant replies! I had no idea you could toggle a custom variable so there you go!

Learn something new everyday!

Thank you all again.

Trent
 
L:Var equals 'fake' animation. :)

Love it.

For switches and things, you can set their animations. Factory MS switches in the sim are usually 50 points or key frames, (KF). Thats for 'existing' switches that come with the SDK. You can set your own for 100 KF's for smoother animations, and for things like a pilot scanning his head, you can do 750 KF's, etc.

Bill Leaming figured out a way to do a custom 'this or that' which bypasses animations, flashing from this position to that position without an animation which cut down on the size of his model file. (I think he broke the system and had to figure out ways to lower his animation costs).
 
Bill Leaming figured out a way to do a custom 'this or that' which bypasses animations, flashing from this position to that position without an animation which cut down on the size of his model file. (I think he broke the system and had to figure out ways to lower his animation costs).

Nothing custom there, it was just visibility controlled switches.
 
Back
Top