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

MSFS Eyeball vent

Messages
235
Country
australia
Could any of you kind folk lend a hand please. I am trying to code an eyeball vent for my project with no luck. I would like to get the vent to be dragged by my mouse in any direction. In searching, I came across the following thread:
and in it was the following code example provided by the wonderful Fr. Bill (if I ever meet that legend, I would fall at his feet). Sadly I don't think he is active anymore.
<PartInfo>
<Name>PED_lever_throttle_both</Name>
<AnimLength>150</AnimLength>
<Animation>
<Parameter>
<Code>
50 (L:Avt_Power_Lever:1,enum) +
</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Both Power %((L:Avt_Power_Lever:1,enum))%!d!</TooltipText>
<MouseFlags>LeftSingle+LeftDrag+MoveRepeat+Wheel+RightDrag+RightRelease</MouseFlags>
<CallbackCode>
(M:Event) 'LeftDrag' scmp 0 ==
if{
(L:powerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 &lt;
if{ 2 + 100 min } els{ l0 (M:X) &lt; if{ 2 - 0 max } }
d (&gt;L:Avt_Power_Lever:1,enum)
d (&gt;L:Avt_Power_Lever:2,enum)
} (M:X) (&gt;L:powerPosLeftX, position)
}

(M:Event) 'RightDrag' scmp 0 ==
if{
(L:powerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 &lt;
if{ 2 + 0 min } els{ l0 (M:X) &lt; if{ 2 - -50 max } }
d (&gt;L:Avt_Power_Lever:1,enum)
d (&gt;L:Avt_Power_Lever:2,enum)
} (M:X) (&gt;L:powerPosLeftX, position)
}
</CallbackCode>
</MouseRect>
</PartInfo>

<PartInfo>
<Name>PED_lever_throttle1</Name>
<AnimLength>150</AnimLength>
<Animation>
<Parameter>
<Code>
50 (L:Avt_Power_Lever:2,enum) +
</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>R Power %((L:Avt_Power_Lever:2,enum))%!d!</TooltipText>
<MouseFlags>LeftSingle+LeftDrag+MoveRepeat+Wheel+RightDrag+RightRelease</MouseFlags>
<CallbackCode>
(M:Event) 'LeftDrag' scmp 0 ==
if{
(L:powerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:2,enum) (M:X) l0 &lt;
if{ 2 + 100 min } els{ l0 (M:X) &lt; if{ 2 - 0 max } }
(&gt;L:Avt_Power_Lever:2,enum)
} (M:X) (&gt;L:powerPosLeftX, position)
}

(M:Event) 'RightDrag' scmp 0 ==
if{
(L:powerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:2,enum) (M:X) l0 &lt;
if{ 2 + 0 min } els{ l0 (M:X) &lt; if{ 2 - -50 max } }
(&gt;L:Avt_Power_Lever:2,enum)
} (M:X) (&gt;L:powerPosLeftX, position)
}
</CallbackCode>
</MouseRect>
</PartInfo>

<PartInfo>
<Name>PED_lever_throttle0</Name>
<AnimLength>150</AnimLength>
<Animation>
<Parameter>
<Code>
50 (L:Avt_Power_Lever:1,enum) +
</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>L Power %((L:Avt_Power_Lever:1,enum))%!d!</TooltipText>
<MouseFlags>LeftSingle+LeftDrag+MoveRepeat+Wheel+RightDrag+RightRelease</MouseFlags>
<CallbackCode>
(M:Event) 'LeftDrag' scmp 0 ==
if{
(L:powerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 &lt;
if{ 2 + 100 min } els{ l0 (M:X) &lt; if{ 2 - 0 max } }
(&gt;L:Avt_Power_Lever:1,enum)
} (M:X) (&gt;L:powerPosLeftX, position)
}

(M:Event) 'RightDrag' scmp 0 ==
if{
(L:powerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 &lt;
if{ 2 + 0 min } els{ l0 (M:X) &lt; if{ 2 - -50 max } }
(&gt;L:Avt_Power_Lever:1,enum)
} (M:X) (&gt;L:powerPosLeftX, position)
}
</CallbackCode>
</MouseRect>
</PartInfo>

I have managed to use this to make my test animation move along one axis with my mouse but have no idea how to modify the code to use both X and Y axis. If anybody could chime in with some advice on how to proceed, I would be grateful.

P.S. I would rather stay away from the MSFS template system as I am too stupid to understan them.

Kind regards, TJ
 
M:X is the mouse X position
M:Y is the mouse Y position

At it's simplest you would create a (M:Event) 'LeftSingle' scmp 0 == condition and store the positions of M:X and M:Y when the mouse is first clicked then use the (M:Event) 'LeftDrag' scmp 0 == to read the current position of M:X and M:Y. You then write the difference between the current position and the original positions you stored into your animation variables. This code could be your X position but you'd need another animation for the Y position. I presume you have setup your vent like this already.
 
Hi Ant, I am stabbing in the dark here. My XML knowledge is crap. I cant find any code anywhere to reference in order to find a starting point. Can you please help. I don't know where to begin. Cheers, TJ
 
Back
Top