key llAvatarOnLinkSitTarget(integer link)
Get the key of the avatar occupying the sit target of the given linked prim, or NULL_KEY if none.
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:-
The key of the avatar occupying the sit target of the prim in the given link number, or NULL_KEY if none.
llAvatarOnLinkSitTarget(0)
makes no sense for single prims.llAvatarOnLinkSitTarget(0)
will always be NULL_KEY. That is only true for scripts that are in a single prim object or in the root prim of a linkset.)llOwnerSay(llAvatarOnLinkSitTarget(2)); // Displays the key of the avatar occupying the sit target of link number 2
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.
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!"); } } } }
llAvatarOnSitTarget
is the same for the current prim. Equivalent to llAvatarOnLinkSitTarget(LINK_THIS)
.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.