llSameGroup

From Second Life Wiki
Revision as of 22:32, 26 February 2012 by MANlCURED Resident (talk | contribs)
Jump to navigation Jump to search

Summary

Function: integer llSameGroup( key agent );

Returns an integer boolean, that is TRUE if agent has the same active group, otherwise FALSE

• key agent avatar UUID that is in the same region

Also returns TRUE if the object is deeded to the same active group as agent Also returns TRUE if the object is "set to" or deeded to the same group as group UUID (i.e. key OBJECT_GROUP)

Caveats

  • Also returns TRUE if the object is not set to a group (i.e. "(none)") and either the AV with the given key has no group active or the function is called with a NULL_KEY

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   Attachments only change/inherit the active group when they're "rezzed"

Examples

<lsl>// Gives inventory object only to agents with the same active group default {

   touch_start(integer total_number)
   {
       integer i;
       for (i = 0; i < total_number; i++)
       {
           if (llSameGroup(llDetectedKey(i))) // same as llDetectedGroup(i) (with llDetectedGroup, detected does not need to be in the sim)
             llGiveInventory(llDetectedKey(i), llGetInventoryName(INVENTORY_OBJECT, 0));
          else
             llSay(0, "Wrong active group!");
       }
   }

}

//edit by ïMåñï (manlcured.resident) // Feb. 27, 2012

// The following example will NOT return TRUE if the object is not set to a group (i.e. "(none)"), and/or either the AV with the given key has no group active or the function is called with a NULL_KEY.

default {

       touch_start(integer num_detected) {
             
       integer group_key = llDetectedGroup( llSameGroup( llDetectedKey( num_detected )));
       
       if ( num_detected != group_key ) {
           
           llSay( PUBLIC_CHANNEL, "Unauthorized Group!" );
           
       } else {
           
           llSay( PUBLIC_CHANNEL, "Authorized Group!" );
           
       }
   }
}</lsl>

Notes

Child Prims

It is possible for the group of a child prim to differ from that of the root prim. To build such an object it must first be unlinked, the groups set, and then relinked. Rezzing an object resets the group of the object to that of the group that the user currently has activated. Changing the group of an object changes the group for the entire object. This may only be an artifact or manifestation of VWR-5044.

See Also

Functions

•  llDetectedGroup Used in conjunction with detection events

Deep Notes

All Issues

~ Search JIRA for related Issues
   Attachments only change/inherit the active group when they're "rezzed"

Tests

•  llSameGroup Test

Signature

function integer llSameGroup( key agent );