n4gix
Resource contributor
- Messages
- 11,674
- Country

In the T-50 Bobcat, I have a "Primer Pump" that requires a complex bit of script to animate. Mouse wheel will rotate the control handle from ON Left - OFF - ON Right positions. This works just fine.
Where I'm encountering a problem however is with the in/out "pumping" animation. Currently I'm using this bit of scripting logic that does work, but unfortunately the silly thing has two sound effects of differing lengths. Pulling it out is easier and faster than pushing it back in, since like a hand insecticide sprayer, it only "pumps" on the in-stroke! In Real Life it actually needs both hands to do the pumping...
So, here is the current animation/mouse script:
What I'd like to do is modify the mouse section such that the first L-click would trigger the "out" stroke, and the second L-click would trigger the "in" stroke. Unfortunately, the script below will trigger the appropriate sounds, but no animation occurs, and I'm just not understanding why, which is why I'm asking for fresh eyes to provide a possible solution. If I can manage this, then I can re-script the animation for different timings to match the sound effects!
Where I'm encountering a problem however is with the in/out "pumping" animation. Currently I'm using this bit of scripting logic that does work, but unfortunately the silly thing has two sound effects of differing lengths. Pulling it out is easier and faster than pushing it back in, since like a hand insecticide sprayer, it only "pumps" on the in-stroke! In Real Life it actually needs both hands to do the pumping...

So, here is the current animation/mouse script:
Code:
<PartInfo>
<Name>SW_PrimerPump</Name>
<AnimLength>10</AnimLength>
<Animation>
<Parameter>
<Code>(L:SW_PrimerPump,bool) 10 *</Code>
<Lag>2.1</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<MouseFlags>WheelDown+WheelUp+LeftRelease+LeftDrag+LeftSingle</MouseFlags>
<CallbackCode>
(M:Event) 'WheelDown' scmp 0 ==
if{ (L:SW_PrimerSelect, enum) -- -1 max (>L:SW_PrimerSelect, enum) 1 (>L:XMLSND2,bool) }
(M:Event) 'WheelUp' scmp 0 ==
if{ (L:SW_PrimerSelect, enum) ++ 1 min (>L:SW_PrimerSelect, enum) 1 (>L:XMLSND2,bool) }
(* out *)
(M:Event) 'LeftSingle' scmp 0 ==
(L:SW_PrimerSelect, enum) 0 != and
if{ 1 (>L:SW_PrimerPump,bool) 1 (>L:XMLSND22,bool) }
(* in *)
(M:Event) 'LeftRelease' scmp 0 ==
(M:Event) 'LeftDrag' scmp 0 == or
if{ 0 (>L:SW_PrimerPump,bool) 1 (>L:XMLSND23,bool) }
</CallbackCode>
</MouseRect>
</PartInfo>
What I'd like to do is modify the mouse section such that the first L-click would trigger the "out" stroke, and the second L-click would trigger the "in" stroke. Unfortunately, the script below will trigger the appropriate sounds, but no animation occurs, and I'm just not understanding why, which is why I'm asking for fresh eyes to provide a possible solution. If I can manage this, then I can re-script the animation for different timings to match the sound effects!
Code:
<MouseRect>
<Cursor>Hand</Cursor>
<MouseFlags>WheelDown+WheelUp+LeftRelease+LeftDrag+LeftSingle</MouseFlags>
<CallbackCode>
(M:Event) 'WheelDown' scmp 0 ==
if{ (L:SW_PrimerSelect, enum) -- -1 max (>L:SW_PrimerSelect, enum) 1 (>L:XMLSND2,bool) }
(M:Event) 'WheelUp' scmp 0 ==
if{ (L:SW_PrimerSelect, enum) ++ 1 min (>L:SW_PrimerSelect, enum) 1 (>L:XMLSND2,bool) }
(* out *)
(M:Event) 'LeftSingle' scmp 0 ==
(L:SW_PrimerSelect, enum) 0 != and
(L:SW_PrimerPump,bool) 0 == and
if{ 1 (>L:SW_PrimerPump,bool) 1 (>L:XMLSND22,bool) }
(* in *)
(M:Event) 'LeftSingle' scmp 0 ==
(L:SW_PrimerSelect, enum) 0 != and
(L:SW_PrimerPump,bool) 1 == and
if{ 0 (>L:SW_PrimerPump,bool) 1 (>L:XMLSND23,bool) }
</CallbackCode>
</MouseRect>




