Unofficial LSL Reference

[[functions:llavataronsittarget]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

Function: llAvatarOnSitTarget

key llAvatarOnSitTarget()

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

Return value

The key of the avatar occupying the sit target of the prim the script is in, or NULL_KEY if none.

Notes

  • This function will also return NULL_KEY if there is no sit target set for the given link, even if there is someone sitting in the prim.

Short examples

llOwnerSay(llAvatarOnSitTarget()); // Displays the key of the avatar occupying the sit target of this prim.

Complete examples

Here's a script that restricts the sit target for the prim the script is dropped into, so that it can only be occupied by the owner of the prim.

llAvatarOnLinkSitTarget-example.lsl
default
{
    state_entry()
    {
        // Set a sit target for this prim, so we can use llAvatarOnSitTarget
        // to detect if an agent sat on it.
        llSitTarget(<0, 0, 1>, ZERO_ROTATION);
    }

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

See also

  • llAvatarOnLinkSitTarget is the same for a specific prim in a linkset.
  • llSitTarget sets (or clears, if the vector is ZERO_VECTOR) the sit target of the current prim.
  • llLinkSitTarget sets (or clears, if the vector is ZERO_VECTOR) the sit target for any prim in the linkset.
  • llUnSit unsits the given agent.
  • llGetNumberOfPrims gets the number of prims + sitting avatars in an object.