$nav ===== Function: llAvatarOnLinkSitTarget ===== key llAvatarOnLinkSitTarget(integer link) Get the key of the avatar occupying the sit target of the given linked prim, or $lct[NULL_KEY] if none. ===== Parameters ===== === link === $linkparamsingle ===== Return value ===== The key of the avatar occupying the sit target of the prim in the given link number, or $lct[NULL_KEY] if none. ===== Notes ===== * Sitting on a single prim effectively makes a linked object of two prims. That makes the root prim immediately change its number from 0 to 1, therefore checking ''llAvatarOnLinkSitTarget(0)'' makes no sense for single prims. * 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. * $ct[NULL_KEY] is also returned if the link number is positive and out of range. * If the script is in the root prim: * Any link number between -2147483646 and -1 other than $lct[LINK_THIS] (-4) seems to refer to link 2. * Link numbers 0, -2147483647 and -2147483648 return $ct[NULL_KEY]. * If the script is in a child prim: * Any link number between -2147483647 and 1 other than $ct[LINK_THIS] (-4) seems to refer to the root prim. (The official wiki incorrectly states that ''llAvatarOnLinkSitTarget(0)'' will always be $ct[NULL_KEY]. That is only true for scripts that are in a single prim object or in the root prim of a linkset.) * Link number -2147483648 returns $ct[NULL_KEY]. ===== 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. 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 ===== * $lfn[llAvatarOnSitTarget] is the same for the current prim. Equivalent to ''llAvatarOnLinkSitTarget(LINK_THIS)''. * $lfn[llSitTarget] sets (or clears, if the vector is $lct[ZERO_VECTOR]) the sit target of the current prim. * $lfn[llLinkSitTarget] sets (or clears, if the vector is $lct[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.