- Messages
- 235
- Country
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{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 <
if{ 2 + 100 min } els{ l0 (M:X) < if{ 2 - 0 max } }
d (>L:Avt_Power_Lever:1,enum)
d (>L:Avt_Power_Lever:2,enum)
} (M:X) (>LowerPosLeftX, position)
}
(M:Event) 'RightDrag' scmp 0 ==
if{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 <
if{ 2 + 0 min } els{ l0 (M:X) < if{ 2 - -50 max } }
d (>L:Avt_Power_Lever:1,enum)
d (>L:Avt_Power_Lever:2,enum)
} (M:X) (>LowerPosLeftX, 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{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:2,enum) (M:X) l0 <
if{ 2 + 100 min } els{ l0 (M:X) < if{ 2 - 0 max } }
(>L:Avt_Power_Lever:2,enum)
} (M:X) (>LowerPosLeftX, position)
}
(M:Event) 'RightDrag' scmp 0 ==
if{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:2,enum) (M:X) l0 <
if{ 2 + 0 min } els{ l0 (M:X) < if{ 2 - -50 max } }
(>L:Avt_Power_Lever:2,enum)
} (M:X) (>LowerPosLeftX, 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{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 <
if{ 2 + 100 min } els{ l0 (M:X) < if{ 2 - 0 max } }
(>L:Avt_Power_Lever:1,enum)
} (M:X) (>LowerPosLeftX, position)
}
(M:Event) 'RightDrag' scmp 0 ==
if{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 <
if{ 2 + 0 min } els{ l0 (M:X) < if{ 2 - -50 max } }
(>L:Avt_Power_Lever:1,enum)
} (M:X) (>LowerPosLeftX, 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
Modeldef.xml Custom Lever Animations
I have a set of power levers that I have animated for thrust control (0 to 100). Because I need the lever(s) to stop at "Idle" I have the animation set as: 50 (L: Power_Lever:1,enum) + (I had to add a space after L: to stop the silly emojies) In Max I have the full animation set for 0 to 150...
www.fsdeveloper.com
<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{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 <
if{ 2 + 100 min } els{ l0 (M:X) < if{ 2 - 0 max } }
d (>L:Avt_Power_Lever:1,enum)
d (>L:Avt_Power_Lever:2,enum)
} (M:X) (>LowerPosLeftX, position)
}
(M:Event) 'RightDrag' scmp 0 ==
if{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 <
if{ 2 + 0 min } els{ l0 (M:X) < if{ 2 - -50 max } }
d (>L:Avt_Power_Lever:1,enum)
d (>L:Avt_Power_Lever:2,enum)
} (M:X) (>LowerPosLeftX, 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{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:2,enum) (M:X) l0 <
if{ 2 + 100 min } els{ l0 (M:X) < if{ 2 - 0 max } }
(>L:Avt_Power_Lever:2,enum)
} (M:X) (>LowerPosLeftX, position)
}
(M:Event) 'RightDrag' scmp 0 ==
if{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:2,enum) (M:X) l0 <
if{ 2 + 0 min } els{ l0 (M:X) < if{ 2 - -50 max } }
(>L:Avt_Power_Lever:2,enum)
} (M:X) (>LowerPosLeftX, 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{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 <
if{ 2 + 100 min } els{ l0 (M:X) < if{ 2 - 0 max } }
(>L:Avt_Power_Lever:1,enum)
} (M:X) (>LowerPosLeftX, position)
}
(M:Event) 'RightDrag' scmp 0 ==
if{
(LowerPosLeftX, position) s0 0 !=
if{
(L:Avt_Power_Lever:1,enum) (M:X) l0 <
if{ 2 + 0 min } els{ l0 (M:X) < if{ 2 - -50 max } }
(>L:Avt_Power_Lever:1,enum)
} (M:X) (>LowerPosLeftX, 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