Skip to content

Second Life Script: Visitor Greeter

One of the things that really gets annoying is walking into a store and being bombarded with notecards and requests to join the group.  I don’t know about you but I immediately cancel out of them and continue my way in a slightly grumpier mode.  It sort of reminds me of swatting mosquitoes.  You swat them and hope that no more come back to bother you.

I decided that I wanted something more friendly for my store.  Something that welcomed you but did so in a polite and unobtrusive way.

Here’s a great script that does that.  You place the script in a object near the doorway, and it uses chat to warmly welcome your visitor.  With chat, the visitor doesn’t have to close a notecard or close a group request.  It shows up for a little bit and then disappears.   It’s a nicer, kinder way of greeting someone.

Once a visitor has entered the store, the script will remember their name so that if they come in and out of the store  – or return the next day, the message doesn’t repeat itself.  Nice!

This is not my script.  I’ve made two small modifications.  One modification personalizes the message a bit more by using the visitors name in the greeting.  And the second modification allows for a multi-line greeting.

The original code was written by Void Singer (http://wiki.secondlife.com/wiki/User:Void_Singer), who has made a number of generous contributions to the Second Life community, and he certainly did a wonderful job with this script.  I use it in my store, and I’m quite happy with it.  So are my customers.  Thank you Void!

In the script, below, you can add your message where you find:  “ADD YOUR MESSAGE HERE”

Be sure to copy everything between the two lines.  Script follows . . .

_____________________________

/*//( v7-D Advanced Avatar Greeter v1.4.1 Annotated )//*/
/*//    (C)2009 (CC-BY) [ http://creativecommons.org/licenses/by/3.0 ]    //*/
/*//   Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ]  //*/
/*//  All usages must contain a plain text copy of the previous 2 lines.  //*/
/*//--                                                                  --//*/

//Update - Chimera Firecaster (05/10/2010): two very small modifications
//  which allows for personalizing the greeting message by including
//  the visitor's name, and also allows for a multi-line greeting
//  message (see: ADD YOUR MESSAGE HERE)

/*//-- NOTE:
 Remove Any Instances Of "(gLstAvs = []) + " Or "(gLstTms = []) + " When Compiling This
 Script To MONO. They Are Provided For LSO Memory Preservation And Do Nothing In MONO
//*/

list    gLstAvs;        /*//-- List Of Avatars Keys Greeted --//*/
list    vLstChk;        /*//-- List Of Single Av Key Checked During Sensor Processing --//*/
integer vIdxLst;        /*//-- Index Of Checked Item In List (reused) --//*/
integer gIntMax = 500;  /*//-- Maximum Number of Names To Store --//*/
 /*//-- Previous Code Line PreSet to Ease Removing Dynamic Memory Limitation Code --//*/

 /*//-- Next Code Line  Belongs to Dynamic Memory Limitation Section --//*/
integer int_MEM = 1000; /*//-- memory to preserve for safety (Needs to be > ~700)--//*/

 /*//-- Start Av Culling Section --//*/
integer gIntPrd = 172800; /*//-- Number Of Seconds After Detection To Store Av --//*/
integer vIntNow;          /*//-- Integer To Store Current Time During Sensor Processing --//*/
list    gLstTms;          /*//-- List Of Most Recent Times Avs Were Greeted At --//*/
list    vLstTmt;          /*//-- List To Store Timeout During Sensor Processing --//*/
 /*//-- End Av Culling Section --//*/

default{
 state_entry(){
 /*//-- Next Code Line Belongs To Dynamic Memory Limitation Section --//*/
 gIntMax = int_MEM;                   /*//-- Override Max if Dynamic Memory Limitation is in use --//*/
 llSensor( "", "", AGENT, 95.0, PI ); /*//-- Pre-Fire Sensor For Immediate Results --//*/
 llSetTimerEvent( 30.0 );             /*//-- Sensor Repeat Frequency --//*/
 }

 timer(){
 llSensor( "", "", AGENT, 95.0, PI ); /*//-- Look For Avatars --//*/
 }

 sensor( integer vIntTtl ){
 /*//-- Save Current Timer to Now, Then Add Period and Save To Timeout--//*/
 vLstTmt = (list)(gIntPrd + (vIntNow = llGetUnixTime()));
 /*//-- Previous Code Line Belongs to Av Culling Section --//*/
 @Building;{
 /*//-- Is This Av Already In Our List? --//*/
 if (~(vIdxLst = llListFindList( gLstAvs, (vLstChk = (list)llDetectedKey( --vIntTtl )) ))){
 /*//-- Delete The Old Entries & Add New Entries to Preserve Order --//*/
 gLstAvs = llDeleteSubList( (gLstAvs = []) + gLstAvs, vIdxLst, vIdxLst ) + vLstChk;
 /*//-- Next Code Line Belongs to Av Culling Section --//*/
 gLstTms = llDeleteSubList( (gLstTms = []) + gLstTms, vIdxLst, vIdxLst ) + vLstTmt;
 }
 else{
 /*//-- Oo Goody, Hi New Av! Add Them To The Lists & Preserve Max List Size--//*/

// -------
//ADD YOUR MESSAGE HERE
//Delete any "llInstantMessage" lines that you don't need
//If you don't want to include the visitor's name remove this: + llDetectedName( vIntTtl )+"!"
 llInstantMessage( (string)vLstChk, "Greetings " + llDetectedName( vIntTtl )+"!" );
 llInstantMessage( (string)vLstChk, "   Second line of your message - insert your text here" );
 llInstantMessage( (string)vLstChk, "   Third line of your message - insert your text here" );
 llInstantMessage( (string)vLstChk, "   Fourth line of your message - insert your text here");
 llInstantMessage( (string)vLstChk, "   Fifth line of your message - insert your text here" );
 gLstAvs = llList2List( (gLstAvs = []) + vLstChk + gLstAvs, 0, gIntMax );
 /*//-- Next Code Line Belongs to Av Culling Section --//*/
 gLstTms = llList2List( (gLstTms = []) + vLstTmt + gLstTms, 0, gIntMax );
 }
 }if (vIntTtl) jump Building;

 /*//-- Start Dynamic Memory Limitation Section --//*/
 /*//-- Only lower Max List Size Once For Saftey --//*/
 if (int_MEM == gIntMax){
 /*//-- do we have plenty of room in the script? --//*/
 if (int_MEM > llGetFreeMemory()){
 /*//-- running out of room, set the Max list size lower --//*/
 gIntMax = ~([] != gLstAvs);
 }
 }
 /*//-- End Dynamic Memory Limitation Section --//*/

 /*//-- Start Av Culling Section --//*/
 /*//-- do we have keys? --//*/
 if (vIdxLst = llGetListLength( gLstTms )){
 /*//-- Do Any Need Culled? --//*/
 if (vIntNow > llList2Integer( gLstTms, --vIdxLst )){
 /*//-- Find The Last Index that hasn't hit timeout status --//*/
 @TheirBones; if (--vIdxLst) if (vIntNow > llList2Integer( gLstTms, vIdxLst )) jump TheirBones;
 /*//-- Thin the herd --//*/
 gLstAvs = llList2List( (gLstAvs = []) + gLstAvs, 0, vIdxLst );
 gLstTms = llList2List( (gLstTms = []) + gLstTms, 0, vIdxLst );
 }
 }
 /*//-- End Av Culling Section --//*/
 }
}

/*//--                           License Text                           --//*/
/*//  Free to copy, use, modify, distribute, or sell, with attribution.   //*/
/*//    (C)2009 (CC-BY) [ http://creativecommons.org/licenses/by/3.0 ]    //*/
/*//   Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ]  //*/
/*//  All usages must contain a plain text copy of the previous 2 lines.  //*/
/*//--                                                                  --//*/
_________________________
%d bloggers like this: