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

OMI switch

euroastar350

Resource contributor
Messages
863
Country
us-delaware
Hi guys,

I have an OMI with a 3 position switch and want to know what would be the way to animate it? I have the lit marker lights already built and mapped, I just need to properly animate the switch. Thanks
 

Attachments

  • OMI.jpg
    OMI.jpg
    370.2 KB · Views: 440
Ah, the classic "three-way switch" problem...

Keyframe 0 - "Test"
Keyframe 50 - "Low"
Keyframe 100 - "High"

Add a bias of 50 to the animation.

Mouse logic:
Code:
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>OMI Switch</TooltipText>
<MouseFlags>LeftSingle+RightSingle+Wheel</MouseFlags>
<CallbackCode>
(M:Event) 'LeftSingle' scmp 0 ==
(M:Event) 'WheelDown' scmp 0 == or
if{ (L:FuelSelectLeft, enum) 50 - 0 max (>L:OMI_Sw, enum) }

(M:Event) 'RightSingle' scmp 0 ==
(M:Event) 'WheelUp' scmp 0 ==
if{ (L:FuelSelectLeft, enum) 50 + 100 min (>L:OMI_Sw, enum) }
</CallbackCode>
</MouseRect>
(Blatantly nicked from Bill Leaming.)
 
Yes, and also it can be cut to:

Code:
<MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown</MouseFlags>
<CallbackCode>
   (M:Event) 'LeftSingle' scmp 0 ==
   (M:Event) 'WheelDown' scmp 0 == or
   if{ (L:FuelSelectLeft, enum) 50 - 0 max (>L:OMI_Sw, enum) }
   els{ (L:FuelSelectLeft, enum) 50 + 100 min (>L:OMI_Sw, enum) }
</CallbackCode>

If M:Event is not LeftSingle or WheelDown, it must be RightSingle or WheelUp.

Tom
 
...which works just fine unless you also need to detect and act on a "MiddleSingle" event or some other "MiddleSomething" event. :teacher:
 
Bill, MiddleSingle works OK in gauge code, is there any problem with this tag in modeldef file?

Tom
 
erm...that code looks like it will trigger the els block even if you just mouse over the part.
 
Nope.

<CallbackCode> script only executes when any of the events defined in <MouseFlags> is triggered.
And the same for <Click Kind> in XML gauges.

So, if you have <Click Kind="A+B+C">, and you need to execute (1) when A and (2) when B or C, you could code

(M:Event) "A" scmp 0 == if{ (1) } els{ (2) }

or

(M:Event) "B" scmp 0 == (M:Event) "C" scmp 0 == or if{ (2) } els{ (1) }

Tom
 
...which works just fine unless you also need to detect and act on a "MiddleSingle" event or some other "MiddleSomething" event. :teacher:

I plan on using this new method on simple codes and if i need a specific type i would just write each M:Event separate.
Tom sounds like click kind is only for non modeldef codes. And i plan on using this trick a lot for my modeldef file.
If i need a middle click i would just use the norm....
 
Bill, MiddleSingle works OK in gauge code, is there any problem with this tag in modeldef file?

Tom
No problems at all, Tom. Here is one of the most 'extreme' examples I can find:
Code:
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipText>Small Knob</TooltipText>
      <MouseFlags>LeftSingle+LeftRelease+RightSingle+RightRelease+MiddleSingle+MiddleRelease+WheelUp+WheelDown</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle'  scmp 0 == if{ 0x0001FA15 (>L:F1GTNMOUSE, bool)
        (L:F1GTN750U1_INNKNOB, number) 5 - (&gt;L:F1GTN750U1_INNKNOB, number)
        (L:F1GTN750U1_INNKNOB, number) 99 &gt; if{ 0 (&gt;L:F1GTN750U1_INNKNOB, number) }
        (L:F1GTN750U1_INNKNOB, number) 0 &lt; if{ 99 (&gt;L:F1GTN750U1_INNKNOB, number) }
        }
 
        (M:Event) 'LeftRelease'  scmp 0 == if{ 0x0001FA16 (>L:F1GTNMOUSE, bool) }
 
        (M:Event) 'RightSingle'  scmp 0 == if{ 0x0001FA17 (>L:F1GTNMOUSE, bool)
        (L:F1GTN750U1_INNKNOB, number) 5 + (&gt;L:F1GTN750U1_INNKNOB, number)
        (L:F1GTN750U1_INNKNOB, number) 99 &gt; if{ 0 (&gt;L:F1GTN750U1_INNKNOB, number) }
        (L:F1GTN750U1_INNKNOB, number) 0 &lt; if{ 99 (&gt;L:F1GTN750U1_INNKNOB, number) }
        }
 
        (M:Event) 'RightRelease'  scmp 0 == if{ 0x0001FA18 (>L:F1GTNMOUSE, bool) }
        (M:Event) 'MiddleSingle'  scmp 0 == if{ 0x0001FA19 (>L:F1GTNMOUSE, bool) }
        (M:Event) 'MiddleRelease' scmp 0 == if{ 0x0001FA1A (>L:F1GTNMOUSE, bool) }
 
        (M:Event) 'WheelDown'  scmp 0 == if{ 0x0001FA1B (>L:F1GTNMOUSE, bool)
        (L:F1GTN750U1_INNKNOB, number) 5 - (&gt;L:F1GTN750U1_INNKNOB, number)
        (L:F1GTN750U1_INNKNOB, number) 99 &gt; if{ 0 (&gt;L:F1GTN750U1_INNKNOB, number) }
        (L:F1GTN750U1_INNKNOB, number) 0 &lt; if{ 99 (&gt;L:F1GTN750U1_INNKNOB, number) }
        }
 
        (M:Event) 'WheelUp'  scmp 0 == if{ 0x0001FA1C (>L:F1GTNMOUSE, bool)
        (L:F1GTN750U1_INNKNOB, number) 5 + (&gt;L:F1GTN750U1_INNKNOB, number)
        (L:F1GTN750U1_INNKNOB, number) 99 &gt; if{ 0 (&gt;L:F1GTN750U1_INNKNOB, number) }
        (L:F1GTN750U1_INNKNOB, number) 0 &lt; if{ 99 (&gt;L:F1GTN750U1_INNKNOB, number) }
        }
      </CallbackCode>
    </MouseRect>
 
Back
Top