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
Visitor Counter Visitor_List_Maker  

Visitor_List_Maker

Visitor List Maker.lsl

Category: Visitor Counter
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Visitor_List_Maker
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Visitor_List_Maker_1.lsl
1
2 // Global variables
3 list visitor_list;
4 float range = 10.0; // in meters
5 float rate = 1.0; // in seconds
6
7
8 // Functions
9 integer isNameOnList( string name )
10 {
11 integer len = llGetListLength( visitor_list );
12 integer i;
13 for( i = 0; i < len; i++ )
14 {
15 if( llList2String(visitor_list, i) == name )
16 {
17 return TRUE;
18 }
19 }
20 return FALSE;
21 }
22
23 // States
24 default
25 {
27 {
28 llSay(0, "Visitor List Maker started...");
29 llSay(0, "The owner can say 'help' for instructions.");
30 llSensorRepeat( "", "", AGENT, range, TWO_PI, rate );
31 llListen(0, "", llGetOwner(), "");
32 }
33
34
35 sensor( integer number_detected )
36 {
37 integer i;
38 for( i = 0; i < number_detected; i++ )
39 {
40 if( llDetectedKey( i ) != llGetOwner() )
41 {
42 string detected_name = llDetectedName( i );
43 if( isNameOnList( detected_name ) == FALSE )
44 {
45 visitor_list += detected_name;
46 }
47 }
48 }
49 }
50
51 listen( integer channel, string name, key id, string message )
52 {
53 if( id != llGetOwner() )
54 {
55 return;
56 }
57
58 if( message == "help" )
59 {
60 llSay( 0, "This object records the names of everyone who" );
61 llSay( 0, "comes within "+ (string)range + " meters." );
62 llSay( 0, "Commands the owner can say:" );
63 llSay( 0, "'help' - Shows these instructions." );
64 llSay( 0, "'say list' - Says the names of all visitors on the list.");
65 llSay( 0, "'reset list' - Removes all the names from the list." );
66 }
67 else
68 if( message == "say list" )
69 {
70 llSay( 0, "Visitor List:" );
71 integer len = llGetListLength( visitor_list );
72 integer i;
73 for( i = 0; i < len; i++ )
74 {
75 llSay( 0, llList2String(visitor_list, i) );
76 }
77 llSay( 0, "Total = " + (string)len );
78 }
79 else
80 if( message == "reset list" )
81 {
82 visitor_list = llDeleteSubList(visitor_list, 0, llGetListLength(visitor_list));
83 llSay( 0, "Done resetting.");
84 }
85 }
86 }
87
88 // END //

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