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
Access List Access_List  

Access_List

Place this script in a platform. Then you can add and delete user names from an internal access list (see source code comments). If an avatar is not on the access list, it will be pushed back on entering the platform.

This script demonstrates some of the list functions and the access list feature could be useful for other applications as well.

Category: Access List
By : Shine Renoir
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Access_List
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Access_List_1.lsl
1 // access list script
2 // 2007 Copyright by Shine Renoir (fb@frank-buss.de)
3 // Use it for whatever you want, but keep this copyright notice
4 // and credit my name in notecards etc., if you use it in
5 // closed source objects
6 //
7 // usage: say /1 add Avatar for adding a name to the access list
8 // and say /1 del Avatar for removing a name
9
10 // reflection multiplicator, useful values: 1 .. 100
11 float pushPower = 5.0;
12
13 // current access list
14 list accessList = [];
15
16 // show access list to owner, comma separated
17 dumpAccessList()
18 {
19 llOwnerSay("current access list: " + llDumpList2String(accessList, ", "));
20 }
21
22 default
23 {
25 {
26 // register handler on chat channel 1
27 llListen(1, "", NULL_KEY, "");
28
29 // clean accessList
30 accessList = [];
31 }
32
33 collision_start(integer detected)
34 {
35 // get owner UUID and from avatar who entered the platform
36 key ownerKey = llGetOwner();
37 key detectedKey = llDetectedKey(0);
38
39 // get names
40 string owner = llKey2Name(ownerKey);
41 string avatar = llKey2Name(detectedKey);
42
43 // test, if in access list. Owner is always allowed to enter the platform
44 if(llListFindList(accessList, [avatar]) < 0 && detectedKey != ownerKey) {
45 // say something
46 llWhisper(0, "you are not on the access list, ask " + owner + " if you would like to visit this place");
47
48 // get current velocity vector and push back in opposite direction
49 vector vel = -llDetectedVel(0);
50 llPushObject(llDetectedKey(0), pushPower * vel, ZERO_VECTOR, FALSE);
51 }
52 }
53
54 listen(integer channel, string name, key id, string message)
55 {
56 // only owner can change access list
57 if(id == llGetOwner()) {
58 // command and avatar name is space separated
59 integer space = llSubStringIndex(message, " ");
60 if(space > 0) {
61 // get command and avatar name
62 string command = llGetSubString(message, 0, space - 1);
63 string avatar = llGetSubString(message, space + 1, -1);
64 if(command == "add") {
65 // if not already in access list, add name
66 if(llListFindList(accessList, [avatar]) == -1) {
67 accessList = llListInsertList(accessList, [avatar], 0);
68 }
69 } else if(command == "del") {
70 // if in access list, remove name
71 integer pos = llListFindList(accessList, [avatar]);
72 if(pos >= 0) {
73 accessList = llDeleteSubList(accessList, pos, pos);
74 dumpAccessList();
75 }
76 }
77
78 // display new access list
79 dumpAccessList();
80 }
81 }
82 }
83
84 touch_start(integer total_number)
85 {
86 // display new access list, if owner touches the platform
87 key ownerKey = llGetOwner();
88 key detectedKey = llDetectedKey(0);
89 if(detectedKey == ownerKey) {
90 dumpAccessList();
91 }
92 }
93
94 }

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