Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help with a Click tracker script

raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
07-24-2007 19:15
I got the help I needed this post can be deleted now to keep away clutter from dead post.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
07-24-2007 21:05
My late-night, no access to SL attempt. I put a MAX_LENGTH in so you don't run out of memory. It can probably be larger than 100 names.
From: someone
//Constants
string EMAIL_ADDRESS = "";
string EMAIL_SUBJECT = "";
integer MAX_LENGTH = 100; // max names for the list
float INTERVAL = 604800; // 604800 seconds in a week

// Globals
string owner_name;
list visitor_list;

// Functions
sendEmail() {
llEmail(EMAIL_ADDRESS, EMAIL_SUBJECT, llDumpList2String(visitor_list, "\n";));
visitor_list = [];
}

// States
default {
state_entry() {
owner_name = llKey2Name(llGetOwner());
llOwnerSay("Click List Maker started... Say 'help' for instructions.";);
llListen(0, "", llGetOwner(), "";);
llSetTimerEvent(INTERVAL);
}
on_rez(integer start_param) {
llResetScript();
}
touch( integer num_detected ) {
integer i;
for( i = 0; i < num_detected; i++ ) {
string detected_name = llDetectedName(i);
if(detected_name != owner_name) {
if(llListFindList(visitor_list, [detected_name]) == -1) {
visitor_list += detected_name;
if (llGetListLength(visitor_list) == MAX_LENGTH) sendEmail();
}
}
}
}
listen( integer channel, string name, key id, string message ) {
if( message == "help" ) {
llOwnerSay("This object records names of all who click it.";);
llOwnerSay("Commands the owner can say:";);
llOwnerSay("'help' - Shows these instructions.";);
llOwnerSay("'say list' - Says the names of all clickers on the list.";);
llOwnerSay("'reset list' - Removes all the names from the list.";);
return;
}
if( message == "say list" ) {
llOwnerSay("Visitor List:\n" + llDumpList2String(visitor_list, "\n";));
llOwnerSay("Total = " + (string)llGetListLength(visitor_list));
return;
}
if( message == "reset list" ) {
visitor_list = [];
llOwnerSay("Done resetting.";);
}
}
timer() {
sendEmail();
}
}
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
07-24-2007 21:14
Thank you so much I will test this ASAP
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
07-24-2007 21:22
You may want to copy/paste a fresh copy. I ran it through lslint and caught a few bugs. I love lslint!
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
07-24-2007 21:30
yep it works i set the time to 2 mins and clicked it and got the email so it works great thank you so much