Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

attach and Dettach an object by other object

GaL Soyer
Registered User
Join date: 24 Feb 2006
Posts: 47
04-05-2007 23:54
Hi :)

i want to make a hat that when i wear it a HUD is attach to change his color.
just watch and please say if i am right...ok?

i know that to do that, ill need to put the HUD in the hat's inventory and llAttachToAvatar the HUD from the inventory (right?), when i remove the hat ill use the llDetachFromAvatar on the HUD (right?)...

now, when i unwear the hat and the HUD is Dettach, i assume the HUD is going to the invetory (my inventory not the hat's inentory - right?).

ok, how can i make that the HUD will Deleted? i mean when it dettach when i remove the hat... i dont wont the HUD to go to my inventory... if i wear and unwear the hat several times my inventory will be full of many of that HUD... and this is annoyig...

thanks in advance :)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-06-2007 00:25
From: GaL Soyer
Hi :)

i want to make a hat that when i wear it a HUD is attach to change his color.
just watch and please say if i am right...ok?

i know that to do that, ill need to put the HUD in the hat's inventory and llAttachToAvatar the HUD from the inventory (right?), when i remove the hat ill use the llDetachFromAvatar on the HUD (right?)...

now, when i unwear the hat and the HUD is Dettach, i assume the HUD is going to the invetory (my inventory not the hat's inentory - right?).

ok, how can i make that the HUD will Deleted? i mean when it dettach when i remove the hat... i dont wont the HUD to go to my inventory... if i wear and unwear the hat several times my inventory will be full of many of that HUD... and this is annoyig...

thanks in advance :)



Rather than have it dettach have the HUD die using llDie()
GaL Soyer
Registered User
Join date: 24 Feb 2006
Posts: 47
04-06-2007 02:06
i red about the llDie in WIKI and there is a problem in what you say -

Caveats:
Has no effect if called from within an attachment; there is no way to delete an attachment.
To detach an object from the avatar call llDetachFromAvatar


as you see, there is o way to make the object die while it attach... and i think that the llDie doesnt work on object while he is in inventory...

what can i do?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
Sorry
04-06-2007 04:04
From: GaL Soyer
i red about the llDie in WIKI and there is a problem in what you say -

Caveats:
Has no effect if called from within an attachment; there is no way to delete an attachment.
To detach an object from the avatar call llDetachFromAvatar


as you see, there is o way to make the object die while it attach... and i think that the llDie doesnt work on object while he is in inventory...

what can i do?


Yep your right, my post was totally of the mark , guess I wasnt wide awake when I answered that one. I was thinking of normal prim objects.
Ther eis no real solution as such. You can rename teh object prior to teh dettach so you know its dead and add a ll\die in teh on rez event which should delete if you drag from inventory but really there is no fool proof solution at present.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
04-07-2007 13:19
Sadly you can't rename attached objects at the moment. You used to be able to, but it's borked.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
04-07-2007 15:57
the object rezzes the hud from its own inv
hud asks perms to attach
I type yes
Hud comes up on screen
variable "gAttached" set to true

When finished, press close command,
something like
CODE

llShout (dedicated_neg_channel, "Die, you object!)";
setPerms
llRequestPermissions (llGetOwner (), PERMISSION_ATTACH);


CODE


run_time_permissions(integer perm) {
if (perm & PERMISSION_ATTACH) {
if (!gAttached) {
llAttachToAvatar(31); // CENTRE 2
gAttached = TRUE;
} else {
llDetachFromAvatar ();
llDie ();
}

}
}


still leaves a copy of hud in your inventory