Norman Desmoulins
Grand Poohba
Join date: 10 Nov 2005
Posts: 194
|
08-17-2006 21:55
Here's the visitor list script that I've been using for a while. You can query it when offline, by sending an e-mail to it. "list" will return the visitor list (and reset it). "scan" will return the scan info. When the script is initialized, it will send out a RezInfo e-mail, that you can then just reply-to from then on to get the list or scan info. The visitor list is automatically sent to your e-mail address every 6 hours and reset. It will IM you and anybody that you put in the notify list. There are 2 forms of the notification, llNotifyList is simply the name and llNotifyVerboseList sends out the UID along with the name. Since it is sending IM's, you will also get an offline notification. string myEmail = "----@---"; // put your e-mail address here string myOwner = "---"; // put your UID here
list lNotifyList = []; // put the UIDs of your business partners here list lNotifyVerboseList = []; // put the UIDs of your business partners/alts that want more info string siteName = "SkyPlat"; // Subject/name for this visitor list
float delayGotMail = 2.5; float delayWaiting = 60.0;
string regionName; key myKey;
// Global variables list visitor_list; list current_list; string scan_list; float range = 300.0; // in meters float rate = 1.0; // in seconds float maxZ = 0.0; float minZ = 0;
integer MAXZ = 20; integer MINZ = 20;
// Functions ndNotify(string text, string verbose) { string tmp = llGetObjectName(); llSetObjectName(siteName); integer len; integer i; len = llGetListLength(lNotifyList); if (len > 0) { for (i = 0; i < len; i++) llInstantMessage(llList2String(lNotifyList, i), text); } len = llGetListLength(lNotifyVerboseList); if (len > 0) { for (i = 0; i < len; i++) { if (verbose != "") llInstantMessage(llList2String(lNotifyVerboseList, i), verbose); else llInstantMessage(llList2String(lNotifyVerboseList, i), text); } } llSetObjectName(tmp); }
ndNotifyOwner(string text) { string tmp = llGetObjectName(); llSetObjectName(siteName); llInstantMessage(myOwner, text); llSetObjectName(tmp); }
integer ndIsNameOnList(string name, list avlist) { integer len = llGetListLength(avlist); integer i; for (i = 0; i < len; i++) { if (llList2String(avlist, i) == name) return TRUE; } return FALSE; }
ndCheckForChanges(list detected) { string textStart = ""; string textStop = ""; integer nStart = 0; integer nStop = 0; integer len; integer i;
// see if we have somebody new len = llGetListLength(detected); for (i = 0; i < len; i++) { string name = llList2String(detected, i); if (ndIsNameOnList(name, current_list)==FALSE) { current_list += name; if (nStart > 0) textStart += ", "; textStart += name; nStart++; } } // see if somebody left len = llGetListLength(current_list); for (i = 0; i < len; i++) { string name = llList2String(current_list, i); if (ndIsNameOnList(name, detected)==FALSE) { if (nStop > 0) textStop += ", "; textStop += name; nStop++; } }
// update current list to be current only current_list = []; len = llGetListLength(detected); for (i = 0; i < len; i++) { string name = llList2String(detected, i); current_list += name; }
// come up with a message string msg = ""; if (nStart > 0) { msg = "Entered: "+textStart; if (nStop > 0) msg = "\nExited: "+textStop; } else if (nStop > 0) msg = "Exited: "+textStop; if (msg != "") ndNotify(msg, ""); } ndSendList() { string text = "Visitor List:\n"; integer len = llGetListLength( visitor_list ); integer i; for( i = 0; i < len; i++ ) { text += llList2String(visitor_list, i) + "\n"; } text += "Total = " + (string)len; visitor_list = [];
//ndNotifyOwner(text); llEmail(myEmail, siteName+" List", text); }
ndSendScan() { //ndNotifyOwner(scan_list); llEmail(myEmail, siteName+" Scan", scan_list); }
integer startTime;
ndInit() { startTime = llGetUnixTime(); scan_list = ""; myKey = llGetKey(); regionName = llGetRegionName(); vector rezPos = llGetPos(); maxZ = rezPos.z + MAXZ; minZ = rezPos.z - MINZ; string rezInfo = "Key: "+(string)myKey + " @ "+regionName+" "+(string)rezPos+" ("+(string)maxZ+")"; ndNotifyOwner(rezInfo); llEmail(myEmail, "RezInfo", rezInfo); llSetTimerEvent(delayWaiting); llSensorRepeat( "", "", AGENT, range, TWO_PI, rate ); }
default { state_entry() { ndInit(); } on_rez(integer param) { llResetScript(); } timer() { llGetNextEmail("", ""); // check for email with any subject/sender integer curTime = llGetUnixTime(); if (curTime - startTime < 43200) return; startTime = curTime; ndSendList(); }
email(string time, string address, string subj, string message, integer num_left) { if (num_left == 0) llSetTimerEvent(delayWaiting); else llSetTimerEvent(delayGotMail); // poll for emails
list args = llParseString2List(message, [" "], []); if (llGetListLength(args) != 1) { ndNotifyOwner("not enough args: "+message); return; } string cmd = llToLower(llList2String(args, 0)); if (cmd == "list") ndSendList(); else if (cmd == "scan") ndSendScan(); }
sensor(integer number_detected) { list detected = []; vector pos = llGetPos(); string textVerbose = ""; string textNewVerbose = ""; string textNew = ""; integer other = 0; integer group = 0; integer new = 0; integer i; textVerbose = ""; for (i = 0; i < number_detected; i++) { vector dpos = llDetectedPos(i); if (llGetLandOwnerAt(dpos)==llGetLandOwnerAt(llGetPos())) { string detected_name = llDetectedName(i); string detected_key = llDetectedKey(i); integer i = llGetAgentInfo(detected_key); float diff = llVecDist(pos,dpos); integer dist = llRound(diff); string result = detected_name+" ("+detected_key+") " + (string)dist; if(dpos.y>pos.y) result+="N"; else if(dpos.y<pos.y) result+="S"; if(dpos.x>pos.x) result+="E"; else if(dpos.x<pos.x) result+="W"; result += (string)((integer)(dpos.z-pos.z)); result += " "; if(i & AGENT_SCRIPTED) result += "S"; if(i & AGENT_FLYING) result += "F"; if(i & AGENT_AWAY) result += "A"; if(i & AGENT_IN_AIR) result += "H"; if(i & AGENT_MOUSELOOK) result += "M"; if (llDetectedGroup(i)) result += "G"; if ((dpos.x >= 0 && dpos.x <= 256) && (dpos.y >= 0 && dpos.y <= 256) && (dpos.z >= minZ) && (dpos.z <= maxZ)) { if (llDetectedGroup(i)) group++; else other++;
// add to the detected list detected += detected_name; // see if they are on the visitor list if (ndIsNameOnList(detected_name, visitor_list) == FALSE) { // add to the visitor list visitor_list += detected_name; // handle any separators to make more readable if (new > 0) { textNew += ", "; textNewVerbose += "\n"; } // add to the text textNew += detected_name; textNewVerbose += detected_name+" ("+detected_key+") @ "+regionName+" "+(string)dpos; result += "N"; // increment the count of new visitors new++; } } else { result += "*"; } textVerbose += result + "\n"; } } if (new > 0) ndNotify(textNew, textNewVerbose); scan_list = textVerbose; ndCheckForChanges(detected); } no_sensor() { ndCheckForChanges([]); } }
|
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
|
Discussion Thread
08-18-2006 20:52
_____________________
i've got nothing. 
|
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
|
03-30-2007 22:05
This is great. We have been trying to alter it a bit to send notifications to all members of a group when the object is touched. We have an object that posts a notecard with some information. Avatars can't touch the object unless they belong to our group. Would love to be able to also send notification to everyone in the group when someone in the group finds and touches the object. Still haven't gotten it to work...any ideas? From: Norman Desmoulins Here's the visitor list script that I've been using for a while. You can query it when offline, by sending an e-mail to it. "list" will return the visitor list (and reset it). "scan" will return the scan info. When the script is initialized, it will send out a RezInfo e-mail, that you can then just reply-to from then on to get the list or scan info. The visitor list is automatically sent to your e-mail address every 6 hours and reset. It will IM you and anybody that you put in the notify list. There are 2 forms of the notification, llNotifyList is simply the name and llNotifyVerboseList sends out the UID along with the name. Since it is sending IM's, you will also get an offline notification. string myEmail = "----@---"; // put your e-mail address here string myOwner = "---"; // put your UID here
list lNotifyList = []; // put the UIDs of your business partners here list lNotifyVerboseList = []; // put the UIDs of your business partners/alts that want more info string siteName = "SkyPlat"; // Subject/name for this visitor list
float delayGotMail = 2.5; float delayWaiting = 60.0;
string regionName; key myKey;
// Global variables list visitor_list; list current_list; string scan_list; float range = 300.0; // in meters float rate = 1.0; // in seconds float maxZ = 0.0; float minZ = 0;
integer MAXZ = 20; integer MINZ = 20;
// Functions ndNotify(string text, string verbose) { string tmp = llGetObjectName(); llSetObjectName(siteName); integer len; integer i; len = llGetListLength(lNotifyList); if (len > 0) { for (i = 0; i < len; i++) llInstantMessage(llList2String(lNotifyList, i), text); } len = llGetListLength(lNotifyVerboseList); if (len > 0) { for (i = 0; i < len; i++) { if (verbose != "") llInstantMessage(llList2String(lNotifyVerboseList, i), verbose); else llInstantMessage(llList2String(lNotifyVerboseList, i), text); } } llSetObjectName(tmp); }
ndNotifyOwner(string text) { string tmp = llGetObjectName(); llSetObjectName(siteName); llInstantMessage(myOwner, text); llSetObjectName(tmp); }
integer ndIsNameOnList(string name, list avlist) { integer len = llGetListLength(avlist); integer i; for (i = 0; i < len; i++) { if (llList2String(avlist, i) == name) return TRUE; } return FALSE; }
ndCheckForChanges(list detected) { string textStart = ""; string textStop = ""; integer nStart = 0; integer nStop = 0; integer len; integer i;
// see if we have somebody new len = llGetListLength(detected); for (i = 0; i < len; i++) { string name = llList2String(detected, i); if (ndIsNameOnList(name, current_list)==FALSE) { current_list += name; if (nStart > 0) textStart += ", "; textStart += name; nStart++; } } // see if somebody left len = llGetListLength(current_list); for (i = 0; i < len; i++) { string name = llList2String(current_list, i); if (ndIsNameOnList(name, detected)==FALSE) { if (nStop > 0) textStop += ", "; textStop += name; nStop++; } }
// update current list to be current only current_list = []; len = llGetListLength(detected); for (i = 0; i < len; i++) { string name = llList2String(detected, i); current_list += name; }
// come up with a message string msg = ""; if (nStart > 0) { msg = "Entered: "+textStart; if (nStop > 0) msg = "\nExited: "+textStop; } else if (nStop > 0) msg = "Exited: "+textStop; if (msg != "") ndNotify(msg, ""); } ndSendList() { string text = "Visitor List:\n"; integer len = llGetListLength( visitor_list ); integer i; for( i = 0; i < len; i++ ) { text += llList2String(visitor_list, i) + "\n"; } text += "Total = " + (string)len; visitor_list = [];
//ndNotifyOwner(text); llEmail(myEmail, siteName+" List", text); }
ndSendScan() { //ndNotifyOwner(scan_list); llEmail(myEmail, siteName+" Scan", scan_list); }
integer startTime;
ndInit() { startTime = llGetUnixTime(); scan_list = ""; myKey = llGetKey(); regionName = llGetRegionName(); vector rezPos = llGetPos(); maxZ = rezPos.z + MAXZ; minZ = rezPos.z - MINZ; string rezInfo = "Key: "+(string)myKey + " @ "+regionName+" "+(string)rezPos+" ("+(string)maxZ+")"; ndNotifyOwner(rezInfo); llEmail(myEmail, "RezInfo", rezInfo); llSetTimerEvent(delayWaiting); llSensorRepeat( "", "", AGENT, range, TWO_PI, rate ); }
default { state_entry() { ndInit(); } on_rez(integer param) { llResetScript(); } timer() { llGetNextEmail("", ""); // check for email with any subject/sender integer curTime = llGetUnixTime(); if (curTime - startTime < 43200) return; startTime = curTime; ndSendList(); }
email(string time, string address, string subj, string message, integer num_left) { if (num_left == 0) llSetTimerEvent(delayWaiting); else llSetTimerEvent(delayGotMail); // poll for emails
list args = llParseString2List(message, [" "], []); if (llGetListLength(args) != 1) { ndNotifyOwner("not enough args: "+message); return; } string cmd = llToLower(llList2String(args, 0)); if (cmd == "list") ndSendList(); else if (cmd == "scan") ndSendScan(); }
sensor(integer number_detected) { list detected = []; vector pos = llGetPos(); string textVerbose = ""; string textNewVerbose = ""; string textNew = ""; integer other = 0; integer group = 0; integer new = 0; integer i; textVerbose = ""; for (i = 0; i < number_detected; i++) { vector dpos = llDetectedPos(i); if (llGetLandOwnerAt(dpos)==llGetLandOwnerAt(llGetPos())) { string detected_name = llDetectedName(i); string detected_key = llDetectedKey(i); integer i = llGetAgentInfo(detected_key); float diff = llVecDist(pos,dpos); integer dist = llRound(diff); string result = detected_name+" ("+detected_key+") " + (string)dist; if(dpos.y>pos.y) result+="N"; else if(dpos.y<pos.y) result+="S"; if(dpos.x>pos.x) result+="E"; else if(dpos.x<pos.x) result+="W"; result += (string)((integer)(dpos.z-pos.z)); result += " "; if(i & AGENT_SCRIPTED) result += "S"; if(i & AGENT_FLYING) result += "F"; if(i & AGENT_AWAY) result += "A"; if(i & AGENT_IN_AIR) result += "H"; if(i & AGENT_MOUSELOOK) result += "M"; if (llDetectedGroup(i)) result += "G"; if ((dpos.x >= 0 && dpos.x <= 256) && (dpos.y >= 0 && dpos.y <= 256) && (dpos.z >= minZ) && (dpos.z <= maxZ)) { if (llDetectedGroup(i)) group++; else other++;
// add to the detected list detected += detected_name; // see if they are on the visitor list if (ndIsNameOnList(detected_name, visitor_list) == FALSE) { // add to the visitor list visitor_list += detected_name; // handle any separators to make more readable if (new > 0) { textNew += ", "; textNewVerbose += "\n"; } // add to the text textNew += detected_name; textNewVerbose += detected_name+" ("+detected_key+") @ "+regionName+" "+(string)dpos; result += "N"; // increment the count of new visitors new++; } } else { result += "*"; } textVerbose += result + "\n"; } } if (new > 0) ndNotify(textNew, textNewVerbose); scan_list = textVerbose; ndCheckForChanges(detected); } no_sensor() { ndCheckForChanges([]); } }
|