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
Traffic Traffic  

Traffic

Traffic

Category: Traffic
By : Encog Dod
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Traffic
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Traffic_1.lsl
1 // From the book:
2 //
3 // Scripting Recipes for Second Life
4 // by Jeff Heaton (Encog Dod in SL)
5 // ISBN: 160439000
6 X// Copyright 2007 by Heaton Research, Inc.
7 //
8 // This script may be freely copied and modified so long as this header
9 // remains unmodified.
10 //
11 // For more information about this book visit the following web site:
12 //
13 // http://www.heatonresearch.com/articles/series/22/
14
15 list known;
16 string parcelName;
17
18 integer DAYSEC = 86400;
19 integer visitorsYesterday;
20
21 setTimer()
22 {
23 float now = llGetWallclock();
24 integer secondsLeft = (DAYSEC - (integer)now);
25 llSetTimerEvent(secondsLeft);
26 }
27
28 default
29 {
31 {
33 }
34
36 {
37 llSensorRepeat("", "", AGENT, 20.0, PI, 1.0);
38 list lstParcelDetails = [PARCEL_DETAILS_NAME];
39
40 list lstParcelName=llGetParcelDetails(llGetPos(),lstParcelDetails);
41
42 parcelName =(string)lstParcelName;
43 setTimer();
44 }
45
46 sensor(integer detected) //A sensor returns the first 16 items detected.
47 {
48 integer i;
49
50 // Say the names of everyone the sensor detects
51 for(i=0;i<detected;i++)
52 {
53 string name = llDetectedName(i);
54
55 if( llListFindList(known,[name]) == -1 )
56 {
57 llSay(0,"Hello " + name + " welcome to " + parcelName + "." );
58 known += [name];
59 }
60 }
61 }
62
63 touch_start(integer total_number)
64 {
65 key owner = llGetOwner();
66 key who = llDetectedKey(0);
67 if( who==owner )
68 {
69 llSay(0, "Number of unique visitors today: " + (string)llGetListLength(known) );
70 llSay(0, "Number of unique visitors yesterday: " + (string)visitorsYesterday );
71 string l = llList2CSV(known);
72 llSay(0,"Visitors today:" + l );
73 }
74 }
75
76 timer()
77 {
78 llSleep(60);
79 visitorsYesterday = llGetListLength(known);
80 setTimer();
81 known = [];
82 llInstantMessage(llGetOwner(),"You had " + (string)visitorsYesterday + " today at " + parcelName );
83 }
84 }

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