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
Greeter v7D_Advanced_Visitor_Greeter  

v7D_Advanced_Visitor_Greeter

v7D_Advanced_Visitor_Greeter

Category: Greeter
By : Void Singer
Created: 2010-02-01 Edited: 2010-02-01
Worlds: Second Life

the Zip file

Download all files for v7D_Advanced_Visitor_Greeter
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. v7D_Advanced_Visitor_Greeter_1.lsl
1 /*//( v7-D Advanced Avatar Greeter v1.4 )//*/
2
3 /*//-- NOTE:
4 Remove Any Instances Of "(gLstAvs = []) + " Or "(gLstTms = []) + " When Compiling This
5 Script To MONO. They Are Provided For LSO Memory Preservation And Do Nothing In MONO
6 //*/
7
8 list gLstAvs; /*//-- List Of Avatars Keys Greeted --//*/
9 list vLstChk; /*//-- List Of Av Key Being Checked During Sensor Processing --//*/
10 integer vIdxLst; /*//-- Index Of Checked Item In List (reused) --//*/
11 integer gIntMax = 500; /*//-- Maximum Number of Names To Store --//*/
12 /*//-- Previous Code Line PreSet to Ease Removing Dynamic Memory Limitation Code --//*/
13
14 /*//-- Next Code Line Belongs to Dynamic Memory Limitation Section --//*/
15 integer int_MEM = 1000; /*//-- memory to preserve for safety--//*/
16
17 /*//-- Start Av Culling Section --//*/
18 integer gIntPrd = 172800; /*//-- Number Of Seconds After Detection To Store Av --//*/
19 integer vIntNow; /*//-- Integer To Store Current Time During Sensor Processing --//*/
20 list gLstTms; /*//-- List Of Most Recent Times Avs Were Greeted At --//*/
21 list vLstTmt; /*//-- List To Store Timeout During Sensor Processing --//*/
22 /*//-- End Av Culling Section --//*/
23
24 default{
26 /*//-- Next Code Line Belongs To Dynamic Memory Limitation Section --//*/
27 gIntMax = 1000; /*//-- Intial list Max --//*/
28 llSensor( "", "", AGENT, 95.0, PI ); /*//-- Pre-Fire Sensor For Immediate Results --//*/
29 llSetTimerEvent( 30.0 ); /*//-- Sensor Repeat Frequency --//*/
30 }
31
32 timer(){
33 llSensor( "", "", AGENT, 95.0, PI ); /*//-- Look For Avatars --//*/
34 }
35
36 sensor( integer vIntTtl ){
37 /*//-- Save Current Timer to Now, Then Add Period and Save To Timeout--//*/
38 vLstTmt = (list)(gIntPrd + (vIntNow = llGetUnixTime()));
39 /*//-- Previous Code Line Belongs to Av Culling Section --//*/
40 @Building;{
41 /*//-- Is This Av Already In Our List? --//*/
42 if(~(vIdxLst = llListFindList( gLstAvs, (vLstChk = (list)llDetectedKey( --vIntTtl )) ))){
43 /*//-- Delete The Old Entries & Add New Entries to Preserve Order --//*/
44 gLstAvs = llDeleteSubList( (gLstAvs = []) + gLstAvs, vIdxLst, vIdxLst ) + vLstChk;
45 /*//-- Next Code Line Belongs to Av Culling Section --//*/
46 gLstTms = llDeleteSubList( (gLstTms = []) + gLstTms, vIdxLst, vIdxLst ) + vLstTmt;
47 }
48 else{
49 /*//-- Oo Goody, Hi New Av! Add Them To The Lists & Preserve Max List Size--//*/
50 llInstantMessage( (string)vLstChk, "Hello " + llDetectedName( vIntTtl ) );
51 gLstAvs = llList2List( (gLstAvs = []) + vLstChk + gLstAvs, 0, gIntMax );
52 /*//-- Next Code Line Belongs to Av Culling Section --//*/
53 gLstTms = llList2List( (gLstTms = []) + vLstTmt + gLstTms, 0, gIntMax );
54 }
55 }if(vIntTtl) jump Building;
56
57 /*//-- Start Dynamic Memory Limitation Section --//*/
58 /*//-- Only lower Max List Size Once For Saftey --//*/
59 if(int_MEM == gIntMax){
60 /*//-- do we have plenty of room in the script? --//*/
61 if(int_MEM > llGetFreeMemory()){
62 /*//-- running out of room, set the Max list size lower --//*/
63 gIntMax = ~([] != gLstAvs);
64 }
65 }
66 /*//-- End Dynamic Memory Limitation Section --//*/
67
68 /*//-- Start Av Culling Section --//*/
69 /*//-- do we have keys? --//*/
70 if(vIdxLst = llGetListLength( gLstTms )){
71 /*//-- Do Any Need Culled? --//*/
72 if(vIntNow > llList2Integer( gLstTms, --vIdxLst )){
73 /*//-- Find The Last Index that hasn't hit timeout status --//*/
74 @TheirBones; if(--vIdxLst) if(vIntNow > llList2Integer( gLstTms, vIdxLst )) jump TheirBones;
75 /*//-- Thin the herd --//*/
76 gLstAvs = llList2List( (gLstAvs = []) + gLstAvs, 0, vIdxLst );
77 gLstTms = llList2List( (gLstTms = []) + gLstTms, 0, vIdxLst );
78 }
79 }
80 /*//-- End Av Culling Section --//*/
81 }
82 }
83
84 /*//-- License Text --//*/
85 /*// Free to copy, use, modify, distribute, or sell, with attribution. //*/
86 /*// (C)2009 (CC-BY) [ http://creativecommons.org/licenses/by/3.0 ] //*/
87 /*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/
88 /*// All usages must contain a plain text copy of the previous 2 lines. //*/
89 /*//-- --//*/

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