// Teleport 2014
// Written by Niric Moger // // Credit goes to Vincent Nacon for // http://wiki.secondlife.com/wiki/RegionSitTeleport //
// Released into the Public Domain
// Sept 2nd 2014
//
// Destination Global, taken from an objects x,y,z vector at the destination
// note ZERO_VECTOR or <0,0,0> will not work because that is used to test
vector targetPosition = <128.0, 128.0, 72.120>; // This is invalid if skybox_mode = TRUE
// Skybox Mode Globals, this gets the objects position and only sends user up or down
// set skybox_mode = TRUE or skybox_mode = FALSE
integer skybox_mode = FALSE; // set to TRUE if you want to only teleport up or down
float height = 72.120; // set this to the ground or skybox position
// Text Globals
string text = ""; // optional floating text on the teleporter, input a space if not used
vector text_color = <1.0,1.0,1.0>; // the floating text's color
// Security Access Global
integer access_mode = 1; // 1 - public; 2 - owner; 3 - group;
default
{
state_entry()
{
llSetClickAction(CLICK_ACTION_SIT); // Set touch to sit this is very important for this script
llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
llSetText(text,text_color,1.0);
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key sittingAvatar = llAvatarOnSitTarget();
integer access_granted = FALSE;
if (access_mode == 1) access_granted = TRUE;
else if (access_mode == 2)
{
if (sittingAvatar == llGetOwner())
access_granted = TRUE;
else
{
llRegionSayTo(sittingAvatar,0," sorry, owner access only.");
llUnSit(sittingAvatar);
}
}
else if (access_mode == 3)
{
if (llSameGroup(sittingAvatar))
access_granted = TRUE;
else
{
llRegionSayTo(sittingAvatar,0," sorry, group memeber access only.");
llUnSit(sittingAvatar);
}
}
if (access_granted)
{
if (skybox_mode == TRUE)
{
list details = llGetObjectDetails(sittingAvatar, ([OBJECT_NAME, OBJECT_DESC,
OBJECT_POS, OBJECT_ROT, OBJECT_VELOCITY,
OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR]));
targetPosition = llList2Vector(details,2);
}
//Test to make sure
if(llGetPos() != ZERO_VECTOR)
{
// Adding 0.25 to the z because that is half the size of default prim
// This helps keep feet from being buried in ground
targetPosition.z = height + 1.25; // destination up or down set with global variable
if(sittingAvatar)
{
vector positionToReturnTo = llGetPos();
llSetRegionPos(targetPosition);
llSleep(0.2);
llUnSit(sittingAvatar);
llSleep(0.2);
llSetRegionPos(positionToReturnTo);
}
}
else{llUnSit(sittingAvatar);llRegionSayTo(sittingAvatar,0," unsitting because of ZERO_VECTOR");}
}
}
}
} Here is a script for a group/owner/public teleporter that utilizes the llSetRegionPos function. The function llSetClickAction(CLICK_ACTION_SIT) changes the prim so when it is touched, the avatar sits on the prim, therefore eliminating the need to right click and select sit from the right click menu effectively making this a touch to teleport. To quote LlSetClickAction's CLICK_ACTION_SIT description:"When the prim is touched, the avatar sits upon it" To use as a regular teleporter simply build a prim on the ground where you want to land and get the object's <x,y,z> value and set the value of targetPosition to <x,y,z> of the destination prim. Make sure skybox mode is FALSE if you are using like a regular teleporter. I have added a Skybox mode functionality that has never been implemented as far as I know, when it is set to true it takes the position of the prim that it is in and uses that as the X and Y, while ability to set a custom Z which can be up to 4095 meters up into the sky, or set to go to the ground by taking the Z value from a prim rezzed on the ground. The security feature allows you to set it to public, group or private. If you want everyone to use it set access_mode to 1. If only you want to use it set access_mode to 2. If you want only people to use it from your group set access_mode to 3. Hope this script is useful, please comment on any problems or suggestions with it. Thanks, Niric Moger