Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple pose script for chairs

Till Stirling
Crazy Inventor
Join date: 31 Jul 2004
Posts: 124
02-27-2005 11:49
Since the question comes up regularly I am making my pose script open source. Please note that I am providing the script as is, without a guaranty for support or further patches! It would be nice if you left the copyright notice in the script. And if you feel very generous drop me a sample of the things you use this with ;)

CODE
// SilverDay Poser 1.0
// (c)2005 SilverDay Productions (released as OpenSource 2/2005)

vector position = <0, 0, 1>; // Adjust position here

string animation;

default
{
on_rez(integer start)
{
llResetScript();
}

state_entry()
{
llSay(0, "**** SilverDay Poser 1.0 ****");
llSitTarget(position, ZERO_ROTATION);
animation = llGetInventoryName(INVENTORY_ANIMATION, 0);
llSay(0, "Active animation: " + animation);
}

changed(integer change)
{
if(change == CHANGED_LINK)
{
key avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY)
{
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
// llStopAnimation("sit");
// llStartAnimation(animation);
}
else if (llGetPermissionsKey() != NULL_KEY)
{
llStopAnimation(animation);
}
}
}

run_time_permissions(integer perm)
{
if(perm == PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation(animation);
}
}
}
_____________________
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
Origiinal Thread
02-28-2005 00:45
/15/2e/37154/1.html

edit-back to your regularly scheduled post.

nice script, but be aware it will have problems on multi prim multi avatar chairs.
Techzen Omega
Registered User
Join date: 31 Dec 1969
Posts: 58
02-28-2005 12:19
Cool thanks will try it soon. Mind if I add your name in it with the silverday productions? was thinking of something like :

// Released by Till Stirling (c)2005 SilverDay Productions (released as OpenSource 2/2005)

Makes it allot easier to remember who was nice enough to release it and makes it easier to remember who to send my sample to. :)
_____________________
___________________________________________________

"Techzen, you definitely DO NOT suck at the forums." - Alicia Eldritch


"Do you think I'd get in trouble if I took a portable paint sprayer on a paintball field and said it was a paintball flamethrower"? "---SenorBiggles (Anandtech Forums)
Jim Bunderfeld
The Coder
Join date: 1 Mar 2004
Posts: 161
02-28-2005 13:27
Don't forget to add customized rotations..

CODE
 llSetRot(llEuler2Rot(<0,50,0>*DEG_TO_RAD)); 


Rotations in SL are made using quadrians, which not many people are familiar with, and it would take alot longer to convert our form of rotations to quadrians then just using this function.

Also if you would want to define a variable to a rotation you can actually understand use something like this...

CODE
 vector testRotation = llEuler2Rot(<0,0,90>*DEG_TO_RAD); 


I hope that helps
Till Stirling
Crazy Inventor
Join date: 31 Jul 2004
Posts: 124
03-02-2005 00:05
From: someone
Cool thanks will try it soon. Mind if I add your name in it with the silverday productions? was thinking of something like :

// Released by Till Stirling (c)2005 SilverDay Productions (released as OpenSource 2/2005)


No I do not mind :)

From: someone
nice script, but be aware it will have problems on multi prim multi avatar chairs.

It has been used on multiprim chairs without problems! For Multiavatar seats the use of a poseball is advised (Crystalshard Foo has released one of the best available as open source)

From: someone
Don't forget to add customized rotations..

Adding rotations will make the script harder to use for a non-scripter, thats why I left them out. Of course it is no problem to add them. If you want a version with custom angles contact me inworld.

Till Stirling
_____________________
Michael Psaltery
Registered User
Join date: 6 Jun 2004
Posts: 57
03-04-2005 14:46
From: Jim Bunderfeld
Don't forget to add customized rotations..

CODE
 llSetRot(llEuler2Rot(<0,50,0>*DEG_TO_RAD)); 


Rotations in SL are made using quadrians, which not many people are familiar with, and it would take alot longer to convert our form of rotations to quadrians then just using this function.

Also if you would want to define a variable to a rotation you can actually understand use something like this...

CODE
 vector testRotation = llEuler2Rot(<0,0,90>*DEG_TO_RAD); 


I hope that helps


That helps SO MUCH! You have NO IDEA how much time I've wasted with llSitTarget
trying to figure out why oh why does the avatar keep sitting at such bizarre angles and positions. Would it really hurt Linden Labs to provide some better documentation on whether input is expected in degrees or radians??? Your post was the first mention in 6 weeks here that I've seen of using Radians. Most of the time, my code has only read the value and fed that into another function, so everything was in Radians and worked fine. It's only on the few things where I'm trying to input in plain old easy-to-understand degrees that things are going haywire. WHY do they use this screwed-up quadrian system and why don't they just use templates to allow input as either quadrians OR eulers? Further, why do they have to use radians? SUCH a relief to know what's going on, esp since I can't seem to get any in-world help on scripting issues.

Thank you!
Grim Enigma
Registered User
Join date: 14 Nov 2005
Posts: 35
Frustration!
11-19-2005 19:30
I am trying to use this script as an example into my first foray of scripting and am getting nowhere. I simply with to start an animation when the avatar touches the object. So simple, I can't figure out the whole "getting permissions" aspect of it. Very confused.. Help!
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
New Discussion Thread!!!
11-22-2005 13:20
/54/42/73159/1.html
_____________________
i've got nothing. ;)
Kiss Bliss
Registered User
Join date: 2 Jan 2005
Posts: 1
I tried your simple sit script
12-17-2005 05:17
U copied it into a script and receive a syntax error - I canr figure what is wrong





From: Till Stirling
Since the question comes up regularly I am making my pose script open source. Please note that I am providing the script as is, without a guaranty for support or further patches! It would be nice if you left the copyright notice in the script. And if you feel very generous drop me a sample of the things you use this with ;)

CODE
// SilverDay Poser 1.0
// (c)2005 SilverDay Productions (released as OpenSource 2/2005)

vector position = <0, 0, 1>; // Adjust position here

string animation;

default
{
on_rez(integer start)
{
llResetScript();
}

state_entry()
{
llSay(0, "**** SilverDay Poser 1.0 ****");
llSitTarget(position, ZERO_ROTATION);
animation = llGetInventoryName(INVENTORY_ANIMATION, 0);
llSay(0, "Active animation: " + animation);
}

changed(integer change)
{
if(change == CHANGED_LINK)
{
key avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY)
{
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
// llStopAnimation("sit");
// llStartAnimation(animation);
}
else if (llGetPermissionsKey() != NULL_KEY)
{
llStopAnimation(animation);
}
}
}

run_time_permissions(integer perm)
{
if(perm == PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation(animation);
}
}
}