Visit Monitor
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Visitor Monitor
--BETLOG Hax UTC+10: 20090715 1159 [SLT: 20090714 1859]
Volumedetect (collision based) prim that records avatars names, number of visits, and time (in UTC)
Written in response to Firery Broome's request to "just add a few simple things" ...Resulting, as usual :) in an almost total rewrite, and functional differences to the original.
Re-posting here as S.A.3.0 licence to re-assert its original public status and that of my rewrite.
Not comprehensively tested, so may have some stupid in it.
<lsl> //============================================================== //Original script by Aaron Linden // //modified and commented by Ramon Kothari // // Almost totally rewritten by BETLOG Hax // UTC+10: 20090713 2306 [SLT: 20090713 0606] // To remove silly guff and reformat (sheesh WHITESPACE people!), added some more useful stuff. // For Firery Broome //---------------------------------- // **** LICENCE START **** // http://creativecommons.org/licenses/by-sa/3.0/ // Attribution licence: // You must: // -Include this unaltered licence information. // -Supply my original script with your modified version. // -Retain the original scripts' SL permissions. [+c/+m/+t] // Or: // -Link to the wiki URL from which you copied this script. // -Document: "Uses parts of <scriptname> by BETLOG Hax" // **** LICENCE END **** //---------------------------------- //========================================================================= // ------ CONFIGURATION ------ string gEmail = "BETLOG.Hax@gmail.com"; float gFreq = 604800.0;//60*60*24*7=604800 - 1 WEEK
// ------ CORE CODE ------ list gList = [];
//---------------------------------- f_sendEmail() { if(gEmail!="")
{ llEmail(gEmail, llGetRegionName()+" Visitor List "+(string)llGetTimestamp(), f_output((gList!=[]))); }
} //---------------------------------- f_sayHelp( integer is_owner ) { if( is_owner )
{ llOwnerSay( "This object records the names of everyone who collides with it." ); llOwnerSay( "Commands the owner can say:" ); llOwnerSay( "'help' - Shows these instructions." ); llOwnerSay( "'say list' - Says the names of all visitors on the list."); llOwnerSay( "'reset list' OR 'email list' - Emails the names on the list and resets." ); } else { llSay( 0, "Sorry, only the owner can use this object." ); }
} //---------------------------------- string f_output(integer i) { string text;//this could easily get far too large to send/load into memory
while(i>-1) { text += "Name: "+llList2String(gList, i-2)+"\t"+ " Visit: "+(string)llList2Integer(gList, i-1)+"\t"+ " Last :"+llList2String(gList, i)+"[UTC]\n"; i-=3; } return text;
} //---------------------------------- default { on_rez(integer param)
{ llSay(0, "Visitor List Maker started..."); f_sayHelp(TRUE); llResetScript(); } state_entry() { if(llGetFreeMemory()<17000) llOwnerSay("RECOMPILE THIS IN MONO. (it'll still work otherwise, just not as well.)"); llVolumeDetect(TRUE); llListen(0, "", llGetOwner(), ""); llOwnerSay("OK Running."); llSetTimerEvent(gFreq); } timer() { llSetTimerEvent(0.0); f_sendEmail(); llResetScript(); } touch_start( integer num) { while(--num>-1) f_sayHelp( llDetectedKey(num) == llGetOwner() ); } collision_start(integer num) { string detected_name; integer index; string segment; integer start; integer visits; do { --num; if(llDetectedType(num)&AGENT
// && llDetectedKey(num)!=llGetOwner()//rem out to test on yourself
) { detected_name = llDetectedName(num); if(llGetFreeMemory()<512) llSetTimerEvent(0.1); else { index = llListFindList(gList, [detected_name]); if(-1==index) { gList += [detected_name]+[1]+[llGetTimestamp()];
//llOwnerSay("Adding new visitor: \n"+llList2CSV(gList));
} else { gList = llListReplaceList(gList, [detected_name]+[llList2Integer(gList, index+1)+1]+[llGetTimestamp()], index, index+2);
//llOwnerSay("Updating visits: \n"+llList2CSV(gList));
} } } } while(num>-1); } listen( integer channel, string name, key id, string message ) { if( message == "help" ) { f_sayHelp( TRUE ); } else if( message == "say list" ) { integer i = (gList!=[])-1; string s = llGetObjectName(); llSetObjectName(" "); llOwnerSay(f_output(i)); llSetObjectName(s); } else if( message == "email list" || message == "reset list" || message == "send email" ) { llOwnerSay( "Sending email (incurs a 20 second delay) and resetting..."); f_sendEmail(); llResetScript(); } }
} //========================================================================= </lsl>