Difference between revisions of "RegionSitTeleport"

From Second Life Wiki
Jump to: navigation, 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 (<lsl> tag to <source>)
 
(3 intermediate revisions by 2 users not shown)
Line 6: Line 6:
  
 
It's a very simple and clean script to make quick sit/unsit teleport to given position based on reading current prim's description.
 
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>
+
<source lang="lsl2">
 
////////////////////////////////////////////////////////
 
////////////////////////////////////////////////////////
 
//            Written by Vincent Nacon
 
//            Written by Vincent Nacon
 
//          Released into the Public Domain
 
//          Released into the Public Domain
 
//  I'm sick and tired of WarpPos and <0,0,0> bug.
 
//  I'm sick and tired of WarpPos and <0,0,0> bug.
//                    2/26/2012
+
//                    Feb 26th 2012
 
////////////////////////////////////////////////////////
 
////////////////////////////////////////////////////////
  
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)
    }
+
    {
     changed(integer C){
+
         vector targetPosition = (vector)llGetObjectDesc();
         vector loc= (vector)llGetObjectDesc();
+
 
         key ID = llAvatarOnSitTarget();
+
         key sittingAvatar = llAvatarOnSitTarget();
         if(ID){
+
 
             vector Return = llGetPos();
+
         if(sittingAvatar)
             llSetRegionPos(loc);
+
        {
             llUnSit(ID);
+
             vector positionToReturnTo = llGetPos();
             llSetRegionPos(Return);
+
 
 +
             llSetRegionPos(targetPosition);
 +
             llUnSit(sittingAvatar);
 +
             llSetRegionPos(positionToReturnTo);
 
         }
 
         }
 
     }
 
     }
}
 
  
</lsl>
+
    state_entry()
 +
    {
 +
        llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
 +
    }
 +
}
 +
</source>
 
{{LSLC|Library|RegionSitTeleport}}
 
{{LSLC|Library|RegionSitTeleport}}

Latest revision as of 19:12, 24 January 2015

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.

////////////////////////////////////////////////////////
//             Written by Vincent Nacon
//          Released into the Public Domain
//   I'm sick and tired of WarpPos and <0,0,0> bug.
//                    Feb 26th 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(sittingAvatar);
            llSetRegionPos(positionToReturnTo);
        }
    }
 
    state_entry()
    {
        llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
    }
}