Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Attaching from content?

Funaria Moose
Registered User
Join date: 4 Sep 2005
Posts: 26
10-26-2005 04:38
Hi!

I have an object attached to the owner and I want it to attach another one from it's content. Is that possible at all?
_____________________
Moopf Murray
Moopfmerising
Join date: 7 Jan 2004
Posts: 2,448
10-26-2005 04:56
Nope, which is part of the reason I think the HUD implementation leaves a lot to be desired.
_____________________
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
10-26-2005 04:58
From: Funaria Moose
Hi!

I have an object attached to the owner and I want it to attach another one from it's content. Is that possible at all?


Yes, but as far as I know it's awkward.

You have to rez the object from inventory, then give the object an on_rez that attaches it.

It's awkward because the object has to be copy-ok (if it's no-copy, there's no way for the script to take it back afterwards), and since an attached object can't llDie(), it has to llDetach() - which means that for every time the script has run, the owner winds up with a copy of the expired attachment lying around in their inventory.

Also, the object has to ask permission to attach, and the user can refuse.
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
10-26-2005 04:59
Rez a copy of this object, and have this copy try to attach upon rez.

Code for the contained object:
CODE

default
{
on_rez(integer p)
{
if (llGetAttached() == 0) llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
}

run_time_permissions(integer p)
{
if (p) llAttachToAvatar(ATTACH_HEAD); // change that to wherever you want to attach it
}
}
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Moopf Murray
Moopfmerising
Join date: 7 Jan 2004
Posts: 2,448
10-26-2005 05:00
The serious problem with this method is that the user would end up with a whole load of the same attachments in their inventory. It's messy.
_____________________
Moopf Murray
Moopfmerising
Join date: 7 Jan 2004
Posts: 2,448
10-26-2005 05:06
And, thinking about it, it wouldn't work in no build areas either.
_____________________