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

XML MouseRect problem

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
I have encountered an issue that defies all of my attempts to resolve. I have multiple switches that are 3 position, center return. They are various 'trimming' switches that are left/right click, with spring-loaded center return. Most of them work as designed, however two simply do not. Here is the XML script for one that works:
Code:
  <PartInfo>
    <Name>ATR_ENG1_TRIM_SWITCH</Name>
    <AnimLength>20</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:ENG1_TRIM_SWITCH, number) 1 + 10 *</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>HAND</Cursor>
      <MouseFlags>LeftSingle+RightSingle+LeftRelease+RightRelease</MouseFlags>
      <CallbackCode>
        (M:Event) &apos;LeftSingle&apos; scmp 0 == if{ 0x1129D (&gt;L:LVEVENT, number) }
        (M:Event) &apos;RightSingle&apos; scmp 0 == if{ 0x1129E (&gt;L:LVEVENT, number) }
        (M:Event) &apos;LeftRelease&apos; scmp 0 == if{ 0x1129E (&gt;L:LVEVENT, number) 1 (&gt;L:LVEVRELEASE, number) }
        (M:Event) &apos;RightRelease&apos; scmp 0 == if{ 0x1129D (&gt;L:LVEVENT, number) 1 (&gt;L:LVEVRELEASE, number) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>

Here is one that does not work properly.
When left-clicked, switch moves to the left position, on release it returns to center position.
When right-clicked, switch moves to right position, on release it snaps back to the left position! :eek:

Code:
  <PartInfo>
    <Name>ATR_ENG1_LO_PITCH_SWITCH</Name>
    <AnimLength>20</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:ENG1_LO_PITCH_SWITCH, number) 1 + 10 *</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>HAND</Cursor>
      <MouseFlags>LeftSingle+RightSingle+LeftRelease+RightRelease</MouseFlags>
      <CallbackCode>
        (M:Event) &apos;LeftSingle&apos; scmp 0 == if{ 0x112A3 (&gt;L:LVEVENT, number) }
        (M:Event) &apos;RightSingle&apos; scmp 0 == if{ 0x112A4 (&gt;L:LVEVENT, number) }
        (M:Event) &apos;LeftRelease&apos; scmp 0 == if{ 0x112A4 (&gt;L:LVEVENT, number) 1 (&gt;L:LVEVRELEASE, number) }
        (M:Event) &apos;RightRelease&apos; scmp 0 == if{ 0x112A3 (&gt;L:LVEVENT, number) 1 (&gt;L:LVEVRELEASE, number) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 
Last edited:
Hi,

1. Try a shorter part name and L: variable name.
2. Try a different name for the part name and L: variable name. Change it so ATR_ENG1 and ENG1 are not the start of the names.
3. Make sure you remove any scaling from the part.
 
I went through your code and nothing jumps into my eyes. Maybe it's something with the linked code - I guess a C++ gauge?

Is it on purpose that you use 1 (&gt;L:LVEVRELEASE, number) both for Left and Right release?
 
I went through your code and nothing jumps into my eyes. Maybe it's something with the linked code - I guess a C++ gauge?

Is it on purpose that you use 1 (&gt;L:LVEVRELEASE, number) both for Left and Right release?
Another team member is coding an Event Handler in a .dll so the issue might lie in his code. I haven't tried yet but I'll bet that if I temporarily re-tag the non-working switch with the working switch's hex number it will work properly. That would definitely point to his .dll code.

Yes, the 1 (&gt;L:LVEVRELEASE, number) is a generic release event.
 
It's always good when you can cast blame on someone else! :rotfl::rotfl:
 
It's always good when you can cast blame on someone else! :rotfl::rotfl:
In this instance it has been confirmed. Both of the two misbehaving switches animate properly when driven by the working script(s). So the problem does lie in the .dll coding. :scratchch
 
Back
Top