Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Automatically grant permissions for two objects to link?

Samba Aboubakar
Registered User
Join date: 28 Jan 2009
Posts: 2
04-23-2009 10:19
I want to be able to have anyone (not just the owner) be able to touch an object (A). A will touch object (B). B will then link to object (C).

All of these objects have the same owner.

Is there a way to automatically grant the permissions for B & C to link?
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-23-2009 17:36
Yes. You'll need to set PERMISSION_CHANGE_LINKS. Then create the link itself with llCreateLink(ObjectC, TRUE), where ObjectC is the UUID of Object C. See

, , and .

The bare bones of your script, placed in ObjectB, should look something like this.....

CODE

key target = NULL_KEY; // Replace NULL_KEY with the UUID of ObjectC
default
{

touch_start(integer total_number)
{
llRequestPermissions(llDetectedKey(0),PERMISSION_CHANGE_LINKS);
}

run_time_permissions(integer permissions)
{
if(permissions&PERMISSION_CHANGE_LINKS)
{
llCreateLink(target,TRUE);
}
}
}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Samba Aboubakar
Registered User
Join date: 28 Jan 2009
Posts: 2
04-24-2009 11:48
From: Rolig Loon
Yes. You'll need to set PERMISSION_CHANGE_LINKS. Then create the link itself with llCreateLink(ObjectC, TRUE), where ObjectC is the UUID of Object C. See

, , and .

The bare bones of your script, placed in ObjectB, should look something like this.....

CODE

key target = NULL_KEY; // Replace NULL_KEY with the UUID of ObjectC
default
{

touch_start(integer total_number)
{
llRequestPermissions(llDetectedKey(0),PERMISSION_CHANGE_LINKS);
}

run_time_permissions(integer permissions)
{
if(permissions&PERMISSION_CHANGE_LINKS)
{
llCreateLink(target,TRUE);
}
}
}



From looking at the script (assuming that is Object B as you stated), it seems like it is going to request permissions to change link from Object A (the object touching it), but would Object A even give a response? Would something have to be set in Object A for the response to be given to B?
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-24-2009 12:22
From: Samba Aboubakar
From looking at the script (assuming that is Object B as you stated), it seems like it is going to request permissions to change link from Object A (the object touching it), but would Object A even give a response? Would something have to be set in Object A for the response to be given to B?


OK, I'm a little confused. I thought you wanted to link Object B to Object C. I don't understand what you mean by having Object A "touch" Object B. Do you mean that you want Object A to collide with Object B and then have ObjectB link with Object C? If so, here's no clean way to do what you want. At least, I can't see one.

Unfortunately, in order to have ObjectB and ObjectC link, you have to get permission from their owner. I misunderstood from your first note that YOU were going to touch Object B. That's why I had ObjectB request permission from the person who touched it. You could rewrite the touch_start event as a collision_start event and include a test to be sure that ObjectA was the collider, but ObjectB would still have to request permission from the owner before it would link to ObjectC. ObjectA can't give permission on your behalf.

A wiser scripter may see a way to make this work, but I'm at a loss. :(
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
04-24-2009 13:51
From: Samba Aboubakar
I want to be able to have anyone (not just the owner) be able to touch an object (A). A will touch object (B). B will then link to object (C).

All of these objects have the same owner.

Is there a way to automatically grant the permissions for B & C to link?


If the permission to change links is granted, it should stay granted as long as the scripts aren't reset. So if the two objects stay rezzed in world, after the owner gives permission, they can continue to link and unlink at anyone's direction if scripted that way. However, if the item will be rezzing and resettng the script each time, permission will have to be granted each time.
_____________________
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-24-2009 14:08
From: Darien Caldwell
If the permission to change links is granted, it should stay granted as long as the scripts aren't reset. So if the two objects stay rezzed in world, after the owner gives permission, they can continue to link and unlink at anyone's direction if scripted that way. However, if the item will be rezzing each time, permission will have to be granted each time.


Aha! I didn't know that. So then it should be OK to use the sample script I wrote earlier and swap out the touch_start event for a collision event that looks like this ...

CODE

collision_start(integer total_number)
{
key ObjectA = "Put the UUID for Object A in these quotes";
if(ObjectA == llDetectedKey(0))
{
llRequestPermissions(GetOwner(),PERMISSION_CHANGE_LINKS);
}
}


Drop the script in Object B. The first time Object A collides with it, Object B should ask you, the owner, for permission to link with Object C. If what Darien says is correct, it should never have to ask again. Of course, at that point Object B is already linked to Object C, so there's no reason to ask unless you let other people unlink and relink them at will. If you were going to permit that, though, why would you go to the trouble of whacking Object B with Object A to link the first time? :confused:

ETA: Unless ...... You also scripted Object B so that you could UNlink it by hitting it with Object A (or something else). If you did that, then people could bang Object A into Object B repeatedly, linking and unlinking B-C to their hearts' content. That could be cool.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
04-24-2009 17:10
Actually that's not quite how it would need to be done. if you keep calling llRequestPermission(), it will keep asking for permission from the owner. You should only call it once, and perhaps set a flag to say "we now have permission".

Then elsewhere in the script, you would then use the llBreakLink()/llCreateLink() functions only if your permission flag is set. this can be done whenever and however you like, without the dialog coming up. But once the script is reset, the permission will be lost, and you'll have to ask for it again.

I actually made an incorrect statement initially, taking the item and re-rezzing it will not reset the permissions, unless doing so resets the script. I'm pretty sure (hopeful?) that giving the item to a new owner would also remove this permission.
_____________________