CODE
//replace the three numbers in following line with the target coordinates
//teleport only works within the same sim (no crossing sim borders)
//max teleport distance around 300 meters
vector target=<119, 231, 44>;
vector offset;
default
{
on_rez(integer params)
{
llResetScript();
offset = (target- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSitTarget(offset, ZERO_ROTATION);
}
state_entry()
{
offset = (target- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSetSitText("Teleport");
llSitTarget(offset, ZERO_ROTATION);
}
changed(integer change)
{ // something changed
if (change & CHANGED_LINK)
{ // and it was a link change
llSleep(0.5); // llUnSit works better with this delay
if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me
llUnSit(llAvatarOnSitTarget()); // unsit him
}
}
}
touch_start(integer i)
{
llSay(0, "Please right-click and select Teleport");
}
}