Join us in Outworldz at or follow us:

[Table of Contents]

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
Avatar AllowedorNot  



Category: Avatar
By : Tribal Toland
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for AllowedorNot
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. AllowedorNot_1.lsl
3 //Simple OpenSource Licence (I am trusting you to be nice)
5 //2. You can do what you want with this script including selling it in other objects and so on.
6 //You can sell it in closed source objects if you must, but please try to send any updates or
7 //improvements back to me for possible inclusion in the main trunk of development.
8 //3. You must always leave these instructions in any object created; notecard written; posting to
9 //any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
10 //already requested!)
11 //4. You must not claim that anyone apart from Tribal Toland wrote the original version of this script.
12 //Thank you for your co-operation
13 //Tribal Toland
14 //Instructions - These are not going to be too detailed
15 //because the script is open-source so you can see how
16 //it works
17 //say "/5 add=(avatar name)" To add a person to the list
18 //The name must be spelt exactly as it is on secondlife
19 //casesensitive
20 //say "/5 del=(avatar name)" To remove a person from the list
21 //say "/5 find=(avatar name)" to check if that person is on the list
22 //say "/5 clear" To wipe the list clean
23 //say "/5 read" To hear a list of all the people on the listlist allowed = [];//This decalares the global variable list allowed
24 key owner;//This decalares the global variable key owner
25 integer lkey;//This decalares the global variable integer lkey
26 integer lch;//This decalares the global variable integer lchspeak(string message)
27 {//This decalares the global function speak
28 llSay(0, message);//When this function is used the message in the brackets of the function is used in the llSay function. For example speak("Message here") is just the same as using llSay(0, "Message here").
29 }pause()
30 {//This decalares the global function speak
31 llSleep(0.5);
32 speak("Allowed list is:");
33 }
34 default
35 {//The default state state_entry()
36 { //The state_entry event occurs whenever a new state is entered, including script start/reset, and is always the first event handled.
37 llSetText("Touch Me to see if you are allowed or not",<1,1,1>,1); //Creates "hover text" of "Touch Me to see if you are allowed or not"
38 lch = 5; //Sets the integer lch declared as a global variable to 5
39 lkey = llListen(lch,"","",""); //Sets the integer lkey declared as a global variable to the listen function. This is done so we can later remove the listen if we want using. llListenRemove(lkey);
40 allowed = [];//Clears the allowed list
41 owner = llGetOwner(); //Sets the global variable to the function llGetOwner();
42 } listen(integer channel, string name, key id, string message)
43 {
44 //The listen() event handler is invoked whenever a chat message matching the constraints passed in the llListen function is heard.
45 //The channel the chat was picked up on, the name and id of the speaker and the message are passed.
46 list cmdline = llParseString2List(message,["="],[]);
47 //Turns the message into a list using "=" as a seperator between the values
48 //for example if "hello there you" was heard it would thurn that into a list
49 // such as this ["hello", "there", "you"]
50 string cmd = llList2String(cmdline,0); //this turns the first part of the list into a string
51 string param = llList2String(cmdline,1); //this turns the secondpart of the list into a string if(id == owner)
52 {//Checks the key id of the person heard againts the owners key. If they are both the same (==) then continue what is in the brackets
53 if(cmd == "add")
54 {//If the cmd is "add" if(llListFindList(allowed,[param]) < -0.5)
55 { //Cheaks the allowed list to see if the person is on it. Returns -1 if the person is not on the list
56 speak(param+" was added to the allowed list "+name); //Calls the global function speak with a message of param+" was added to the allowed list "+name
57 allowed += [param];//adds the person to the list
58 pause();//calls the global function pause()
59 speak(llDumpList2String(allowed,"n"));
60 //Calls the global function speak. lllDumpList2String turns a
61 //list into a string using the seperator between the values (in this
62 //case "n" between the values) If the list was ["foo", "bar"] this
63 //would return as "foonbarn". The n makes what is said appear on a new line
64 } else
65 { //If the person is allready on the list
66 speak("Already added to the allowed list");//Calls the global function speak
67 speak(llDumpList2String(allowed,"n"));//Calls the global function speak. And dumps the list
68 }
69 } if(cmd == "del")
70 {//If the cmd is "del"
71 integer find = llListFindList(allowed,[param]); //the integer find is the first instance of "param". Returns -1 if not found
72 if(find > -0.5)
73 {//if the integer find is bigger that minus 0.5. Continue in the brackets
74 speak(param+" was deleted from the allowed list "+name);//Calls the global function speak
75 string allow = llDumpList2String(allowed,"=");//The string allow is llDumpList2String(allowed,"=")
76 string var = param; //the string var is the param
77 integer pos = llSubStringIndex(allow,var);//the integer pos is the index where var first appears
78 allow = llDeleteSubString(allow,pos,pos+llStringLength(var) - 1);//removes the indicated string and returns the result
79 allowed = llParseString2List(allow,["="],[]);//turns the string allow into a list
80 pause();//Calls the global function pause()
81 speak(llDumpList2String(allowed,"n"));//Calls the global function speak.
82 } else
83 {
84 speak(param+" was not found on the allowed list");//Calls the global function speak.
85 }
86 } if(cmd == "find")
87 {//If the cmd is "find"
88 string test = param;//The string test is the param.
89 integer to_find = llListFindList(allowed,(list)test);//the integer to find is llListFindList(allowed,(list)test). Returns -1 if test s not found if(to_find == -1)
90 {//if test is not found
91 speak("Could not find "+test+ " on the allowed list.");//Calls the global function speak.
92 pause();//Calls the global function pause
93 speak(llDumpList2String(allowed,"n"));//Calls the global function speak.
94 } else
95 {//If they are on the list.
96 speak(test+" has been found on the allowed list");//Calls the global function speak.
97 }
98 } if(cmd == "clear")
99 {//If the cmd is "clear"
100 speak("Allowed list has been wiped clean");//Calls the global function speak.
101 allowed = [];//Clears the allowed list
102 } if(cmd == "read")
103 {//If the cmd is "read"
104 speak("People of allow list are:n"+llDumpList2String(allowed,"n"));//Calls the global function speak.
105 }
106 }
107 } touch_start(integer num_detected)
108 {//If the object is touched this event is called
109 string name = llDetectedName(0);//The string name is the person who touched the object. ( llDetectedName(0) )
110 key id = llDetectedKey(0);//The key id is the key of the person who touched the object. ( llDetectedKey(0) ) if(llListFindList(allowed,[name]) == -1 && id !=llGetOwner())
111 {
112 //If the name is not on the list and the id of the name is not the owner of the prim
113 speak("Sorry "+name+" but you do not have the correct authority to use this object! Please contact the owner");//Calls the global function speak.
114 } else
115 {//if the person who touched the object is on the list or is the owner.
116 if(id == llGetOwner())
117 {//if it is the owner
118 speak("Hello "+llKey2Name(llGetOwner())+" you are the owner of me");//Calls the global function speak.
119 } else
120 {//if not the owner but still on the allowed list
121 speak("Hello there "+name+" you are allowed to use this as you are on the allowed list. You should feel special! :D");//Calls the global function speak.
122 }
123 }
124 }//End of the touch_start event
125 }//End of the script. // end

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