key llAvatarOnSitTarget()
Get the key of the avatar occupying the sit target of the current prim, or NULL_KEY if none.
The key of the avatar occupying the sit target of the prim the script is in, or NULL_KEY if none.
llOwnerSay(llAvatarOnSitTarget()); // Displays the key of the avatar occupying the sit target of this prim.
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!"); } } } }
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.