CODE
//Selective Teleporter.
//Based on scripts by Nick Fortune, and concepts from a free teleport script.
//This script is FREE to all who wish to use it. No profit is to be made from this script.
//Please leave this heading intact.
//The list read in / read out is from an example provided by Christopher Omega.
//This script will provide teleport as a pie menu option for those who are on the access list and touching the object. The access list can be updated by touching the object that the script is on and saying the command words. When object is ready to listen to you it will display "Listening..." in floating text above it. The object listens for 20 seconds of silence before it shuts off its listen to help with lag.
//commands
//Add a name to the access list: tele_add::Avatar Name
//Remove a name from access list: tele_rem::Number Associated with Avatar in list.
//View the access list: tele_list
string Detected;
list Allowed_avs; //People who are allowed access
integer Listen_Flag = -1;
hearing() {
if(Listen_Flag != -1)
llListenRemove(Listen_Flag);
Listen_Flag = llListen(0,"",llGetOwner(),"");
llSetText("Listening...",<1,1,1>,0.8);
}
list_out() {
string toSay = "";
integer i = 0;
integer len = llGetListLength(Allowed_avs);
llWhisper(0, "/me Access List:");
for (i = 0; i < len; i++) {
string element = llList2String(Allowed_avs, i);
toSay += (string)i;
toSay += ": ";
toSay += element;
toSay += " ";
}
llWhisper(0, "/me "+toSay);
}
no_access() {
llSetSitText("Sit Here");
llSitTarget(<0,0,0>, ZERO_ROTATION);
llSetColor(<1,0,0>, ALL_SIDES);
}
access() {
llSetColor(<0,1,0>, ALL_SIDES);
llSetSitText("Teleport");
llSitTarget(<0,0,300>, ZERO_ROTATION); //<----replace vector with your target vector.
}
default {
state_entry() {
llVolumeDetect(TRUE);
llWhisper(0, "Selective Teleporter Active");
}
touch_start(integer num_touched) {
if (llDetectedKey(0) == llGetOwner()) {
hearing();
}
else {
llWhisper(0, "You are not authorized to perform this action");
}
}
listen(integer chan, string name, key id, string msg) {
llSetTimerEvent(20);
list params = llParseString2List(msg,["::"],[]);
string cmd = llList2String(params,0);
if (llToUpper(cmd) == "TELE_ADD") {
string name = llList2String(params, 1);
Allowed_avs += name;
llWhisper(0, "/me has added: "+name);
}
else if (llToUpper(cmd) == "TELE_REM") {
integer index = (integer)llList2String(params, 1);
string name = llList2String(Allowed_avs, index);
Allowed_avs = llDeleteSubList(Allowed_avs, index, index);
llWhisper(0, "/me has removed: "+(string)index+": "+name);
}
else if (llToUpper(cmd) == "TELE_LIST") {
list_out();
}
}
timer() {
llSetTimerEvent(0);
llListenRemove(Listen_Flag);
llSetText("",<1,1,1>,0.8);
}
collision_start(integer total_number){
integer i;
for(i=0; i<total_number; i++) {
Detected = llDetectedName(i);
if(llDetectedType(i) & AGENT) {
if(llListFindList(Allowed_avs,[Detected]) == -1) {
// Not on the list.
no_access();
}
else{
//On the list.
access();
}
}
}
}
changed(integer change) {
if (CHANGED_LINK) {
key avatar = llAvatarOnSitTarget();
if (avatar != NULL_KEY) { //Make sure there is an Avatar here.
llUnSit(avatar);
llPushObject(avatar, <0,0,10>,ZERO_VECTOR, FALSE);
no_access();
llSetColor(<0,0,0>, ALL_SIDES);
}
}
}
collision_end(integer total_number) {
no_access();
llSetColor(<0,0,0>, ALL_SIDES);
}
}
Ok... the chunk of this code that needs to be modified for this to work is:
llSitTarget(<0,0,300>, ZERO_ROTATION); //<----replace vector with your target vector.
this is found in the access function.
I was able to use this code in 1.5.6 (prior to 1.5.7). From the ground in my house, I was able to make the proper change to get to my house in the sky. The house in the sky is about 300m up, and a couple meters south and east of where the teleporter is.
I came up with:
llSitTarget(<-18.601,8.836,266.978>, ZERO_ROTATION);
and that works, at least marginally. That takes me from:
60.601
213.164
33.022
to:
42
222
300
No problem.
Certainly if I want to go down, I have my own "Go Home" teleporter, and while that's fine for me, I want to permit others on my list to also be able to get back down in a decent manner.
I wanted to put the teleporter in the corner of the room of my workplace so that it's out of the way. So, now I am up around 300m in the sky and want to get back down. I would at that point be located:
41
222
300.5
and want to go to:
62
212
33
and it seems like (at least what I did to make the original work) the proper vector would be:
llSitTarget(<21,-10,-267.5>, ZERO_ROTATION);
and that should bring me home again.... but NOOO...
I KNOW this code works because I am using the same code to go UP to the shack in the sky. Can someone shed a little light on my problem here, or offer me another script. Vector math is really hurtin my head! hahaha
Thanks in advance for someones' help! I do NOT know why this is kickin my butt!