Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Granting permissions - Is there a difference between touch and sit?

Altern8 McMillan
Registered User
Join date: 27 Mar 2007
Posts: 36
08-12-2007 15:22
Hi there,
seems I'm full of questions today. I'm just figuring the permissions system out and I am wondering if there is a difference if an avatar who sits on an object will request permissions or an avatar touches an object will request permissions. If u look at the following script and hopefully try it out, u will see that

a) the permission window occurs if the av just touches the an object
b) the permission window does not occur when the av already sits on the object

vector offset = <0.1,0.0,-1.0>;
key avatar;
key trigger;

default
{
state_entry()
{
llSitTarget(offset, ZERO_ROTATION);
}

run_time_permissions(integer perm)
{
avatar = llAvatarOnSitTarget();
if(perm & PERMISSION_TRIGGER_ANIMATION && llKey2Name(avatar) != "" && avatar == llGetPermissionsKey())
{
llOwnerSay("run_time_permission";);
trigger = avatar;
}
}

touch_start(integer tn){
avatar = llDetectedKey(0);

if(llKey2Name(avatar))
{
if(trigger != avatar)
{
llOwnerSay("trigger != avatar";);
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
}
}
}

changed(integer change)
{
if(change & CHANGED_LINK)
{
avatar = llAvatarOnSitTarget();

if(llKey2Name(avatar))
{
if(trigger != avatar)
{
llOwnerSay("trigger != avatar";);
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
}
}
else if(trigger)
{
llOwnerSay("trigger";);
if(trigger == llGetPermissionsKey())//right user?
if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)//got permissions?
if(llKey2Name(trigger)) //user in the sim? modern permision system makes this last check unnecessary.
trigger = "";
}

}
}

on_rez(integer start_param){
llResetScript();
}
}

This seems kinda strange to me, as the documentation at llStartAnimation() says:
From: someone
Triggers the animation anim. In order for this to work, the script must have the PERMISSION_TRIGGER_ANIMATION permission on an avatar.

But if u sit on the object it is possible to start the animation with no permission window at all. So in my opinion permissions are not granted.

Am I missing something here? Can anybody please enlighten me?

Thx and greet

A8
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
08-12-2007 15:51
Whether you sit or touch, you still need to do the permission request in the script.
However, with the sit, the permission is then granted automatically without prompting the user. With touch, they are prompted.

Rj
Altern8 McMillan
Registered User
Join date: 27 Mar 2007
Posts: 36
08-12-2007 16:15
Thx RJ, well this is what I figured out, too. That's why I posted the script :cool:

I was just wondering if there is a logical explanation for that. Cuz if u pass e. g. PERMISSION_DEBIT the user will be asked to grant permissions, no matter if he sits or touches (even if he is the owner of the object to sit on).

As well what I wanted to know is if there is any documentation on this especially, as I cannot find it anywhere in the wikis. Is this one of the trial-and-error features or is it just one out of 1.000 pages I haven't read so far ;)

thx a8
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
08-12-2007 16:48
The reason animation is automatically granted, is because sitting IS an animation. So by indicating you want to sit, you are saying yes I want to be animated.

But this link tells you a little more about that:

http://rpgstats.com/wiki/index.php?title=Run_time_permissions
Altern8 McMillan
Registered User
Join date: 27 Mar 2007
Posts: 36
08-12-2007 22:45
Wow RJ, this is great, thank u!

I guess I was too tired to read this sentence in the Wiki yesterday. U won't believe how often I read this page already. But ur explanation, that a sit is already an animation makes sense to me. Thx again.

greetz

a8