Teleport
//Teleport v2.02 by Pablo Pharmanaut
//based on code by Cubey Terra
integer totalPos = 4; //This integer should equal total number of positions
integer currentPos = 1;
string currentpos;
vector vPos1 = <117,152,22>; //These are vectors for the positions to
vector vPos2 = <81,23, 103>; //which you wish to teleport
vector vPos3 = <83, 49.00, 29>;
vector vPos4 = <67,120,22>;
//vector vPos5 = <143.3,238.8,50.2>;
string sPos1 = "Position One"; //name of positions, if desired. This helps
string sPos2 = "Position Two"; //you to know where you are going!
string sPos3 = "Position Three";
string sPos4 = "Position Four";
//string sPos5 = "Position Five";
vector currentvPos;
setPos()
{
if (currentPos == 1)
{
currentpos = sPos1;
currentvPos = vPos1;
}
else if (currentPos == 2)
{
currentpos = sPos2;
currentvPos = vPos2;
}
else if (currentPos == 3)
{
currentpos = sPos3;
currentvPos = vPos3;
}
else if (currentPos == 4)
{
currentpos = sPos4;
currentvPos = vPos4;
}
// else if (currentPos == 5)
// {
// currentpos = sPos5;
// currentvPos = vPos5;
// }
//add else if section here with higher currentPos integer to add TP destinations.
//Don't forget to increase totalPos integer at top of script
vector pos = llGetPos();
llSetText("Teleport to "+currentpos+"\nTouch me to change destination",<1,1,1>,1.0);
vector offset = currentvPos - pos;
llSitTarget(offset, ZERO_ROTATION);
}
default
{
state_entry()
{
llSetSitText("Teleport"); //This changes HUD display from "sit" to "Teleport"
}
touch_start(integer total_number)
{
currentPos += 1;
if (currentPos > totalPos) currentPos = 1;
setPos();
}
changed(integer change)
{
if ((change & CHANGED_LINK)==CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
llUnSit(llAvatarOnSitTarget());
}
}
}
}