Code: Simple Visitor

This script was tested and works on OpenSim version 0.7.4!

visitor_simple.lsl
//////////////////////////////////////////////////////////
//     WaS (c) grimore.org - 2011, License: GPLv3            //
// Please see: http://www.gnu.org/licenses/gpl.html     //
// for legal details, rights of fair usage and          //
// the disclaimer and warranty conditions.              //
//////////////////////////////////////////////////////////
 
list vList = [];
integer comHandle = 0;
integer comChannel = 0;
integer scanInterval = 2;
integer scanRange = 10;
 
default {
 
    state_entry() {
        llSensorRepeat("", "", AGENT, scanRange, TWO_PI, scanInterval);
    }
 
    touch_start(integer total_number) {
        if (llDetectedKey(0) != llGetOwner()) return;
        comChannel = ((integer)("0x" + llGetSubString((string) llGetOwner(), -8, -1)) + (integer)("0x" + llGetSubString((string) llGetKey(), -8, -1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;
        comHandle = llListen(comChannel, "", llGetOwner(), "");
        llDialog(llDetectedKey(0), "\n[K] Visitor list: Please select an option. \n", ["Reset", "View", "Range", "Interval"], comChannel);
    }
 
    listen(integer chan, string name, key id, string mes) {
        if (mes == "Interval") {
            llDialog(llGetOwner(), "\n[K] Visitor list: Please select a scanning interval in seconds.\n", ["2s", "4s", "8s", "16s", "32s", "64s"], comChannel);
            return;
        }
        if (mes == "Range") {
            llDialog(llGetOwner(), "\n[K] Visitor: Please select a scanning distance in meters.\n", ["5", "10", "15", "30", "35", "40", "45", "50", "60", "70", "80", "90"], comChannel);
            return;
        }
        if (mes == "View") {
            llInstantMessage(id, "----------------------- Visitors -------------------------");
            integer aPtr = llGetListLength(vList) - 1;
            do {
                llInstantMessage(id, llList2String(vList, aPtr) + " @ " + llList2String(vList, aPtr - 1));
                aPtr -= 2;
            } while (aPtr > -1);
            llInstantMessage(id, "------------------------------------------------------------");
            jump eot;
        }
        if (mes == "Reset") {
            vList = [];
            jump eot;
        }
        integer iMes = (integer) mes;
        if (iMes == 0) jump eot;
        if (iMes >= 2 && (!iMes & (iMes - 1))) {
            scanInterval = iMes;
            llSensorRepeat("", "", AGENT, scanRange, TWO_PI, scanInterval);
            jump eot;
        }
        if (iMes % 5 == 0) {
            scanRange = iMes;
            llSensorRepeat("", "", AGENT, scanRange, TWO_PI, scanInterval);
            jump eot;
        }
@eot;
        llListenRemove(comHandle);
    }
 
    sensor(integer num) {
        --num;
        do {
            if (llListFindList(vList, (list) llDetectedName(num)) != -1) jump continue;
            if (llGetFreeMemory() < 2048 && llGetListLength(vList) != 0) vList = llDeleteSubList(vList, 0, 0);
            vList += [llGetTimestamp()] + [llDetectedName(num)];
@continue;
        } while (--num > -1);
    }
}