RegionSitTeleport

From Second Life Wiki
Revision as of 08:55, 12 January 2013 by Jubal Earnshaw (talk | contribs) (Fix compile error (local variable 'id' was undef'd; replaced with 'sittingAvatar', which is the presumed intent))
Jump to navigation Jump to search

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

} </lsl>