Here's the script I currently have. Any suggestions? Thanks!
//This kinda works, but you can't stop once you start!
float force_amount = 15.0; //Initial jumping force
integer i; //A simple counter.
integer random; //Used to hold a random number.
list animations = ["Balanced", "Fall Forward", "Flip", "Splat", "Spread Eagle", "Stand", "Stretch", "Superhero Landing", "Vogue"];
key agent; //Who's using me?
default
{
on_rez(integer param)
{
llResetScript(); // reset the script as soon as it starts.
}
state_entry()
{
llSetSitText("Jump!"
;llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); //Needed for llAvatarOnSitTarget to work.
}
changed(integer change) //Something changed. In this case, the avatar may have sat.
{
if (change & CHANGED_LINK) //Yes, the avatar sat.
{
agent = llAvatarOnSitTarget();
if(agent != NULL_KEY) // Somebody is sitting on me!
{
llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION); // Ask the owner for permission to trigger animations.
while(agent != NULL_KEY)
{
integer perm = llGetPermissions();
if (perm & PERMISSION_TRIGGER_ANIMATION) // make sure we're actually attached.
{
llUnSit(agent);
llTriggerSound("trampoline", 0.5);
llStopAnimation("sit"
; // Stop the default sit animation.llPushObject(agent, force_amount*llRot2Up(llGetRot()), ZERO_VECTOR, FALSE);
random = llFloor(llFrand(llGetListLength(animations)));
llStartAnimation(llList2String(animations, random));
llSleep(1);
}
else
{
llStopAnimation(llList2String(animations, random)); // stop the animation
}
} //End While Avatar is sitting.
} //End Somebody is sitting.
} //End Yes, the avatar sat.
} //End Something Changed.
} //End Default.