Table of Contents

Start Functions Events Constants Types Language Articles

Function: llAvatarOnLinkSitTarget

key llAvatarOnLinkSitTarget(integer link)

Get the key of the avatar occupying the sit target of the given linked prim, or NULL_KEY if none.

Parameters

An integer value defining the link number of the prim to be read. It must specify one single link.

The following special single link specification constants can be used:-

ConstantValueDescription
LINK_THIS -4 refers to the prim the script is in
LINK_ROOT 1 refers to the root prim in a multi-prim linked set

Return value

The key of the avatar occupying the sit target of the prim in the given link number, or NULL_KEY if none.

Notes

Short examples

llOwnerSay(llAvatarOnLinkSitTarget(2)); // Displays the key of the avatar occupying the sit target of link number 2

Complete examples

Here's a script that restricts the sit target for link 3 so that it can only be occupied by the owner of the prim.

llAvatarOnLinkSitTarget-example.lsl
default
{
    state_entry()
    {
        // Set a sit target for link 3, so we can use llAvatarOnLinkSitTarget
        // to detect whether an agent sat on it.
        llLinkSitTarget(3, <0, 0, 1>, ZERO_ROTATION);
    }

    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            key id = llAvatarOnLinkSitTarget(3); // read who is sitting on prim 3, if anyone
            if (id != llGetOwner() && id != NULL_KEY)
            {
                llUnSit(id);
                llRegionSayTo(id, 0, "This seat is reserved for the owner only!");
            }
        }
    }
}

See also