Talk:LlGetAttached

From Second Life Wiki
Jump to navigation Jump to search

This page is missing the constants for the new attachment points.

Neck is 39, and Avatar Center is 40. Sharie Criss 11:30, 18 November 2011 (PST)

Thank you for bringing this to our attention, I've added them to the table and integrated the appropriate JIRA issues (about the missing constants). I'll try to keep an eye on this and update it when names are given to the constants. -- Strife (talk|contribs) 20:51, 19 November 2011 (PST)

Grouping together...? Caveat!

These constants aren't bitmask fields, meaning that you cannot do the following:

 
integer attachPoint = llGetAttached();
if (attachPoint & (ATTACH_HUD_CENTER_1|ATTACH_HUD_CENTER_2))    // WRONG!!! ❌
{
  // do something if this is attached as a HUD in the centre
}

This is what would be used for the changed event, for instance, but does not work here.

Instead, you have to do it like this:

 
integer attachPoint = llGetAttached();
if ((attachPoint == ATTACH_HUD_CENTER_1) || (attachPoint == ATTACH_HUD_CENTER_2))    // correct ✅
{
  // do something if this is attached as a HUD in the centre
}

It's a pain (especially if you wish to check if the attachment is among a group of similar attachment points, e.g. HUD vs. non-HUD), but that's the only way this can work.

Gwyneth Llewelyn (talk) 04:06, 5 May 2024 (PDT)