Table of Contents

Start Functions Events Constants Types Language Articles

Function: llSameGroup

integer llSameGroup(key id)

Return whether the given object or avatar has the same active group as the current prim.

Parameters

id

The key of an agent or a prim in the same region.

Result

Returns TRUE if the user or object referenced by id is in the region and has the same group active as the prim with this script (including the group it's deeded to if deeded).

Returns FALSE if the assigned group differs, or if the user or object is not currently in the same region.

Notes

Short examples

// Set Same to TRUE if the object owner's currently active group
// is the same as that which the prim is assigned to, and
// the owner is currently in the region, and to FALSE otherwise.
integer Same = llSameGroup(llGetOwner());

Complete examples

The following script will only allow people whose active group matches the object's group to sit on the prim. It will unsit them otherwise.

llSameGroup-example.lsl
default
{
    state_entry()
    {
        llSitTarget(<0, 0, 1>, ZERO_ROTATION);
    }

    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            key id = llAvatarOnSitTarget();
            if (! llSameGroup(id))
            {
                llUnSit(id);
                llRegionSayTo(id, 0, "This seat can only be used with the correct group tag active.");
            }
        }
    }
}

See also