/////////////////////////////////////////////////////////////////////////// // 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 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) llGetKey()), -8, -1))) & 1073741823) ^ -1073741825); 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 == "Reset") { vList = []; jump zout; } if (mes == "View") { integer aPtr = llGetListLength(vList) - 1; llInstantMessage(id, "----------------------- Visitors -------------------------"); do { llInstantMessage(id, llList2String(vList, aPtr) + " / " + llList2String(vList, aPtr - 1) + " @ " + llList2String(vList, aPtr - 2)); aPtr -= 3; } while (aPtr > -1); llInstantMessage(id, "------------------------------------------------------------"); jump zout; } integer iMes = (integer) mes; if (iMes == 0) jump zout; if (iMes && !(iMes & (iMes - 1))) { scanInterval = iMes; llSensorRepeat("", "", AGENT, scanRange, TWO_PI, scanInterval); jump zout; } if (iMes % 5 == 0) { scanRange = iMes; llSensorRepeat("", "", AGENT, scanRange, TWO_PI, scanInterval); jump zout; } @zout; 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) ] + [ llGetDisplayName(llDetectedKey(num)) ]; @continue; } while (--num > -1); } }