Jump to content

HOW TO SCRIPT LOOP AN UN-LOOPED ANIMATION ?


Pixels Sideways
 Share

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

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

Recommended Posts

Hola!

I have an animation that was not uploaded to loop. 

I have a script I'm using that works great & has a cam position view, etc.  The animation plays then stops.

What I need to add is code that that will continuously loop the animation until the avatar unsits/stands.

I can't seem to find info on how to do this.

Here is my current script:

Where would I insert a loop until avatar unsits/stands command?

Thank you.

xoxo

 

//Offset Position
//ex: < 0.0 , 0.0 , 1.0 > = 1 meter above the object (z axis)

vector offset = < -0.0,0.1 , -0.05>;

//Degrees Rotation
//ex: < 0 , 0 , 45 > = +45 degrees on the z axis

vector deg = < 0 , 0 , 270 >;


//Pie Option Text
string text = "COOL";

default
{
    state_entry()
    {
        llSetSitText(text);
        deg *= DEG_TO_RAD; //convert to radians
        rotation quat = llEuler2Rot( deg ); //convert to quaternion
        llSitTarget(offset, quat);
        llSetCameraEyeOffset(<-0.0, -4.0, 1.0>);
        llSetCameraAtOffset(<0.0, 2.0, 0.>);
        
    }
    changed(integer change)
  {
    if (change & CHANGED_LINK)
    {

      if (llAvatarOnSitTarget() != NULL_KEY)
      {
        llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
      }
    }
  }
  run_time_permissions(integer perm)
  {
    if (perm & PERMISSION_TRIGGER_ANIMATION)
    {
      key av=llAvatarOnSitTarget();
      llStopAnimation("Wave_RHand 11.5");
      string animation="Wave_RHand 11.5";
      llStartAnimation(animation);
      llSleep(20);
   llClearCameraParams();llUnSit(av);llSleep(1);llResetScript();
    
    }
  }
}

 

 

Link to comment
Share on other sites

Your best bet is to not sleep the script but time how long the animation runs for, put the call to activate it in a function which you call from the request permissions event, and set a timer in the function. In the timer event, cancel the timer and then call the function, so the animation plays and sets the timer.

As the animation isn't looped there is no need to stop it.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 361 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...