$nav
===== Function: llAvatarOnSitTarget =====
key llAvatarOnSitTarget()
Get the key of the avatar occupying the sit target of the current prim, or $lct[NULL_KEY] if none.
===== Return value =====
The key of the avatar occupying the sit target of the prim the script is in, or $lct[NULL_KEY] if none.
===== Notes =====
* This function will also return $ct[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.
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 =====
* $lfn[llAvatarOnLinkSitTarget] is the same for a specific prim in a linkset.
* $lfn[llSitTarget] sets (or clears, if the vector is ZERO_VECTOR) the sit target of the current prim.
* $lfn[llLinkSitTarget] sets (or clears, if the vector is ZERO_VECTOR) the sit target for any prim in the linkset.
* $lfn[llUnSit] unsits the given agent.
* $lfn[llGetNumberOfPrims] gets the number of prims + sitting avatars in an object.