Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

A little help on this multi pose script

Marcus Perry
Registered User
Join date: 22 Nov 2006
Posts: 87
08-28-2007 07:52
hello all,

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";
}
}
}
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
08-28-2007 07:56
Looks like it is this line:

llStartAnimation("turn_180";);

So you could try just deleting it, or replacing if with some other animation.
Darko Lednev
Registered User
Join date: 20 Aug 2007
Posts: 31
08-28-2007 08:01
Try to replace from run_time_permissions(integer parm) all the way to the end with the next code (NOTE1: Didn't tested it but it should work. NOTE2: Watch out for a space (" ";) in one line. It's because the forum.):


run_time_permissions(integer parm)
{
if(parm == PERMISSION_TRIGGER_ANIMATION)
{

//set permission flag
miPermissionsAcquired = TRUE;

//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;
}
}
}
}
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
08-28-2007 08:02
The problem is the "turn_180" which is puts the av into edit mode. Replace the run_time_permissions section with this code. It will run the first animation you have.

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(llGetInventoryName(INVENTORY_ANIMATION, 1)); // was llStartAnimation("turn_180";);

//sets the current to the default anim
current = llGetInventoryName(INVENTORY_ANIMATION, 1); // was current = "turn_180";
Marcus Perry
Registered User
Join date: 22 Nov 2006
Posts: 87
08-28-2007 08:17
From: Destiny Niles
The problem is the "turn_180" which is puts the av into edit mode. Replace the run_time_permissions section with this code. It will run the first animation you have.

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(llGetInventoryName(INVENTORY_ANIMATION, 1)); // was llStartAnimation("turn_180";);

//sets the current to the default anim
current = llGetInventoryName(INVENTORY_ANIMATION, 1); // was current = "turn_180";


Okay, i'm having trouble integrating this since i totally suck at scripting. How is the script supposed to look like with this part in it ?
Marcus Perry
Registered User
Join date: 22 Nov 2006
Posts: 87
08-28-2007 09:18
Allright, got it sorted out with a bit of help. Thank you everyone for your assistance, especially Darko for your inwolrd help ! :-)