This script was tested and works on OpenSim version 0.7.4!

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.              //
//////////////////////////////////////////////////////////
 
list jumps = [];
vector sPos = ZERO_VECTOR;
// Calculate jump gates
list jumpGates(vector iPos, vector dPos, integer jumpDistance) {
    list gates = [];
    if(jumpDistance == 0) return gates;
    float dist = llVecDist(iPos, dPos);
    if(dist > jumpDistance) {
        // We move 1/jumpDistance from the initial position
        // towards the final destination in the description.
        iPos = iPos + jumpDistance * (dPos-iPos) / dist;
        gates += iPos;
        return gates + jumpGates(iPos, dPos, jumpDistance);
    }
    return gates + jumpGates(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
        vector oPos = ZERO_VECTOR;
        list oDesc = llParseString2List(llGetObjectDesc(), ["<", ">", ","], []);
        oPos.x = llList2Float(oDesc, 0);
        oPos.y = llList2Float(oDesc, 1);
        oPos.z = llList2Float(oDesc, 2);
 
        // Calculate list of intermediary jump gates.
        jumps = jumpGates(llGetPos(), oPos, 10);
        // 1.175494351E-38 is the smallest float.
        llSetTimerEvent(1.175494351E-38);
 
    }
    timer() {
        if(llGetListLength(jumps) == 0) {
            llSetTimerEvent(0);
            key a = llAvatarOnSitTarget();
            if(a) llUnSit(llAvatarOnSitTarget());
            state recall;
        }
        vector nPos = llList2Vector(jumps, 0);
        jumps = llDeleteSubList(jumps, 0, 0);
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, nPos]);
    }
}
 
state recall
{
    state_entry() {
        jumps = jumpGates(llGetPos(), sPos, 10);
        // 1.175494351E-38 is the smallest float.
        llSetTimerEvent(1.175494351E-38);
    }
    timer() {
        if(llGetListLength(jumps) == 0) {
            llSetTimerEvent(0);
            state default;
        }
        vector nPos = llList2Vector(jumps, 0);
        jumps = llDeleteSubList(jumps, 0, 0);
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, nPos]);
    }
}

secondlife/teleport/slow_unsafe_teleport.txt ยท Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.