Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

looking for help modding Lisbeth Cohen's Long Distance Teleporter

Partington Gould
Registered User
Join date: 15 Sep 2005
Posts: 94
01-12-2007 12:03
There is an ongoing thread about this teleport script, but it has moved off in another direction (no pun intended), and I really don't want to hijack it. So please accept my apologies for re-posting here.

I've made a simple signpost style teleporter using the Long Distance TP script below. Someone clicks the sign (destination) they want and they are instantly teleported.

I have a couple of locations in a club and a mall, non of them are long distance, but I liked the speed and ease of use for clients (one click) and ease of setup for me (edit destination line).

Now, one other location is an Office, and I'm trying to find if theres a line or 2 that can be slipped into the existing script to limit it's use to either a handful of named people or one specific group.

If it just refuses to transport people not on the list, that would be ideal. Or if not, just transports anyone not on the list back to it's original position. Ideally the list would be within the script, so it doesn't have to look at a config notecard.


Thanks for any help, I learn so much just reading the questions and answers in this forum :)

CODE

/ Long distance teleport version 1.1
// ----------------------------------
// 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!
// ------------------------------------------------------------------------


//The target location .. change this to where you want to end up (x, y, z)
vector gTargetPos = <246, 181, 415>;
// 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

// Return position for tp object - no need to edit
vector gStartPos=<0,0,0>;
// 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;


// 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);
// Define commands to listen for
llListen(myChannel,"","","");
}

on_rez(integer startup_param)
{
llResetScript();
}

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")
{
llSay(0, "Usage:");
llSay(0, "");
llSay(0, "show Make teleporter visible");
llSay(0, "hide Make teleporter invisible");
llSay(0, "reset Resets teleporter script");
llSay(0, "help This text");
}
}

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)
{
// Move avatar to destination
warpPos(gTargetPos);
// Pause for 1 second
llSleep(1);
// Unsit avatar
llUnSit(gAvatarID);
// Wait 1 second more
llSleep(1);
// If teleporter should return to original position....
if (gReturnToStartPos)
{
// ... send object to its start position
warpPos(gStartPos);
}
}
}
}

}




Updated Script Posted Below
_____________________
PG - Permanently Confused and prone to Wandering
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
01-12-2007 13:06
In the

changed() { }

block, see where it gets the Avatar id of the user? Add if statements to see if that id is on the allowed list.

if that is beyond your scripting capabilities, look for me in world and I will try to get it done for you.
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
Not debugged...
01-12-2007 13:31
CODE

//At the top of the script in global scope.
list allowed = [ "Lee Ponzu", "Jorkel Karpekian"];


// in the changed() {} block


gAvatarID = llAvatarOnSitTarget();
string AvName=llKey2Name(gAvatarID); convert key to name

// *wrong* if( llListFindList( [AvName], allowed ) == -1 ) {

if( llListFindList( allowed, [Avname] ) {
llSay(0, "Sorry, " + Avname + ", you are not allowed."
return;
}
Partington Gould
Registered User
Join date: 15 Sep 2005
Posts: 94
01-12-2007 13:54
wow, thanks Lee.

That looks exactly what I was looking for.

I'll try this when I log on tonight. I was just reading the Wiki about IfElse when I saw this posted, so probably saved me a lot of headache :)


If I get it working, I'll repost the code here.
_____________________
PG - Permanently Confused and prone to Wandering
Angela Ge
Tranquility
Join date: 2 Jul 2006
Posts: 60
01-13-2007 07:52
just a very quick noobie q (want to make sure for myself):

does the script above cover mult-sims alongside an access list?

ie: if Jane does clicks on this tp script, she would be transported to locations within simA + when she clicks on other locations external to simA such as simB, simC and simD, for example?

oui?

because to my knowledge dev folks are still struggling on figuring out a way to do sim 2 sim tps apart from map hopping and LMs :P

thanks!
_____________________
"Use me, abuse me & reuse me"
Recycling is such fun!
you'd find me hanging out @ forumbdsm.com & cruising the friendfinder @ my-sl.com

Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
01-13-2007 11:24
From: Angela Ge
just a very quick noobie q (want to make sure for myself):

does the script above cover mult-sims alongside an access list?

ie: if Jane does clicks on this tp script, she would be transported to locations within simA + when she clicks on other locations external to simA such as simB, simC and simD, for example?

oui?

because to my knowledge dev folks are still struggling on figuring out a way to do sim 2 sim tps apart from map hopping and LMs :P

thanks!


The way the above teleporter works, based on warppos() function, SL thinks you're moving in increments even though it calculates all those steps very rapidly before applying them all at once, so it appears like an instant teleport. The biggest advantage of this is that it will allow you to travel distances greater than the 300m (ish) limit with a llSitTarget() based teleport, and this includes gonig into adjacent sims.

There are two drawbacks to a warppos based teleporter though. The biggest is that you cannot have your calculated path cross over a void (or crashed) sim. this means that while you can appear to bypass entire sims with a single teleport, you still need a path that would allow you to walk/fly from those two points or else your teleport will slam you into the edge of the world and you'll get stuck.

The second (and more easily worked around) issue are ban-lines. You cannot pass directly through a ban line, although you can travel over them (they extend 45m above the ground height). The simplest way to work around this is have your warppos first shoot you about 200m straight up, then over to your target destination, and finaly back down to the ground level. since warppos works very very rapidly, most 1 and 2 sim distance teleports won't have any visual effect of traveling up and over, just an instant change of scenery to your destination.

also, as a note on warppos, this is a popular way to create non-physical vehicles, as it allows for an almost unlimited top speed, and is much faster than incremented llSetPos() calls.
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Partington Gould
Registered User
Join date: 15 Sep 2005
Posts: 94
01-17-2007 21:40
Thanks to Lee.

This is the script with the ability to just allow certain people. All names are included in the script (no notecard), so obviously it's for small, fairly static lists.

CODE

// Long distance teleport version 1.1
// ----------------------------------
// 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!
// ------------------------------------------------------------------------

//List of people allowed to use this Teleporter.
list allowed = [ "Partington Gould", "Name #2", "Name #3", "just keep adding names"];
//The target location .. change this to where you want to end up (x, y, z)
vector gTargetPos = <60, 226, 24>;
// 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

// Return position for tp object - no need to edit
vector gStartPos=<0,0,0>;
// 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;


// 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);
// Define commands to listen for
llListen(myChannel,"","","");
}

on_rez(integer startup_param)
{
llResetScript();
}

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")
{
llSay(0, "Usage:");
llSay(0, "");
llSay(0, "show Make teleporter visible");
llSay(0, "hide Make teleporter invisible");
llSay(0, "reset Resets teleporter script");
llSay(0, "help This text");
}
}

changed(integer change){
if(change & CHANGED_LINK)
{
// Find id for avatar sitting on the object
//gAvatarID = llAvatarOnSitTarget();

gAvatarID = llAvatarOnSitTarget();
string AvName=llKey2Name(gAvatarID); //convert key to name
if( llListFindList( allowed, [AvName] ) == -1 )
{
llUnSit(gAvatarID);
llSay(0, "Sorry, " + AvName + ", you are not allowed.");
return;
}

// If someone sits on it...
//if(gAvatarID != NULL_KEY)
{
// Move avatar to destination
warpPos(gTargetPos);
// Pause for 1 second
llSleep(1);
// Unsit avatar
llUnSit(gAvatarID);
// Wait 1 second more
llSleep(1);
// If teleporter should return to original position....
if (gReturnToStartPos)
{
// ... send object to its start position
warpPos(gStartPos);
}
}
}
}

}
_____________________
PG - Permanently Confused and prone to Wandering