Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

attach/reattaching an object

Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
04-03-2006 09:03
Is there a way via a script to move an object from one attachment point to another?

If I llAttachToAvatar in one place and then llAttachToAvatar in another spot, it does not seem to switch.

However, if I llDetachFromAvatar and then llAttachToAvatar, it seems to just go into inventory and then go dormant.

I also tried an attach event as in the wiki to catch it after it detatches and then attach it to the new location, but that does not seem to work. The event handler works, but it does not attach.

Any ideas?

Baron

EDIT: The wiki says that the attach event handler will catch a few CPU cycles, and it does enough to llOwnerSay, but will not reattach whether llAttachToAvatar is called before OR after the llOwnerSay. That is, trying to attach first fails even though it then goes on to OwnerSay.
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
04-04-2006 07:39
I'm guessing by the lack of response that I am barking up the wrong tree, that what I want to do is not possible. If anyone knows anything to the contrary or can think of a way that I might be able to change a simple attachment from one point to another, say from the right hand to the left, via a script, I welcome your comments and ideas!!!!

To the point of pleading,
Baron
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-04-2006 08:51
The "detach" operation doesn't "drop" the object, it takes it into inventory. Once it's in inventory it can't, obviously, do anything else.

What you could do is rez a copy of yourself and have that perform the attach. The problem is there would be an accumulation of copies of yourself in the user's inventory.

If you could call "llDie()" from an attachment you could have the duplicate attache itself and then message you, and you'd derez. Unfortunately attachments can't llDie().
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
04-04-2006 18:13
Thanks, Argent. As usual, your help is genius. I finally figured out that I can rez a new copy of the object and zero-alpha the original. Since this is only a temporary thing with what I am doing, I can then detach the copy and re-alpha the original. The only problem left is an extra inventory item. If only I could get rid of that, things would be perfect!

Baron
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-05-2006 07:41
The usual solution for what you're doing is to have two objects that message each other and re-alpha in sync.

For example, you could have "sword-in-scabbard" on the hip, and "sword in hand" in the hand. The "draw sword" command is heard by both objects, and the "sword in scabbard" goes transparent while the "sword in hand" unhides.
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
04-05-2006 07:59
Is it more taxing on the system to *very occasionally* rez a new 2-prim object for 5 seconds or to have that 2-prim object always in world but invisible?