Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple Chairsit help

Domneth Dingson
Registered User
Join date: 20 Nov 2006
Posts: 126
12-30-2006 00:23
I'm creating a series of low prim furniture, and putting simple scripts into them for various sitting animations, to make the uncomfortable furniture look a bit more comfortable. :)

At the same time, I'm also learning LSL. While I've seen alot of Poseball scripts or animation things, I really couldn't figure out the answer to my problem, and I feel it's key in my LSL progression.


Anyways, I've got everything set up perfect for my 'chair'. The avatar sits perfectly, etc. The problem is, it takes 2 sits the first time said avatar sits in that chair. The first time they try to sit, they'll simply stand there. They select stand, then sit and it works as intended from then on.


I assume that it has to do with checking for permissions, and the object not having permission to animate said avatar until the second time they try to 'sit'. Perhaps the order in which I have certain things is to blame?

Either way, I'd appreciate some help below.

From: Domneth

default
{
state_entry()
{
llSitTarget(<.1,-.1,-.4>, <0,0,.8,1.0>;);
}

changed(integer change)
{
if(change & CHANGED_LINK)
{
key avataronsittarget = llAvatarOnSitTarget();
if( avataronsittarget != NULL_KEY )
{
if ((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && llGetPermissionsKey() == avataronsittarget)
{
llStopAnimation("sit";);
llStartAnimation("sitting chair m06";);
}
else
{
llRequestPermissions(avataronsittarget, PERMISSION_TRIGGER_ANIMATION);
}
}
}
}

run_time_permissions(integer perm)
{
if(perm)
{
llStopAnimation("sit";);
//llStartAnimation("stand";);this was the problem line
llStartAnimation("sitting chair m06";)
}
}

touch_start(integer total_number)
{
llWhisper(0, "OnePrimChair by Domneth Designs.";);
}
}


Edited with the fix.
Thank you in advance,

~Domneth
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-30-2006 02:53
move the start animation into the runtime permissions event where you currently start stand. (which is why they stand the first time)
Domneth Dingson
Registered User
Join date: 20 Nov 2006
Posts: 126
12-30-2006 10:12
Ah, thank you so much! It works now!

Edit: Actually, now that I take a loot at it, the 'stand' doesn't make sense as to why I had to put it in there. I never wanted to stand in the first place.