Difference between revisions of "LlUnSit"

From Second Life Wiki
Jump to navigation Jump to search
m (Informational Value Restored - Was missing information on self-target attachments)
m (Made some Clarity Revisions, moved the part about attached owned objects (back) to caveats, made the editor believe he was insane for trying to match wording)
Line 5: Line 5:
|p1_type=key|p1_name=id
|p1_type=key|p1_name=id
|func_footnote
|func_footnote
|func_desc=If the agent identified by {{LSLP|id}} is sitting on the object the script is attached to, is an attachment owned and worn by the avatar {{LSLP|id}} it's targeting, or is over land owned by the object's {{LSLGC|Owner|owner}}, the agent is forced to stand up.  
|func_desc=If the agent identified by {{LSLP|id}} is sitting on the object the script is attached to, or is over land owned by the object's {{LSLGC|Owner|owner}}, the agent {{LSLP|id}} is forced to stand up.  
|return_text
|return_text
|spec
|spec
|caveats
|caveats=If the agent {{LSLP|id}} specified is the {{LSLGC|Owner|owner}} of the object the script is attached to, and if that agent {{LSLP|id}} is wearing that object, the land ownership is ignored, and the agent {{LSLP|id}} is forced to Stand Up.
|constants
|constants
|examples=
|examples=

Revision as of 20:12, 3 July 2014

Summary

Function: llUnSit( key id );
0.0 Forced Delay
10.0 Energy

If the agent identified by id is sitting on the object the script is attached to, or is over land owned by the object's owner, the agent id is forced to stand up.

• key id avatar UUID that is in the same region

Caveats

If the agent id specified is the owner of the object the script is attached to, and if that agent id is wearing that object, the land ownership is ignored, and the agent id is forced to Stand Up.

Examples

<lsl>// UnSit on Sit, Using a sit target default {

   state_entry()
   {
       llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); // Needed for llAvatarOnSitTarget to work. The vectors components must not all be set to 0.0
   }
   changed(integer change) // Triggered when various changes are sensed.
   {
       if(change & CHANGED_LINK) // When an agent sits on an object they become a new link.
       {
           key user = llAvatarOnSitTarget(); // Store the UUID of any agent sitting on the sit target.
           if(user) // An avatar is on the sit target.
               llUnSit(user); // Un-Sit the avatar.
       }
   }

}</lsl> <lsl>// UnSit on Sit, NOT using a sit target

default {

   changed(integer change) // Triggered when various changes are sensed.
   {
       if(change & CHANGED_LINK) // When an agent sits on an object they become a new link.
       {
           integer links = 0; // Create an integer type variable.
           if(llGetObjectPrimCount(llGetKey()) < (links = llGetNumberOfPrims())) // During the check store the number of links.
           // If the number of prims is fewer than the number of links, the last must be an avatar.
               llUnSit(llGetLinkKey(links)); // Use the key of the last link to be added (the avatar) to call llUnSit().
           else
               llOwnerSay("Some kind of linking or unlinking has changed me but, I am not being sat on.");
           // llUnSit() triggers the changed event too (the number of links is reduced by 1).
       }
   }

}</lsl> <lsl> unsit_all_avatars() {

   integer objectPrimCount = llGetObjectPrimCount(llGetKey());
   integer currentLinkNumber = llGetNumberOfPrims();
   for (; objectPrimCount < currentLinkNumber; --currentLinkNumber)
       llUnSit(llGetLinkKey(currentLinkNumber));

}

default {

   touch_start(integer num_detected)
   {
       unsit_all_avatars();
   }

} </lsl> <lsl>

// Unsit the attached Avatar // Note this method is preferable to the RLV Command @unsit=force, due to it's success rate at actually completing

default {

 touch_start(integer num_detected)
 {
    if(llGetAttached()!=0) llUnSit(llGetOwner());
 }

}

</lsl>

See Also

Events

•  changed

Functions

•  llAvatarOnSitTarget
•  llSitTarget

Deep Notes

Signature

function void llUnSit( key id );

Haiku

Beauty at the bar
Not an empty seat in sight.
Owner clears me one.