Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

how to detect the key/name of the avatar the HUD is attached to

Varun Blitz
Registered User
Join date: 22 May 2008
Posts: 62
06-10-2008 00:02
can neone tell me how to detect the avatar name and key to whom HUD is attached.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
06-10-2008 01:16
1.You can't attach anything to the HUD that does not belong to you.
2.The only HUD you have is 'attached' to your avatar.
(mind reading is not one of my many skills)
_____________________
From Studio Dora
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
06-10-2008 01:32
To finish that thought, all attachments, HUD or otherwise, can reliably use llGetOwner() to learn who attached them. LlKey2Name will get the other half.
_____________________
Varun Blitz
Registered User
Join date: 22 May 2008
Posts: 62
06-10-2008 01:59
i can't give my HUD to someone else to use or can i ??
i mean can i do this that i remain the owner but someone else also may use it. if that is possible then i need my HUD to know to whom i am attached.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
06-10-2008 02:11
From: Varun Blitz
i can't give my HUD to someone else to use or can i ??

Yes you can, but only by giving or selling it. Then that other avatar becomes the owner.
From: someone
i mean can i do this that i remain the owner but someone else also may use it.

No, you can't attach objects you don't own.
_____________________
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
06-10-2008 07:34
eh, go back and read the first post... I think he means 'via scripting'...

to answer... use the attach event

CODE


attach (key id)
{
string name = llKey2Name(id);
}



http://www.secondscripter.com/
_____________________
My tutes
http://www.youtube.com/johanlaurasia
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
06-10-2008 08:20
The attached event will give unsatisfying results during development, or if user configuration errors can cause crashes, and so on. Save that event for things that actually need to happen at attach/detach time. Ownership checks in state_entry and changed will give a lot fewer surprises, a check for llGetAttached in somewhere like the entry can be used as a fallback fallback for when the attach event won't be available.
_____________________