I've modified this script to operate the toggle switch for the oil cooler.
I've managed to get the switch to start at it's center position and move forward
to open the cooler but I can't get it to spring back to the center position when I release
the mouse button. Also when I move the mouse back it closes the cooler but the switch's back animation
is not present. I would also like it to spring back to the center position once I release the mouse button
after the oil cooler is closed. Idealy it would be nice to have the cooler open and close in increments but
I'll be happy if the switch operates properly.
As always any help is appreciated.
I've managed to get the switch to start at it's center position and move forward
to open the cooler but I can't get it to spring back to the center position when I release
the mouse button. Also when I move the mouse back it closes the cooler but the switch's back animation
is not present. I would also like it to spring back to the center position once I release the mouse button
after the oil cooler is closed. Idealy it would be nice to have the cooler open and close in increments but
I'll be happy if the switch operates properly.
Code:
<PartInfo>
<Name>lever_oil_cooler</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>(L:lever_oil_cooler, bool) 50 * 50 + </Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<MouseFlags>LeftDrag+LeftSingle+MoveRepeat+LeftRelease</MouseFlags>
<CallbackCode>
(M:Event) 'LeftSingle' scmi 0 == if{ (M:X) (>L:ClickStart) }
(M:Event) 'LeftRelease' scmi 0 == if{ 50 (>L:lever_oil_cooler, bool) 100}
(M:Event) 'LeftDrag' scmi 0 == if{ (M:X) (L:ClickStart) - 0 <
if{ (>L:lever_oil_cooler, bool) 0 -1 (>L:oil_cooler, bool) quit }
els{ (>L:lever_oil_cooler, bool) 0 1 (>L:oil_cooler, bool) quit } }
</CallbackCode>
</MouseRect>
</PartInfo>




