Shortnote

This script was tested and works on OpenSim version 0.7.4!

OpenSim handlers time-out after a certain amount of time. The script does compile under OpenSim but provided a sufficiently large distance to travel, the state_entry event handler may time-out.

handler_blocking_fast_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() {
        llSetText("Touch to Teleport\nSkybox\n3000m\nFully furnished\nL$250/week", <1,1,0>, 1);
        llSetPos(<129.620682, 118.107315, 21.718321>);
        // 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);
        do {
            llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, nextJump(llGetPos(), fPos, 10)]);
        } while(llVecDist(llGetPos(), fPos) > 1);
        key a = llAvatarOnSitTarget();
        if(a) llUnSit(llAvatarOnSitTarget());
        state recall;
 
    }
}
 
state recall
{
    state_entry() {
        llSetTimerEvent(1.175494351E-38);
        do {
            llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, nextJump(llGetPos(), sPos, 10)]);
        } while(llVecDist(llGetPos(), sPos) > 1);
        state default;
 
    }
}

secondlife/teleport/fast_handler_blocking.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.