Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Two sit animation script in same object

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
03-30-2006 04:02
If you have two sit animation scripts in the same object, how do you keep an error from ocurring in one script when the the first AV selects the other position?
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
03-30-2006 04:06
Depends what the script is and what the error is.

It might be easier to combine them into one, as they may not be able to tell whether the av has sat on their specific prim or not. The changed event can't tell AFAIK. But I'd have to see the code really.

I can certainly think of a system which could start a different animation depending on what prim was sat on, based on link messages from the prim to a central script.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
03-30-2006 04:19
Mmm, actually, scratch that, my idea wouldn't work. Post your script anyway though.
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Pose Ball script
03-30-2006 06:13
I am just using the standard pose ball script twice, each with a different animation, but because they are in a linked object clicking on one and sitting causes the other to send a no permissions error.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-30-2006 08:22
What about this?

[EDIT] Oh, I've just realized you wanted not only to sit, but also to perform animation. Sorry. :o
_____________________
:) Seagel Neville :)
Jigsaw Partridge
A man of parts
Join date: 3 Apr 2005
Posts: 69
03-30-2006 08:27
If both scripts are in the same prim, then they will both receive the 'changed' event when the avatar sits on the prim. Poseball-type scripts <i>should</i> then either set the animation immediately (if they already have animation permission on the avatar), or request the permission and only set the animation when a later run_time_permissions event shows it has been granted. If you are getting an error message it sounds like the scripts are not checking they actually have the necessary permission before trying to set an animation.

The only way to avoid the error message would be to mod the scripts so that they only try to set the animation if they actually have permission. I guess it would still be a bit unpredictable as to which of them got it, though, which of them do you want to 'win' when the avatar sits?
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Scripts in different prims
03-30-2006 13:47
The scripts are in different prims but in a linked set. When AV sits on one the other script response with a attempting to start or stop animations witout permission error. This should not happen so I must have done someting wrong in in the pose ball script. Couch and many linked object have multiple sits without this problem.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-30-2006 14:32
From: Mod Faulkner
Couch and many linked object have multiple sits without this problem.
Those scripts should have been modified so that each one checked if someone was sitting or not on each own prim.
_____________________
:) Seagel Neville :)
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Pose Ball Scripts
03-30-2006 14:43
These are the pose ball stipts with configuration cards that are widely availble. The have a change event

if(change == CHANGED_LINK)
{
avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY)
{

and then

else
{
llStopAnimation(ANIMATION);

What happen is that when AV sits on one ball these "else" even is triggered in the other ball
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
03-30-2006 14:54
Well, doesn't 1.9 automatically stop animations (and also release permissions?) when someone stands up? So you could probably remove that "else stop animation" section of code completely, and it would still work. I haven't tested this though, so it's just a theory.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-30-2006 14:58
Hmm... I'm confused much. :D I hope this works... I don't have any confidence...

CODE
integer is_sitting;

if(change == CHANGED_LINK)
{
avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY)
{
if(is_sitting == FALSE)
{
is_sitting = TRUE;
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);

and then

else
{
if((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && is_sitting)
{
is_sitting = FALSE;
llStopAnimation(ANIMATION);
_____________________
:) Seagel Neville :)
Jigsaw Partridge
A man of parts
Join date: 3 Apr 2005
Posts: 69
03-30-2006 21:19
Sorry, I misread your post, assumed you were talking about two sit scripts in a single prim. The llGetPermissions() test Seagal shows should get rid of the problem, but for completeness you could also check (using llGetPermissionsKey()) that the avatar you have animation permission for is the same one that you are trying to start or stop the animation on.
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
It works
03-31-2006 02:53
Seagel, it works. Thank you. Jigsaw, good idea, I will add that too. Mod