llAvatarOnLinkSitTarget
key llAvatarOnLinkSitTarget(integer link// Index of the prim in the linkset (1 for root, >1 for children), or a LINK_* flag. Values: Link
);- Returns
key- Energy
- 10
If the prim lacks a sit target or there is no avatar sitting on the prim, then NULL_KEY is returned.
Returns a key that is the UUID of the user seated on the prim.
key result = llAvatarOnLinkSitTarget(0);Caveats
Section titled “Caveats”- A prim does not have a sit target unless
llSitTarget/llLinkSitTargethas been called with a nonzero vector as the first argument. - The root link number changes from zero to one when someone sits on an unlinked prim.
- So
(llAvatarOnLinkSitTarget( 0) == NULL_KEY)is always true. Nobody ever sits on link number 0
Examples
Section titled “Examples”Example 1
17 collapsed lines
// Unseat a second avatar on this object
string one_sitter_message = "Hey! I don't take passengers.";
default{ state_entry() { // Sit target 1 is your sit target on the root prim llLinkSitTarget(1,<0.0,0.0,0.5>,ZERO_ROTATION); // Sit target 2 is the target on child prim 2, a small transparent prim inside the object llLinkSitTarget(2, <0.0,0.0,0.1>,ZERO_ROTATION); }
changed(integer change) { if (change & CHANGED_LINK) { // An avatar on child prim 2, whether seated by choice or by redirection after sit target 1 is occupied, will be unseated. if (llAvatarOnLinkSitTarget(2)) { llRegionSayTo(llAvatarOnLinkSitTarget(2),PUBLIC_CHANNEL, one_sitter_message); llUnSit(llAvatarOnLinkSitTarget(2)); } // Now pay attention to the avatar on the root prim. key agent = llAvatarOnLinkSitTarget(1); if (agent) {5 collapsed lines
llRegionSayTo(agent,PUBLIC_CHANNEL,"Hello!"); } } }}The position of an avatar on a sit target can be determined with the use of llGetObjectDetails (see llSitTarget for an example).
If an object has multiple seats (each seat has a script that sets a sit target with llSitTarget, or the linkset has a script that assigns several *llLinkSitTarget*s), the following method determines which sit target an avatar ends up at:
- If the prim that is clicked on has a sit target and that sit target is not full, that sit target is used.
- If the prim that is clicked on has no sit target, and one or more other linked prims have sit targets that are not full, the sit target of the prim with the lowest link number will be used.
History
Section titled “History”Date of Release 10/08/2011
See also
Section titled “See also”Functions
Section titled “Functions”Events
Section titled “Events”Articles
Section titled “Articles”Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.