Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Long distance teleport

Soen Eber
Registered User
Join date: 3 Aug 2006
Posts: 428
04-20-2007 06:58
Updated script to include an access mode of public, group, or owner to restrict teleporter use

Script allows owners to set a destination without changing the code, by editing the object description. They may also set how the text over the teleporter is displayed, and limit access.

Format: <vector>Description;color;access
Example: <43,122,55>Teleport to my shop;R;G
<vector> must be three numbers surrounded by angle brackets
Description: may be any text. The text will float above the object containing the teleport script
color : sets the color for description
any combination of the letters R,G,B,A
R=Red, G=Green, B=Blue, A=Alpha (turns invisible - so others don't know its a teleport)
multiple values are allowed, for example: RG
access: Set access to Public (P), Group (G), or Owner (O)
Allowable values are P,G, and O

Activating command mode:
Left click and hold for two seconds over the teleport object
Instructions will be displayed and you may give voice commands for a two minute interval
If the teleporting object's description has changed, activating command mode will automatically register the new location and description.

I didn't change any of the license wording because that's not an area I have a good knowledge on - could someone mod this appropriately, please?

CODE

// Long distance teleport version 1.3
// ----------------------------------
// This script is based on other public domain free scripts, so I don't
// take credit for any of the work here.
// Bits and pieces combined by Lisbeth Cohen - plus added show/hide.
//
// The basics of the script is based on Till Sterling's simple teleport
// script, with cross sim transportation routine developed by
// Keknehv Psaltery, modified by Strife Onizuka, Talarus Luan and
// Keknehv Psaltery.
// The transportation functionality is based upon Nepenthes Ixchel's
// 1000m Menu-driven Intra-Sim Teleporter
//
// Thank you to authors who have given me permission to publish this script.
// A special thank you to Keknehv Psaltery for suggesting small improvements!
//
// Realeased as public domain - you are NOT allowed to sell it without the
// permissions of all the authors I've credited above (except those who
// may have left sl at the time)!
// Feel free to use it in freebies and to give it to your friends :-)
//
// Please do not take credit for the work of all those great authors
// mentioned above!
// If you edit the script, please do not change the lines above - thanks!
// ------------------------------------------------------------------------

// This script may now be entirely configured from the object's description, eliminating the need
// to modify code. Arguments are: dest;title;color;access
// dest Destination, expressed as a vector. Example: <23,5,262>
// title This is what is displayed in floating text over the teleport prim
// color Sets color title: any combination of R, G, B, & A. R=Red, G=Green, B=Blue, A=Alpha.
// colors combine, for example RB makes the title pink while RGB makes the title white
// setting A (Alpha) makes the title invisible.
// If no color information is supplied title color will be black
// access Determines who may use the teleport: Use P (Public), G (Group), or O (Owner only)

// Text for the "pie menu"
string gSitText="Teleport";
// Define channel number to listen to user commands from
integer myChannel = 123;

// No need to edit the global variables below

//The target location .. this is set by reading the description
vector gTargetPos = <0.0, 0.0, 0.0>;
//The access mode; P=Public, G=Group only, O=Owner only - read from description
string allowed_access = "O";
// Return position for tp object - no need to edit
vector gStartPos;
// Key for avatar sitting on object, if any
key gAvatarID=NULL_KEY;
// If you don't enable this the teleport object will be left at the destination.
integer gReturnToStartPos=TRUE;
// used for triggering command entry
float elapsed = 0.0;
integer announced;
integer listenHandle;
// remember previous description so script will know to reset
string currentDescription = "";

Parse_Description()
{
string desc;
string arg;
float alpha = 0.0;
vector color = <0.0, 0.0, 0.0>;

desc = llGetObjectDesc();
list desc_list = llParseString2List(desc, [";"], []);

arg = llList2String(desc_list, 0);
gTargetPos = (vector)llList2String([arg], 0);

string text = llList2String(desc_list, 1);

arg = llList2String(desc_list, 2);
if (llSubStringIndex(arg, "R") == -1) color.x = 0.0;
else color.x = 1.0;
if (llSubStringIndex(arg, "G") == -1) color.y = 0.0;
else color.y = 1.0;
if (llSubStringIndex(arg, "B") == -1) color.z = 0.0;
else color.z = 1.0;
if (llSubStringIndex(arg, "A") == -1) alpha = 1.0;
else alpha = 0.0;
llSetText(text, color, alpha);

allowed_access = llToUpper(llList2String(desc_list, 3));
if (llSubStringIndex("PGO", allowed_access) == -1) {
llSay(0, "Unrecognized access mode '" + allowed_access + "' found in description");
llSay(0, "Allowed access modes are P, G, or O (Public, Group, Owner)");
llSay(0, "Defaulting to owner access only");
allowed_access = "O";
}
}
integer allowed(key agent)
{
if (allowed_access == "P") return TRUE;
if (allowed_access == "G") {
if (llSameGroup(agent) == TRUE) return TRUE;
if (agent == llGetOwner()) return TRUE; // owner always gets to teleport
}
if (allowed_access == "O" && (agent == llGetOwner())) return TRUE;
return FALSE;
}
sayHelp()
{
llOwnerSay("Commend Entry: Usage is:");
llOwnerSay("/123 show Make teleporter visible");
llOwnerSay("/123 hide Make teleporter invisible");
llOwnerSay("/123 reset Resets teleporter script");
llOwnerSay("/123 help This text");
llOwnerSay("You have 120 seconds to enter commands before having to touch and hold to re-engage");
announced = TRUE;
}

// This routine do the actual transport
warpPos( vector destpos)
{ //R&D by Keknehv Psaltery, 05/25/2006
//with a little pokeing by Strife, and a bit more
//some more munging by Talarus Luan
//Final cleanup by Keknehv Psaltery
// Compute the number of jumps necessary
integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
// Try and avoid stack/heap collisions
if (jumps > 100 )
jumps = 100; // 1km should be plenty
list rules = [ PRIM_POSITION, destpos ]; //The start for the rules list
integer count = 1;
while ( ( count = count << 1 ) < jumps)
rules = (rules=[]) + rules + rules; //should tighten memory use.
llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
}

default
{
state_entry()
{
// Put the teleport text in place of the Sit in the pie menu
llSetSitText(gSitText);
// Read the objects position so it can return to it after teleporting
gStartPos = llGetPos();
// Sit the avatar on the object
llSitTarget(<0,0,1>,ZERO_ROTATION);
// Read teleport destination, title, title color, access mode
Parse_Description();
// Set Listener Control
listenHandle = llListen(myChannel,"","","");
// Get current description
currentDescription = llGetObjectDesc();
}

on_rez(integer startup_param)
{
llResetScript();
}

touch_start(integer num_detected)
{
if (llDetectedKey(0) == llGetOwner()) {
elapsed = llGetAndResetTime();
announced = FALSE;
}
else {
llSay(0, "Not owner");
}
}
touch(integer num_detected)
{
if ((llDetectedKey(0) == llGetOwner()) && (announced == FALSE)) {
elapsed = llGetTime();
if (elapsed > 2.0) {
if (currentDescription == llGetObjectDesc()) {
llListenControl(listenHandle, TRUE); // ...enable listen
llSetTimerEvent(120);
sayHelp();
}
else {
llOwnerSay("Description has changed - resetting script");
llOwnerSay("You will need to press and hold again to trigger command entry after the script resets");
llResetScript();
}
}
}
}
touch_end(integer num_detected)
{
if (llDetectedKey(0) == llGetOwner()) {
announced = FALSE;
}
}
timer()
{
llOwnerSay("Command timeout");
llSetTimerEvent(0.0);
llListenControl(listenHandle, FALSE); // ...disable listen
}
listen(integer chan, string name, key id, string cmd)
{
if (cmd == "show")
{
llSetAlpha( 1, ALL_SIDES );
}
else if (cmd == "hide")
{
llSetAlpha( 0, ALL_SIDES );
}
else if (cmd == "reset")
{
llResetScript();
}
else if (cmd == "help")
{
sayHelp();
}
}

changed(integer change){
if(change & CHANGED_LINK)
{
// Find id for avatar sitting on the object
gAvatarID = llAvatarOnSitTarget();
// If someone sits on it...
if(gAvatarID != NULL_KEY) {
if (allowed(gAvatarID) == TRUE) {
warpPos(gTargetPos);
llSleep(1);
llUnSit(gAvatarID);
llSleep(1);
if (gReturnToStartPos) {
warpPos(gStartPos);
}
}
else {
llSleep(0.5); // llUnSit works better with this delay
llSay(0, "Sorry, not allowed to use!");
llUnSit(llAvatarOnSitTarget());
}
}
}
}

}
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
Par-per teleport?
05-20-2007 14:10
Hi, I have created a pay-per-teleport system, simple enough with a drop-down menu system... but only with a very simple sit-based TP script.

This is FAR and away more advanced than my scripting skills and though I might be able to figure it out in time, I am in an urgent need for a build that requires such a device.

I do not need the teleport for sale, only to complete functionality of the island. All names, etc. would still be credited - in an information sign on the island entry or in island info.
(As we have to deny any access to view the TP object properties itself ... the description couldn't very well be visible, and allow people to view the objects description, therefore obtaining the TP location for free, otherwise I would just make it modifiable, and modify this script to use a closed notecard to grab the settings from.)

I really haven't found anything for sale that equals this in simplicity of use and perfect for my needs. If it wouldn't infringe on any principles or licenses then I would really appreciate someone's help here. If not... perhaps a reference to another script that is ok to use in this instance.

Thank you for your time and efforts, just let me know. Willing to trade services and objects of my own design and making as well for this opportunity if that is some sort of equalizer for the agreement in the header.

Take care,
-Haplo Voss
Electric Valley Builders
Terraforming, Custom Textures, clothing, designs, objects and implementation.
IM: Haplo Voss
Sue Saintlouis
Registered User
Join date: 8 Dec 2006
Posts: 420
08-06-2007 14:58
Ok, this is probably a dumb question, but I won't know if I don't ask the experts.
I was looking for a tp script with multiple locations, and found this thread. Now, I only need to tp between locations that are close together, within my 8000sq. meter parcel, and from ground level to about 40 meters high.
Would this script be overkill? Should I try to find something that is not designed for long distance tps? Would a "local tp"script be less laggy (not saying this one is laggy, I have no idea)? Or does it not matter?
TIA:)!
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-06-2007 16:39
From: Sue Saintlouis
Ok, this is probably a dumb question, but I won't know if I don't ask the experts.
I was looking for a tp script with multiple locations, and found this thread. Now, I only need to tp between locations that are close together, within my 8000sq. meter parcel, and from ground level to about 40 meters high.
Would this script be overkill? Should I try to find something that is not designed for long distance tps? Would a "local tp"script be less laggy (not saying this one is laggy, I have no idea)? Or does it not matter?
TIA:)!
It's not a huge matter--it's not like the teleporter is running constantly--but in my purely subjective experience, a "warpPos"-based teleporter uses a little more sim resources, and when the sim is already in lag, it's a little bit more likely to leave the passenger in limbo for a little bit longer than a teleporter based on llSitTarget(). llSitTarget is limited to 300m, which should be plenty for this application, but that limitation is overcome by warpPos as needed for high-altitude skyboxes, sim-corner-to-corner TPs, etc.

(I'm not finding an ideal llSitTarget tp script in the library; maybe somebody else knows of a good one. Or IM me in-world sometime and I'll dust off one I threw together at some point.)
Honey Something
Texture Maker
Join date: 30 Sep 2006
Posts: 24
08-06-2007 17:02
From: Qie Niangao
It's not a huge matter--it's not like the teleporter is running constantly--but in my purely subjective experience, a "warpPos"-based teleporter uses a little more sim resources, and when the sim is already in lag, it's a little bit more likely to leave the passenger in limbo for a little bit longer than a teleporter based on llSitTarget(). llSitTarget is limited to 300m, which should be plenty for this application, but that limitation is overcome by warpPos as needed for high-altitude skyboxes, sim-corner-to-corner TPs, etc.

(I'm not finding an ideal llSitTarget tp script in the library; maybe somebody else knows of a good one. Or IM me in-world sometime and I'll dust off one I threw together at some point.)


I sent Sue my collection of free teleporters, it has every free tp I could find in it, I think she will find something she likes...check my picks in my profile for a tp to where you can find this collection (in my little Freebie Shop).
Espresso Saarinen
old geek
Join date: 22 Jan 2006
Posts: 93
LD TP via Map
08-06-2007 21:02
I wanted inter-continental TP. The only hack I have figured out so far is via the Map.

CODE
// TelePort via Map
// Espresso Saarinen 2007.07.02
//
// Just drop this script into a prim with a bunch of LandMarks.
// Touch will rotate through the LandMarks, displaying the LM name
// in hover text and also showing the Map for each.
// Choose Teleport from the Map to go to that LandMark
//
// Landmark names must be of the form
// <Display Name>, <SIM Name> (x,y,z)
// Where all punctuation, e.g. the comma, the following blank, the
// parentheses, etc. are all significant and must be there exactly
// as specified. And the parenthesized vector must be correct.


integer lmCnt; // count of landmarks in inventory
integer lmCur; // current landmark index, zero based
string lmSIM; // name of target SIM as parsed from LM
vector lmVec; // target vector as parsed from LM

display () {
string lmName = llGetInventoryName (INVENTORY_LANDMARK, lmCur);
integer start = llSubStringIndex (lmName, ", ");
integer end = llSubStringIndex (lmName, " (");
if ( (start < 1) || (end <= start) ) {
llSay (0, "LandMark name is mangled : '" + lmName + "'");
llSay (0, "Must be of form 'Display Name, SIM Name (x,y,z)'");
return;
}
string coordS = "<" + llGetSubString (lmName, end+2, -2) + ">";
lmVec = (vector)coordS;
lmSIM = llGetSubString (lmName, start+2, end-1 );
llSetText ( llGetSubString (lmName, 0, start-1), <1,1,1> , 1.0 );
}

init () {
lmCnt = llGetInventoryNumber (INVENTORY_LANDMARK);
lmCur = 0;
display ();
}

default {

on_rez (integer num) {
llResetScript ();
}

state_entry () {
init ();
}

touch_start (integer total_number) {
display ();
llMapDestination (lmSIM, lmVec, lmVec);
lmCur++;
if ( lmCur >= lmCnt )
lmCur = 0;
}

changed (integer change) {
if ( change & (CHANGED_INVENTORY | CHANGED_ALLOWED_DROP) )
init ();
}

}
Dina Vanalten
Registered User
Join date: 24 Dec 2006
Posts: 268
08-06-2007 22:40
From: Senuka Harbinger
unfortunately ban lines don't have a height limit last time I checked, and there's no way to detect wether or not you're banned on a particular parcel via script (list llGetBanList(vector pos) which would return a list of keys?), so your manual manuvering around is the only solution



I believe the banline height is 70 meters from my testing.
Keltic Thor
Registered User
Join date: 1 May 2008
Posts: 2
05-02-2008 07:38
I created a teleport system derived from the llSitTarget methods from the wiki. On some of the longer teleports, the avatar will appear underground, underwater or over 100m out at sea for about 5 seconds and then snap back to the correct location.

I implemented the Long distance teleport version 1.3 script for the same trip and am encountering very similar results. This scripts seems to produce the desired results more frequently, but much of the time you appear to be somewhere else for a few seconds before ending up at your destination.

Does anyone know of a solution for this?
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
05-03-2008 06:00
Keltic, this is a phenomenon that was introduced with recent SL "updates". My line of Beam-Me teleporters, which by the way do not have problems with ban lines in intra region teleporting, started doing the same thing. The problem seems random. Most of the time the TP works fine, and of you wait 5 seconds or so, you eventually appear at the correct location. I need to pay attention more to the pattern of when it occurs. I believe it is more prone to happening on long distance (> 300 m) teleports involving warpPos.

I don't think that map based teleporters have the problem. I'm not sure if this is a problem with the viewer or on the server side with Havoc 4, since they were both changed about the same time. It may be worth looking at the JIRA to see if anyone has reported the problem.
Nina Stepford
was lied to by LL
Join date: 26 Mar 2007
Posts: 3,373
07-13-2008 11:45
so is there an easy way to dictate avatar rotation when arriving at the tp destination?
as it is the avatar arrives facing away from the buildings front door. i would like them to face the door instead. how can i achieve this?
Soen Eber
Registered User
Join date: 3 Aug 2006
Posts: 428
07-13-2008 16:53
I haven't tested this, but I suspect that since its probably a sit-type teleport it all depends on the prim rotation and the pose. After all, when you sit down in a chair and then get up again, you're usually pointing in a consistent direction (unless the furniture is non-phantom and the physics engine gets in the way...). The only difference between sitting on a plywood cube and a sit-teleport is the teleport moves the cube around.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-15-2008 11:06
You can certainly rotate the object the avatar is sitting on (or just the avatar itself using llSetLinkPrimitiveParms()) so that the avatar is pointing in the direction you want before the unsit, but it seems that SL automatically turns the avatar when you stand up to point in the same direction the camera is facing as well. Hopefully positioning the camera will fix this, but it is possible that releasing the camera will also cause it to snap back to its previous position, causing the issue to manifest again. Good luck!
1 2