[slscripters] Looking to find a reliable way to tell if an attachment is speaking...

6 views
Skip to first unread message

Corvan Nansen

unread,
Dec 19, 2011, 6:04:42 PM12/19/11
to SL Scripters
I honestly thought I had is sussed, until a HUD came along and defeated my simple method.

What I have is a HUD attachment that listens to channel 0. It needs to take different action based on whether the speaker is an avatar, an object, or one of the owner's attachments.

Testing whether the speaker is an avatar or not is easy, llGetAgentSize returns a zero vector for non-avatars, and for avatars that are out of range, since I'm reacting to chat on channel 0, I know it's an object if I get a zero vector.

It gets tricker if I'm going to detect that the object is an attachment. What I've been using was llGetObjectDetails to get the object's location, and assumed that if the location == my location, then it's another attachment on the same avatar. This has worked well, except a customer of mine found a HUD they wear does not give back the same location (for a variety of reasons, I don't know what location it is returning).

Is there a reliable, reasonably simple way people have used to detect whether or not a particular key is an attachment?

Thanks much!
Corvan.

_______________________________________________
Click here to unsubscribe or manage your list subscription:
https://lists.secondlife.com/cgi-bin/mailman/listinfo/secondlifescripters

Ima Mechanique

unread,
Dec 19, 2011, 6:12:37 PM12/19/11
to secondlif...@lists.secondlife.com
> I honestly thought I had is sussed, until a HUD came along and defeated my simple method.
>
> What I have is a HUD attachment that listens to channel 0. It needs to take different action based on whether the speaker is an avatar, an object, or one of the owner's attachments.
>
> Testing whether the speaker is an avatar or not is easy, llGetAgentSize returns a zero vector for non-avatars, and for avatars that are out of range, since I'm reacting to chat on channel 0, I know it's an object if I get a zero vector.
>
> It gets tricker if I'm going to detect that the object is an attachment. What I've been using was llGetObjectDetails to get the object's location, and assumed that if the location == my location, then it's another attachment on the same avatar. This has worked well, except a customer of mine found a HUD they wear does not give back the same location (for a variety of reasons, I don't know what location it is returning).
>
> Is there a reliable, reasonably simple way people have used to detect whether or not a particular key is an attachment?

llGetAttached returns the attachment point or zero if not attached

> Thanks much!
> Corvan.
>
> _______________________________________________
> Click here to unsubscribe or manage your list subscription:
> https://lists.secondlife.com/cgi-bin/mailman/listinfo/secondlifescripters


Ima Mechanique
Check List
1) Check the documentation.
2) Drink coffee.
3) Check the documentation again, to see what I missed first time.
4) If I still can't solve it, ask if anyone else has the answer.

ima.mechanique(at)blueyonder.co.uk

Ima Mechanique

unread,
Dec 19, 2011, 6:15:39 PM12/19/11
to secondlif...@lists.secondlife.com
> > I honestly thought I had is sussed, until a HUD came along and defeated my simple method.
> >
> > What I have is a HUD attachment that listens to channel 0. It needs to take different action based on whether the speaker is an avatar, an object, or one of the owner's attachments.
> >
> > Testing whether the speaker is an avatar or not is easy, llGetAgentSize returns a zero vector for non-avatars, and for avatars that are out of range, since I'm reacting to chat on channel 0, I know it's an object if I get a zero vector.
> >
> > It gets tricker if I'm going to detect that the object is an attachment. What I've been using was llGetObjectDetails to get the object's location, and assumed that if the location == my location, then it's another attachment on the same avatar. This has worked well, except a customer of mine found a HUD they wear does not give back the same location (for a variety of reasons, I don't know what location it is returning).
> >
> > Is there a reliable, reasonably simple way people have used to detect whether or not a particular key is an attachment?
>
> llGetAttached returns the attachment point or zero if not attached

oops, just reread your question. I missed the from a key part, so ignore
this

Eloise Pasteur

unread,
Dec 19, 2011, 7:19:45 PM12/19/11
to Corvan Nansen, SL Scripters
Try if(llGetOwnerKey(id)==id) instead of the llGetAgentSize - it might be faster.

If it's an object, llSensor() is, sadly, your best bet. You can sense for the object by key. Attachments don't show, normal objects do.

There ought to be a nicer trick but I've not seen one.

http://educationaldesigns.eloisepasteur.net/
http://eloisepasteur.net/blog/

Corvan Nansen

unread,
Dec 20, 2011, 12:59:13 AM12/20/11
to Eloise Pasteur, SL Scripters
Hmm, hadn't thought of GetOwnerKey, thanks!

I hadn't thought of a sensor scan either, unfortunately for my purposes that's probably too slow... might need to just live with a few attachments that don't get detected properly.

Thanks,
Corvan

Harold Brown

unread,
Dec 20, 2011, 3:49:54 AM12/20/11
to Corvan Nansen, SL Scripters
On Mon, Dec 19, 2011 at 9:59 PM, Corvan Nansen <cor...@otherother.com> wrote:
> Hmm, hadn't thought of GetOwnerKey, thanks!
>
> I hadn't thought of a sensor scan either, unfortunately for my purposes that's probably too slow... might need to just live with a few attachments that don't get detected properly.
>
> Thanks,
> Corvan
>
> On Dec 19, 2011, at 4:19 PM, Eloise Pasteur wrote:
>
>> Try if(llGetOwnerKey(id)==id) instead of the llGetAgentSize - it might be faster.
>>
>> If it's an object, llSensor() is, sadly, your best bet. You can sense for the object by key. Attachments don't show, normal objects do.
>>
>> There ought to be a nicer trick but I've not seen one.
>>
>>
>> On 19 Dec 2011, at 23:04, Corvan Nansen wrote:
>>
>>> I honestly thought I had is sussed, until a HUD came along and defeated my simple method.
>>>
>>> What I have is a HUD attachment that listens to channel 0. It needs to take different action based on whether the speaker is an avatar, an object, or one of the owner's attachments.
>>>
>>> Testing whether the speaker is an avatar or not is easy, llGetAgentSize returns a zero vector for non-avatars, and for avatars that are out of range, since I'm reacting to chat on channel 0, I know it's an object if I get a zero vector.
>>>
>>> It gets tricker if I'm going to detect that the object is an attachment. What I've been using was llGetObjectDetails to get the object's location, and assumed that if the location == my location, then it's another attachment on the same avatar. This has worked well, except a customer of mine found a HUD they wear does not give back the same location (for a variety of reasons, I don't know what location it is returning).
>>>
>>> Is there a reliable, reasonably simple way people have used to detect whether or not a particular key is an attachment?
>>>
>>> Thanks much!
>>> Corvan.

llGetObjectPrimCount returns zero for attachments -
http://wiki.secondlife.com/wiki/LlGetObjectPrimCount

Corvan Nansen

unread,
Dec 20, 2011, 9:51:23 AM12/20/11
to Harold Brown, SL Scripters

Perfect! Thanks very very much!

Cheers,
Corvan

Reply all
Reply to author
Forward
0 new messages