////////////////////////////////////////////////////////// // (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; } }