Difference between revisions of "LlUnSit"

From Second Life Wiki
Jump to navigation Jump to search
(l20n)
m (Replaced old <LSL> block with <source lang="lsl2">)
(14 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{LSL_Function/avatar/de|id|sim=*}}{{LSL_Function/de
{{LSL_Function
|inject-2={{Issues/SVC-924}}{{LSL_Function/avatar|id|sim=*}}
|func_id=220|func_sleep=0.0|func_energy=10.0
|func_id=220|func_sleep=0.0|func_energy=10.0
|sort=UnSit|func=llUnSit
|sort=UnSit|func=llUnSit
|p1_type=key|p1_name=id
|p1_type=key|p1_name=id
|func_footnote
|func_footnote
|func_desc=Wenn der durch '''id''' spezifizierte Benutzer auf dem Objekt sitzt, welches das Skript enthält, oder auf/über dem Land ist, dass vom {{LSLGC/de|Owner|Objekteigentümer}} besessen wird, so wird er gezwungen, aufzustehen.
|func_desc=The agent identified by {{LSLP|id}} is forced to stand up if any of the following apply:
# The agent is sitting on the scripted object
# The agent is over land owned by the scripted object's owner and/or a group the owner has land rights for.
 
|return_text
|return_text
|spec
|spec
Line 10: Line 14:
|constants
|constants
|examples=
|examples=
<lsl>//Unsit on Sit - benötigt ein sit target
<source lang="lsl2">// UnSit on Sit, Using a sit target
default
default
{
{
     state_entry()
     state_entry()
     {
     {
         llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); //Benötigt, damit llAvatarOnSitTarget funktioniert. Die Komponenten des Vektors dürfen nicht alle Null sein.
         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) //  
     changed(integer change) // Triggered when various changes are sensed.
     {
     {
         if (change & CHANGED_LINK) // etwas hat sich verändert und es hängt mit Links oder sitzenden Avataren zusammen
         if(change & CHANGED_LINK) // When an agent sits on an object they become a new link.
         {
         {
             key user = llAvatarOnSitTarget();
             key user = llAvatarOnSitTarget(); // Store the UUID of any agent sitting on the sit target.
             if (user) //das Ereignis wurde von einem sitzenden Avatar ausgelößt
             if(user) // An avatar is on the sit target.
                 llUnSit(user); //lässt den Avatar auf dem 'sit target' aufstehen
                 llUnSit(user); // Un-Sit the avatar.
         }
         }
     }
     }
}</lsl>
}</source>
<lsl>//Unsit on Sit -  benötigt kein sit target
<source lang="lsl2">// UnSit on Sit, NOT using a sit target
 
default
default
{
{
     changed(integer change) //
     changed(integer change) // Triggered when various changes are sensed.
     {
     {
         if (change & CHANGED_LINK) //etwas hat sich verändert und es hängt mit Links oder sitzenden Avataren zusammen
         if(change & CHANGED_LINK) // When an agent sits on an object they become a new link.
         {
         {
             integer link = llGetNumberOfPrims();
             integer links = 0; // Create an integer type variable.
             key id;
            if(llGetObjectPrimCount(llGetKey()) < (links = llGetNumberOfPrims())) // During the check store the number of links.
            while(llGetAgentSize(id = llGetLinkKey(link--)))
             // If the number of prims is fewer than the number of links, the last must be an avatar.
                llUnSit(id);
                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>
}</source>
<source lang="lsl2">
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();
    }
}
</source>
 
|helpers
|helpers
|also_functions={{LSL DefineRow/de||[[llAvatarOnSitTarget]]|}}
|also_functions={{LSL DefineRow||[[llAvatarOnSitTarget]]|}}
{{LSL DefineRow/de||[[llSitTarget]]|}}
{{LSL DefineRow||[[llSitTarget]]|}}
|also_events={{LSL DefineRow/de||[[changed]]|}}
|also_events={{LSL DefineRow||[[changed]]|}}
|also_articles
|also_articles
|also_tests
|also_tests
Line 54: Line 81:
|cat3
|cat3
|cat4
|cat4
|haiku={{Haiku|Beauty at the bar|Not an empty seat in sight.|Owner clears me one.}}
}}
}}

Revision as of 12:07, 22 January 2015

Summary

Function: llUnSit( key id );

The agent identified by id is forced to stand up if any of the following apply:

  1. The agent is sitting on the scripted object
  2. The agent is over land owned by the scripted object's owner and/or a group the owner has land rights for.
• key id avatar UUID that is in the same region

Examples

// 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.
        }
    }
}
// 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).
        }
    }
}
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();
    }
}

See Also

Events

•  changed

Functions

•  llAvatarOnSitTarget
•  llSitTarget

Deep Notes

All Issues

~ Search JIRA for related Issues
   llSit() - scriptable ability to force an avatar to sit on an object

Signature

function void llUnSit( key id );

Haiku

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