Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Water L66accessteleport  

L66accessteleport

L6.06-access-teleport.lsl

Category: Water
By : Dana Moore
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for L66accessteleport
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. L66accessteleport_1.lsl
1
2 // Copyright (c) 2008, Scripting Your World
3 // All rights reserved.
4 //
5 // Scripting Your World
6 // By Dana Moore, Michael Thome, and Dr. Karen Zita Haigh
7 // http://syw.fabulo.us
8 // http://www.amazon.com/Scripting-Your-World-Official-Second/dp/0470339837/
9 //
10 // You are permitted to use, share, and adapt this code under the
11 // terms of the Creative Commons Public License described in full
12 // at http://creativecommons.org/licenses/by/3.0/legalcode.
13 // That means you must keep the credits, do nothing to damage our
14 // reputation, and do not suggest that we endorse you or your work.
15
16 // Listing 6.6: Access-Controlled Teleport
17
18
19 // Read the access List on entry / reset.
20 // Whenever you add a new name to the access list,
21 // manually reset the script to force a full re-read
22 string gAccessCard; // name of a notecard in the object's inventory
23 integer gLine = 0; // current line number
24 key gQueryID; // id used to identify dataserver queries
25 list gAccessList = [];
26
27 vector targetPos = <12.5, 250.0, 120.50>; //The x, y, z coordinates to teleport.
28 string fltText = "1st Floor"; //label that floats above Teleport
29
30 integer onTheList(string name) {
31 return (llListFindList(gAccessList, [name]) > -1);
32 }
33
34 reset() {
35 vector target;
36 target = (targetPos- llGetPos()) * (ZERO_ROTATION / llGetRot());
38 }
39
40 default {
41 state_entry() {
42 llSetText(fltText, <1.0, 1.0, 1.0>,1.0);
43 llSetSitText(fltText);
44 // select the first notecard in the object's inventory
45 gAccessCard = llGetInventoryName(INVENTORY_NOTECARD, 0);
46 // force full read by asking for first line
47 gQueryID = llGetNotecardLine(gAccessCard, gLine);
48 }
49 dataserver(key query_id, string data) {
50 if(query_id == gQueryID) {
51 if(data != EOF) { // not at the end of the notecard
52 gAccessList += data;
53 ++gLine; // increase line count
54 gQueryID = llGetNotecardLine(gAccessCard, gLine); // get next line
55 } else {
56 llOwnerSay("Access List: " +(string)llGetListLength(gAccessList));
57 }
58 }
59 }
60 changed(integer change) {
61 key avatarKey = llAvatarOnSitTarget();
62 if((avatarKey != NULL_KEY) && (change & CHANGED_LINK)) {
63 if(onTheList(llKey2Name(avatarKey))){
64 llSleep(0.15);
65 llUnSit(avatarKey); // will be at destination
66 reset();
67 } else {
68 llWhisper(0, "Access denied. Ejecting you!");
69
70 // llTeleportAgentHome(avatarKey);
71 // llTeleportAgentHome without warning is not polite;
72 // either add a warning & delay, or use one of the
73 // other methods in SYW chapter 6, such as:
74
75 llAddToLandBanList(avatarKey, 7*24);
76 }
77 }
78 }
79 }
80 // END //

Back to the Best Free Tools in Second Life and OpenSim.