I found this nice script for multiple poses and I am quite happy with it. There is just one problem: The moment someone sits on the object that includes the script and it's animations, the avatar goes into "Edit Appearence" mode and you have to click the object before it starts with the first animation. i'd apprechiate it if someone can help me identify and delete the part of the script that is responisble for the "Edit Appearenche".
Thank you everyone in advance. Here is the script:
key mkLoungingAgentKey = NULL_KEY;
key agent;
integer miPermissionsAcquired = FALSE;
string current;
string current2;
string command = "set";
string command2 = "stop";
string setanim;
string stopanim;
integer next = 0;
integer limit;
default
{
state_entry()
{
llListen(0, "", llGetOwner(), ""
;//overriden sit target
//lower them a bit
vector vLoungeTarget = <0.00, 0.00, 1.20>;
rotation rX;
rotation rY;
rotation rZ;
rotation r;
//build rotations
//Note: this is broken out like this to simplify the
// process of finding the correct sit angle. I
// use the following form until I have the rotation
// that I want perfect, and then I simply
// hardcode the perfected quaterion and remove
// this mess.
//
rX = llAxisAngle2Rot( <1,0,0>, 0 * DEG_TO_RAD); //cartwheel
rY = llAxisAngle2Rot( <0,1,0>, 0 * DEG_TO_RAD); //sumersault
rZ = llAxisAngle2Rot( <0,0,1>, 0 * DEG_TO_RAD); //turn in place
//combine rotations
r = rX * rY * rZ;
//override 'sit' on pie menu
llSetSitText( "Model" );
//override default sit target and rotation on prim
llSitTarget( vLoungeTarget, r );
//gets total number of animations in inventory to know how many to cycle through
limit = llGetInventoryNumber(INVENTORY_ANIMATION);
}
changed(integer change)
{
//this checks to see if any new animations have been added, and if so, then changes the limit integer to match
if (change & CHANGED_INVENTORY);
{
limit = llGetInventoryNumber(INVENTORY_ANIMATION);
}
//this checks to see if anyone has sat/gotten off the stand
if (change & CHANGED_LINK)
{
agent = llAvatarOnSitTarget();
if ( mkLoungingAgentKey == NULL_KEY && agent != NULL_KEY )
{
//changed user
//cache new user key and request their permissions
mkLoungingAgentKey = agent;
llRequestPermissions(mkLoungingAgentKey,PERMISSION_TRIGGER_ANIMATION);
}
else if ( mkLoungingAgentKey != NULL_KEY && agent == NULL_KEY)
{
//user is getting up
if ( miPermissionsAcquired )
{
//restore anims
llStopAnimation("turn_180"
; }
//reset the script to release permissions
llResetScript();
}
}
}
listen(integer channel, string name, key id, string message)
{
if (llSubStringIndex(message, command) == 0)
{
//parse out the name of the animation
integer spaceIdx = llSubStringIndex(message, " "
;setanim = llGetSubString(message, spaceIdx + 1, -1);
llStopAnimation(current);
llStartAnimation(setanim);
current = llList2String(llGetAnimationList(agent), 0);
llWhisper(0, "Starting: "+setanim);
}
if (llSubStringIndex(message, command2) == 0)
{
//parse out the name of the animation
integer spaceIdx = llSubStringIndex(message, " "
;stopanim = llGetSubString(message, spaceIdx + 1, -1);
llStopAnimation(stopanim);
llWhisper(0, "Stopping: "+stopanim);
}
//if the message in all lowercase equals hide stand then the stand will become invisible
if (llToLower(message) == "hide stand"

{
llSetAlpha(0, ALL_SIDES);
}
//same as above but makes the stand visible at the message show stand
if (llToLower(message) == "show stand"

{
llSetAlpha(1, ALL_SIDES);
}
}
//the below happens when someone touches it
touch_start(integer num)
{
//stops what's happening right now
llStopAnimation(current);
//starts the next animation in the inventory
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION, next));
//sets the current animation to what was just changed to
current = llGetInventoryName(INVENTORY_ANIMATION, next);
//ups the next integer by 1 so that next time this is run the next animation in the list is used
next++;
//checks to see if the current animation has reached the end of the number of the anims
if( next == limit)
{
//if so then it resets next to 0
next = 0;
}
}
run_time_permissions(integer parm)
{
if(parm == PERMISSION_TRIGGER_ANIMATION)
{
//set permission flag
miPermissionsAcquired = TRUE;
//cancel the sit anim
llStopAnimation("sit"
;//starts the default anim for this stand
llStartAnimation("turn_180"
;//sets the current to the default anim
current = "turn_180";
}
}
}
