Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Selective Teleporter

Nick Fortune
National Alchemist
Join date: 30 May 2003
Posts: 74
07-02-2004 01:20
This script allows people to use the "teleporter" if they are on the list set at the top of the script. If they are not on the list they simply will sit down when attempting to "teleport".


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.

string Detected;

list Allowed_avs = ["Nick Fortune", "Cricket Sunchaser", "Joe Avatar"]; //People who are allowed access

default {
state_entry() {
llVolumeDetect(TRUE);
llWhisper(0, "Selective Teleporter Active");
}

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.
llSetSitText("...");
llSitTarget(<0,0,0>, ZERO_ROTATION);
}

else{
//On the list.
llSetSitText("Teleport");
llSitTarget(<0,10,0>, ZERO_ROTATION); //<----replace vector with your target vector.
}
}
}
}

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);
}
}
}
}
Maggie Miller
~Welsh Girl~
Join date: 17 May 2003
Posts: 290
07-02-2004 08:44
Thanks, Nick!

---from a happy non-scripter :-)
Nick Fortune
National Alchemist
Join date: 30 May 2003
Posts: 74
An updated version.
07-04-2004 18:27
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.

string Detected;

list Allowed_avs = ["Nick Fortune", "Cricket Sunchaser"]; //People who are allowed access

string gTextureDefault = "4fa3c8eb-6efc-23c9-40ae-b031d8959efb";
string gTextureClear = "f54a0c32-3cd1-d49a-5b4f-7b792bebc204";

hide()
{
llSetSitText("...");
llSitTarget(<0,0,0>, ZERO_ROTATION);
llSetTexture(gTextureClear, ALL_SIDES);
}

show()
{
llSetTexture(gTextureDefault, 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");
}

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.
hide();
}

else{
//On the list.
show();
}
}
}
}

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);
hide();
}
}
}

collision_end(integer total_number) {
hide();
}
}
Nick Fortune
National Alchemist
Join date: 30 May 2003
Posts: 74
Selective Teleporter v1.3
07-11-2004 01:44
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);
}
}
a lost user
Join date: ?
Posts: ?
Original Thread
09-12-2005 14:30
/15/0b/17000/1.html
a lost user
Join date: ?
Posts: ?
09-12-2005 16:00
I was wodnering if u could chnage the acess list from avaters to groups for me. I have a sitituion where i need to add groups insted of avaters could u do that?