Table of Contents

Shortnote

The following is a greeter script that will pop-up the message:

     -=Welcome=-

Please read our rules!

once an avatar collides with it - for best results it can serve as a landing pad so new avatars collide with the greeter.

Additionally, the script hands out any items in the inventory except scripts to the agents once and remembers them so it does not send them a second time.

Setup

Note

The script is design to garbage-collect the avatar list once it runs under 2KB of free memory by removing the first element in the list.

Code

push_greeter.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
list avs = [];
 
default
{
    state_entry() {
        llVolumeDetect(TRUE);
        llSensorRepeat("", "", AGENT, 5, TWO_PI, 1);
        llSetTimerEvent(1);
    }
 
    sensor(integer num) {
        do {
            key av = llDetectedKey(num);
            if(av == NULL_KEY) jump continue;
            if(llListFindList(avs,(list)av) != -1) jump continue;
            avs += av;
            integer i = llGetInventoryNumber(INVENTORY_ALL);
            list items = [];
            do {
                string name = llGetInventoryName(INVENTORY_ALL, i);
                if(llGetInventoryType(name) == INVENTORY_SCRIPT) jump nextitem;
                items += name;
@nextitem;
            } while(--i >= 0);
            if(llGetListLength(items) == 0) return;
            llGiveInventoryList(av, "Rules and Landmark.", items);
@continue;
        } while(--num != -1);
    }
    collision_start(integer num) {
        do {
            key av = llDetectedKey(num);
            if(av == NULL_KEY) jump continue;
            llDialog(av, "\n     -=Welcome=-\n\n\tPlease read our rules!", [], -1);
@continue;
        } while(--num != -1);
    }
 
    timer() {
        // Less than 2KB left, start trimming the list.
        if(llGetFreeMemory() > 2048) return;
        avs = llDeleteSubList(avs, 0, 0);
    }
    on_rez(integer num) {
        llResetScript();
    }
}