Teleport+On+Click

code // Purpose // -- //  This is a quick example of how you can make a teleporter type // object using the "Sit Hack".

// Requirements // -- //  A single prim is all that is necessary for this example.

// Usage // -- //  We set up this object to "Sit on object when left clicked" making // it easier on the user. Otherwise, you could right click and chose // "sit" from the pie menu.

// GLOBALS // -- string      g_SitText   =  "Teleport";          //  This changes the text on the pie menue when rightclicked on the object vector     g_SitOffset =  <0.0, 0.0, 10.0>;    //  This is the sit offset, also considered the teleport location from the object

// EVENTS // -- default {   state_entry {       //  Set up the llSitTarget and sit text first llSetSitText(g_SitText); llSitTarget(g_SitOffset, ZERO_ROTATION); }

changed(integer change) {       key id = llAvatarOnSitTarget; if(change & CHANGED_LINK) {           //  We detect that the avatar sat on the object, so we            //  unsit them right away thus giving the illusion of a            //  teleport.

// Adjust the sleep time depending on the distance of            //  the teleport. The further the teleport, the higher // the sleep value should be. Note that the furtherst // 'teleport' distance is 300 meters. llSleep(1); llUnSit(id); }   } } code