This script was tested and works on OpenSim version 0.7.4!

safe_teleport.lsl
//////////////////////////////////////////////////////////
// (c) Wizardry and Steamworks - 2012, License GPLv3    //
// Please see: http://www.gnu.org/licenses/gpl.html     //
// for legal details, rights of fair usage and          //
// the disclaimer and warranty conditions.              //
//////////////////////////////////////////////////////////
 
vector sPos = ZERO_VECTOR;
vector fPos = ZERO_VECTOR;
// Calculate next jump gate
vector nextJump(vector iPos, vector dPos, integer jumpDistance) {
    // We move 1/jumpDistance from the initial position
    // towards the final destination in the description.
    float dist = llVecDist(iPos, dPos);
    if(dist > jumpDistance) 
        return iPos + jumpDistance * (dPos-iPos) / dist;
    return nextJump(iPos, dPos, --jumpDistance);
}
 
default
{
    state_entry() {
        // Grab local position.
        sPos = llGetPos();
        llSitTarget(<0,.0,1>, ZERO_ROTATION);
    }
    changed(integer change) {
        if(change & CHANGED_LINK) {
            if(llAvatarOnSitTarget()) {
              state move;
            }
        }
    }
}
 
state move
{
    state_entry() {
        // Grab local position again.
        sPos = llGetPos();
        // Grab distance from description
        fPos = ZERO_VECTOR;
        list oDesc = llParseString2List(llGetObjectDesc(), ["<", ">", ","], []);
        fPos.x = llList2Float(oDesc, 0);
        fPos.y = llList2Float(oDesc, 1);
        fPos.z = llList2Float(oDesc, 2);
        // 1.175494351E-38 is the smallest float.
        llSetTimerEvent(1.175494351E-38);
 
    }
    timer() {
        if(llVecDist(llGetPos(), fPos) < 1) {
            llSetTimerEvent(0);
            key a = llAvatarOnSitTarget();
            if(a) llUnSit(llAvatarOnSitTarget());
            state recall;
        }
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, nextJump(llGetPos(), fPos, 10)]);
    }
}
 
state recall
{
    state_entry() {
        // 1.175494351E-38 is the smallest float.
        llSetTimerEvent(1.175494351E-38);
    }
    timer() {
        if(llVecDist(llGetPos(), sPos) < 1) {
            llSetTimerEvent(0);
            state default;
        }
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, nextJump(llGetPos(), sPos, 10)]);
    }
}