Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion Thread: Personal Teleporter

Teneo Hope
Registered User
Join date: 28 Dec 2004
Posts: 16
08-12-2005 03:58
This is a little tool I cooked up to take advantage of the llSitTarget Teleport Hack in a convient way.

Essentually one can setup a number of teleport locations each identified by a string of the users choosing. The user then can

simply say that identifier on a chat channel and an object will be rezzed that the user can sit on to take them to the desired

location.

The script will require two objects, a controller and a teleporter.

controller object
The controller object is attached to the user and contains the teleport controller script and the teleporter object.

teleporter object
This is a temporary object that will rez when need to teleport a user to a certain target then delete's itself. This object

contains the teleporter object script.

Example Commands:

/1 tp help - displays help information
/1 tp add destination_id - add's a new location named destination_id
/1 tp remove destination_id - removes a location named destination_id
/1 tp list - lists all current destinations
/1 tp destination_id - creates a teleport object to the requested destination

Teleport Controller Script
CODE

//
// SCRIPT: Teleport Controller Script
// CREATED BY: Teneo Hope
//

list destinations; // List of destination id's and their associated vectors

integer listenId; // Listener ID

string startingCommand = "tp"; // this must be said before any option (e.g /CHANNEL [starting_command] [option] [arguement])

string objectName = "Object"; // Name of object to rez that will teleport the avatar

integer CHANNEL = 1; // Chat channel to listen on

default
{
state_entry()
{
// Setup the listener
llListenRemove(listenId);
listenId = llListen(CHANNEL,"",llGetOwner(),"");
}

attach(key id)
{
// Setup the listener
llListenRemove(listenId);
listenId = llListen(CHANNEL,"",llGetOwner(),"");
}

listen(integer channel, string name, key id, string message)
{
// Parse out the request for ease of use
list params = llParseString2List(message,[" "],[]);

if(llList2String(params,0) == startingCommand)
{
if(llList2String(params,1) == "help")
{
// Display help information
llOwnerSay("Portal Help");
llOwnerSay("/" + (string)CHANNEL + " " + startingCommand + " add destination_id - Adds a new portal destination of the id destination_id");
llOwnerSay("/" + (string)CHANNEL + " " + startingCommand + " remove destination_id - Deletes a portal destination of the id destination_id");
llOwnerSay("/" + (string)CHANNEL + " " + startingCommand + " list - List all current destinations");
llOwnerSay("/" + (string)CHANNEL + " " + startingCommand + " destination_id - Create a portal stone to the selected destination.");
}
else if (llList2String(params,1) == "add")
{
// Add a new destination
if (llList2String(params,2) != "")
{
vector pos = llGetPos();
destinations = destinations + [llList2String(params,2), pos];
llOwnerSay("Added Destination: " + llList2String(params,2) + " => " + (string)pos);
}
}
else if (llList2String(params,1) == "remove")
{
// Remove a user specified destination
if (llList2String(params,2) != "")
{
integer index = llListFindList(destinations, [llList2String(params,2)]);
if(index != -1)
{
destinations = llDeleteSubList(destinations, index, index + 1);
llOwnerSay("Removed Destination: " + llList2String(params,2));
}
}
}
else if (llList2String(params,1) == "list")
{
// List all destinations available
integer i;
if(llGetListLength(destinations) > 0)
{
for (i = 0; i < llGetListLength(destinations); i+=2)
{
string name = llList2String(destinations, i);
string loc = llList2String(destinations, i+1);
llOwnerSay(name + " => " + loc);
}
}
else
{
llOwnerSay("No Destinations Available.");
}
}
else if (llList2String(params,1) != "")
{
integer index = llListFindList(destinations, [llList2String(params,1)]);
if(index != -1)
{
vector target = (vector)llList2String(destinations, index+1);
integer channel = (integer)llFrand(9999999 - 9000000) + 9000000;
vector pos = llGetPos();

if(llVecDist(pos, target) < 300.0)
{
// Create a teleporter object
// Send it the randomly generated channel to listen on so we can tell it what location to target
llRezObject(objectName, (pos + llRot2Fwd(llGetRot()) + <0,0,1>), ZERO_VECTOR, ZERO_ROTATION, channel);
llWhisper(channel, (string)target);
}
else
{
// Teleporters have a limited range of 300 meters if the distance
// to the destination is beyond that limit don't do anything.
llOwnerSay("Destination is out of range.");
}

}
}
}
}
}


Teleporter Object Script

CODE

//
// SCRIPT: Teleporter Object Script
// CREATED BY: Teneo Hope
//

vector target; // The location the av will be teleported to.
integer listenId; // Listener ID

default
{
listen(integer channel, string name, key id, string message)
{
// Target obtained
target = (vector)message;
llListenRemove(listenId);
state activate;
}

on_rez(integer start_param)
{
// When this object rezzes setup a listener to get the target
listenId = llListen(start_param,"","","");
}
}

state activate
{
state_entry()
{
// Activate capability to teleport av to target
llSetSitText("Teleport");
llSitTarget((target - llGetPos()) * (ZERO_ROTATION / llGetRot()),ZERO_ROTATION / llGetRot());
}

changed(integer change)
{
if(change & CHANGED_LINK)
{
key av = llAvatarOnSitTarget();
if(av != NULL_KEY)
{
// Teleport the avatar
llUnSit(av);
llPushObject(av,<0,0,10>,ZERO_VECTOR,FALSE);
llDie();
}
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
08-20-2005 12:05
/15/e2/57441/1.html
_____________________
i've got nothing. ;)
a lost user
Join date: ?
Posts: ?
08-30-2005 12:15
So will this work if you set up in one zone and then go to another zone you can use it to tp yourself anywhere in another zone? It sounds like a better system than the landmarks, which when you use them only get you near the landmark and then you have to fly the rest of the way. Could this be modified so you could use the locations on the land mark cards directly, so we could just tp directly to the landmark? It would be so much simpler if that could be done. Why can people give us a TP directly to themselves, and these landmark cards can't do the exact same thing? It is so inconvenient to have to then fly around , geting stuck in rezing buildings when you just want to go shopping.

This would be great if it can be used to mimic exactly a person who does a tp for you, only without having to rely on the person, just rez an object with the loc of your landmark and get sent there.

Lovepeace
Online Doesburg
absurd hero
Join date: 6 Jul 2005
Posts: 53
quick question
08-31-2005 12:24
I've been having trouble with a similar, yet much simpler teleporter script that uses llSitTarget and llUnsit: avatars become invisible to others once they teleported and only become visible once they change an article of clothing, or sit and stand up again.

Here my question: why are you giving the avatars a slight push after unsitting them? does it have anything to do with this? Seems unneccesary otherwise, or?

thx!
Teneo Hope
Registered User
Join date: 28 Dec 2004
Posts: 16
09-09-2005 12:13
Lovepeace,

This essentually just stores a list of locations but it doesn't really do cross-sim teleportation (and there are other scripts that do that). Mostly why I made was was to setup different points withing my build that I can directly teleport to but keep it dynamic enough that I can add/remove locations on the fly. I like you idea of using landmarks but no sure if it would work with what I wrote or not.

-----------------------

Online,

When testing this script I was having some troubles where when I arrived at the desired location I would fly around a bit similar to what happens when you try choose to sit on an unscripted prim no near you. The push helped prevent that from happened for the most part.
a lost user
Join date: ?
Posts: ?
09-09-2005 17:28
From: someone
Mostly why I made was was to setup different points withing my build that I can directly teleport to but keep it dynamic enough that I can add/remove locations on the fly


Eh?? so why generate a prim to sit on? This is the bit I don't see the purpose of, other than may be allowing for the rental of private rooms but your script has no mention of money, so I can only assume that this purpose was not on the agenda at the time of writing.

Anyway, please explain the reasoning behind rezzing an object to sit on.
Teneo Hope
Registered User
Join date: 28 Dec 2004
Posts: 16
09-10-2005 19:06
From: Gaz Hornpipe
Eh?? so why generate a prim to sit on? This is the bit I don't see the purpose of, other than may be allowing for the rental of private rooms but your script has no mention of money, so I can only assume that this purpose was not on the agenda at the time of writing.

Anyway, please explain the reasoning behind rezzing an object to sit on.


These scripts go in an attachment. You can't very well sit on the attachment so instead a temporary prim with the sit target is rezzed that you use to 'teleport' to the location.
Caedmon Quinn
Registered User
Join date: 13 Jun 2005
Posts: 7
11-07-2005 12:13
Is is possible to add the ablility for the TP to wait until the owner give a command to TP? For instance the owner want to take someone with them to the new location. They woud have to wait for that person to sit on the object as well before sending them on their way.
Caoimhe Armitage
Script Witch
Join date: 7 Sep 2004
Posts: 117
11-09-2005 09:56
From: Teneo Hope
These scripts go in an attachment. You can't very well sit on the attachment so instead a temporary prim with the sit target is rezzed that you use to 'teleport' to the location.


I just use an object that I sit on continually. I ave a dialog which reads targets from a notecard: it uses non-phys movement to take me wherever. Very nice and bog-simple. No need to vcalculate relative offsets or anything.

- C
Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
11-10-2005 03:26
I just used this teleport script. I like it. Its easy and does all the thinking for you. Good job.
Thraxis Epsilon
Registered User
Join date: 31 Aug 2005
Posts: 211
11-10-2005 10:23
It is a good script... I rewrote it yesterday to better suit my needs, I have a couple more functions to add but it was exactly the type of script I had a need for last week.

Some notes for people about the script.

You can spawn a teleport object that someone else can use.

Some ideas for people that I did in my script.

1. Modify the TP list to store locations by Sim, this allows you to have the same named location in multiple Sims
2. Modify the script to present a dialog of TP locations for the current Sim you are in (see #1 above).
3. List TP Locations for current Sim or All
4. Create Export / Import functions (chat) to allow you to backup your marked locations, or to share them with others.
5. Add in reading locations from Notecards
6. Modify TP by name to include a "Number of Passengers" so you can create a TP object that a fixed number of people can use, with a timed llDie for cleanup.
Trevor Langdon
Second Life Resident
Join date: 20 Oct 2004
Posts: 149
12-10-2005 13:59
Thraxis--
I like your enhancement ideas. Any chance you will make your version with your enhancements available.

--Trevor Langdon
Thraxis Epsilon
Registered User
Join date: 31 Aug 2005
Posts: 211
12-13-2005 00:00
From: Trevor Langdon
Thraxis--
I like your enhancement ideas. Any chance you will make your version with your enhancements available.

--Trevor Langdon


I'm not sure what I will do with my changes... with 1.8 around the corner... literally... I'll have to re-evaluate my needs.
Ted Sullivan
Wanta Be Scriptor
Join date: 3 Dec 2005
Posts: 4
Where is the object
12-13-2005 12:50
The script cannot seem to find the object list in the line " string objectName = "Object";". Where does it look to find it and can it be any name instead of Object.
Thraxis Epsilon
Registered User
Join date: 31 Aug 2005
Posts: 211
12-14-2005 08:26
It can be any name.

"Object" must be contained within the inventory of the Main Teleport Control object.
Trevor Langdon
Second Life Resident
Join date: 20 Oct 2004
Posts: 149
12-31-2005 14:50
Note: You can rename the "Object" to whatever you prefer; however, you also need to address the new name in the "control" script, so they match (case-sensitve).

Ted--
As mentioned you need to add the "tp object" to the content of the "tp control" prim.