Difference between revisions of "RegionSitTeleport"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "{{LSL Header}} *Created by User:Vincent_Nacon ==RegionSitTeleport== It's a very simple and clean script to make quick sit/unsit teleport to given position based on reading…")
 
m (some minor readability improvements)
Line 17: Line 17:
//Just place position (in vector form) where you want to drop avatar at in the prim's description.
//Just place position (in vector form) where you want to drop avatar at in the prim's description.


default{
default
     state_entry(){
{
         llSitTarget(<0,0,0.1>,<0,0,0,1>);
     changed(integer change)
    {
         vector targetPosition = (vector)llGetObjectDesc();
 
        key sittingAvatar = llAvatarOnSitTarget();
 
        if(sittingAvatar)
        {
            vector positionToReturnTo = llGetPos();
 
            llSetRegionPos(targetPosition);
            llUnSit(id);
            llSetRegionPos(positionToReturnTo);
        }
     }
     }
     changed(integer C){
 
         vector loc= (vector)llGetObjectDesc();
     state_entry()
        key ID = llAvatarOnSitTarget();
    {
        if(ID){
         llSitTarget(<0.0, 0.0, 0.1>, <0.0, 0.0, 0.0, 1.0>);
            vector Return = llGetPos();
            llSetRegionPos(loc);
            llUnSit(ID);
            llSetRegionPos(Return);
        }
     }
     }
}
}
</lsl>
</lsl>
{{LSLC|Library|RegionSitTeleport}}
{{LSLC|Library|RegionSitTeleport}}

Revision as of 13:05, 7 October 2012

RegionSitTeleport

It's a very simple and clean script to make quick sit/unsit teleport to given position based on reading current prim's description. <lsl> //////////////////////////////////////////////////////// // Written by Vincent Nacon // Released into the Public Domain // I'm sick and tired of WarpPos and <0,0,0> bug. // 2/26/2012 ////////////////////////////////////////////////////////

//What to do? //Just place position (in vector form) where you want to drop avatar at in the prim's description.

default {

   changed(integer change)
   {
       vector targetPosition = (vector)llGetObjectDesc();
       key sittingAvatar = llAvatarOnSitTarget();
       if(sittingAvatar)
       {
           vector positionToReturnTo = llGetPos();
           llSetRegionPos(targetPosition);
           llUnSit(id);
           llSetRegionPos(positionToReturnTo);
       }
   }
   state_entry()
   {
       llSitTarget(<0.0, 0.0, 0.1>, <0.0, 0.0, 0.0, 1.0>);
   }

} </lsl>