Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Animation permissions, sitting and attachments

Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
12-23-2005 14:09
I've noticed that I can sit on a scripted object (like a poseball) and it will animate me without explicitly asking me for permissions, even though I've never sat on that object before. Ditto for wearing an attachment that animates me. Is there an implicit granting of permissions that occurs when an avatar wears an attachment or sits on an object? if so, does this also mean that the llGetPermissionsKey changes as well?

I'm trying to write something that an av will sit on. The safe way out would be to always request permissions, but I was curious about how exactly this worked.
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
12-23-2005 14:16
In those situations, permission is granted automagically on request for certain things (animation and take-controls, I don't remember off hand if there are others.) - but (AFAIR) the permission must still be requested.
_____________________
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
12-23-2005 14:21
yar, objects must always request, or already have permissions to do things that require permission. Trigger animation, take controls, and track camera position (that it?) all get permission when you are sitting or attached to something, without the user ever seeing a dialog box asking them for permission.
_____________________
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
12-23-2005 15:11
So the safe thing to do is to ask for permissions as soon as someone sits down. That way I won't run the risk of animating the last person who sat down, and I won't end up generating dialog boxes for everyone every time?

I usually code this as:

CODE

if (llGetPermissions & PERMISSION_TRIGGER_ANIMATION)
// Do stuff
else
llRequestPermissions...

...

run_time_permissions(integer perms)
if (perms & PERMISSION_TRIGGER_ANIMATION)
// Do stuff
else
// Nag, ask again, unsit, etc.


When av A gets up and av B sits down, will this break, i.e. will (llGetPermissions & PERMISSION_TRIGGER_ANIMATION) return true, but for the wrong av, and I'll end up trying to animate the last person who sat down?

If the animation permission is always granted implicitly, then I could change that to:

CODE

changed()
if (changed link and I have an av on the sit target)
llRequestPermissions


Will this be safer? Well, I know it'll be safer, but if the permissions are granted automtically, then this won't nag everyone with a dialog box every time they sit down, in which case this would be the better approach.

Is that correct? Just making sure I understood what you guys are saying. Thanks for your help :)
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
12-23-2005 15:59
you could change it to that, or use llGetPermissionsKey to see if the person sitting is the same person you have permissions to animate :). The second way is more consistant with objects that do pop up a dialog box, but they way you proposed is simpler.
_____________________
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
12-23-2005 20:25
How about...

CODE


changed(integer change)
{
if(change & CHANGE_LINKED)
{
if(llAvatarOnSitTarget() != NULL_KEY)
{
integer _perm = llGetPermissions();
if(_perm & PERMISSION_TRIGGER_ANIMATION)
{
//do stuff
}
else
{
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
}
}
}
}



There may be one or two things wrong with that script above...I'm just doin' a quick-write
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
12-24-2005 08:07
That's how I've always done it in the past. But I'm wondering what happens when av A sits down, grants permissions, then gets up and av B sits down. Now llGetPermissions gets called again. Does it return that av B doesn't have permissions (which is what we want), or does it report that av A still has permissions, because that's the last av from whom permissions were requested? If it's the second one, it'll break. My way is slower, but will (I think) always pick up permissions for the new av.
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
12-24-2005 09:06
Hmmmm...that's a good point Ziggy...and from the way I'm reading the WIKI, it sounds like you're right. However...that is also the format I have in a mulit-sit script that has been around since I built some furniture in June...and...it's always worked. I'll get in-game sometime soon and send you the entire script.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
12-24-2005 10:26
llGetPermissions will return that it has permission if it has permission for ANY avatar. it doesn't tell you for which avatar. llGetPermissionsKey tells you what avatar it has permission for.
_____________________