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
Land L67landmonitor  

L67landmonitor

L6.07-land-monitor.lsl

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

the Zip file

Download all files for L67landmonitor
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. L67landmonitor_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.7: Land Monitor and Ejector
17
18 // uses delay before ejecting intruder
19 // see SYW chapter 6 for methods that are more polite than "ejecting"
20 // to control land access
21
22 float EJECT_DELAY = 10.0; // seconds
23 float SENSOR_REPEAT = 30.0; // seconds
24 list gIntruders;
25 default {
26 state_entry() {
27 llSensorRepeat( "", NULL_KEY, AGENT, 20, PI, SENSOR_REPEAT );
28 }
29 sensor( integer vIntFound ){
30 integer vIntCounter = 0;
31 do {
32 string vStrName = llDetectedName( vIntCounter );
33 if(llOverMyLand( llDetectedKey( vIntCounter ) )) {
34 //if(llSameGroup( llDetectedKey( vIntCounter )))
35 if(llDetectedGroup( vIntCounter )) {
36 //llWhisper(0, vStrName + " is in the same group");
37 } else {
38 llSay(0, vStrName+", this is a private estate. Please leave.");
39 llSetTimerEvent(EJECT_DELAY);
40 gIntruders += llDetectedKey( vIntCounter );
41 }
42 }
43 } while(++vIntCounter < vIntFound);
44 }
45 timer() {
46 integer i;
47 integer len = llGetListLength( gIntruders );
48 for (i=0; i<len; i++) {
49 key intruder = llList2Key( gIntruders, i );
50 if(llOverMyLand( intruder )) {
51 llEjectFromLand(intruder);
52 }
53 }
54 gIntruders = [];
56 }
57 }
58 // END //

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