Jump to content

llSetLinkTextureAnim -- Smooth animation does not reset consistently - Help


Malestorm1488303118
 Share

You are about to reply to a thread that has been inactive for 3662 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello...

I have board that displays a timer which slides from all green to all red over the course of 15 seconds.   If the user makes a selection within  the 15 seconds the the timer is reset to all green so that they may make another selection.  This continues until the user presses a button to indicate that he is finished.

The problem is that even though the statement is getting executed to reset the timer, the timer animation does not always reset but just continues as if the script commands to stop animation and restart annimation were not issued.

Here is a small funcion I use to start or stop the timer.

// FUNCTION SET TIMER
setTimer(integer timer_start) {   // Timer_Start is a logical 
if (timer_start) {
       llSetLinkTextureAnim (linkTimer,ANIM_ON | SMOOTH, ONE, 2, 1, 0.0, 2.0, .066);
llSetTimerEvent(TIMEOUT_SELECTION);
}
else {
llSetTimerEvent(STOP_TIMER);
llSetLinkTextureAnim(linkTimer, FALSE, ONE, ZERO, ZERO, ZERO_FLOAT, ZERO_FLOAT, UNIT_FLOAT);
}

  So in my script I setTimer( TRUE) at the beginning of a selection then if a selection is made I setTimer (FALSE) to reset the clock and reposition the texture to the beginning, then setTimer(TRUE) to restart the clock and the animation.  

If I don't reset the texture before restarting the animation, then the animation NEVER restarts.    Usually the function works, but does not very occationally.   Of course, even very occationally is a problem.

Does anyone have any suggestion on how I could get the texture animation to work consistently??? 

Many thanks for your thoughtful consideration of this problem.

Link to comment
Share on other sites

Try this strategy --- the final example in llSetTextureAnim in the LSL wiki. It has worked for me in the past.

integer textureIsBeingAnimated; default{    touch_start(integer num_detected)    {        if (textureIsBeingAnimated)            llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 1, 5, 0.0, 0.0, 1.0);        else            llSetTextureAnim(ANIM_ON | SMOOTH, ALL_SIDES, 1, 5, 5.0, 1.0, 1.0)// toggle back and forth between TRUE (1) and FALSE (0)        textureIsBeingAnimated = !textureIsBeingAnimated;    }}
Link to comment
Share on other sites

It may depend on the value of TIMEOUT_SELECTION variable. If the timing period is too short may start lagging behind. Btw, llSetTimerEvent(STOP_TIMER) is meaningless because the only value that stops the timer is 0.0 so if STOP_TIMER is set to some other value it is a misleading name, and if it is indeed 0.0 you don't need a variable for that.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3662 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...