Visitor Counter Tracker
Revision as of 06:08, 30 May 2016 by Luxen Resident (talk | contribs)
Teleporter_Anywhere | Language_Scanner | Visitor_Counter_Tracker
Zx Visitor Counter - Tracker
- Daily counter, Monthly counter, Daily report (track, save and display the list of all the visitors names each day)
- Land wide (scan all your Land, no distance limit), easy to use, no setup needed and no lag.
- Fully autonomous: No need to reset it, no need to reset the counters, no need to clear the visitors name list. This tool will do it for you when needed.
- Copyright (C) 2016 Luxen - version 2.6
- Optimized, low memory, safe and secure
Code:
//////////////////////////////////////////////////////////////////////////////
// Zx Visitor Counter - Tracker v2.6 //
// //
// Copyright (C) 2016 Luxen - Zonyx Technology //
// This program is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License version 3, as //
// published by the Free Software Foundation. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/> //
//////////////////////////////////////////////////////////////////////////////
key Zowner;
integer NVisits;
string ZDate;
integer DCount = 0;
list NewTab = [];
list IdTab = [];
string Ztime()
{
string DayDate = llGetSubString(llGetDate(), 8, 9);
return DayDate;
}
Zcount()
{
string Ztext = "[D:" + (string)DCount + " - M:" + (string)NVisits + "]";
llSetPrimitiveParams([PRIM_TEXT, Ztext, <0.667, 0.667, 0.667>, 1.0]);
}
default
{
state_entry()
{
Zowner = llGetOwner();
NVisits = (integer)llGetObjectDesc();
ZDate = Ztime();
Zcount();
llSetTimerEvent(60.0);
}
on_rez(integer start_param)
{
llSetObjectDesc("0");
llResetScript();
}
touch_start(integer n)
{
if (llDetectedKey(0) == Zowner)
{
integer Tindex;
integer TnumOfAvatars = llGetListLength(NewTab);
string Vname = "";
if (TnumOfAvatars > 0)
{
for(Tindex = 0; Tindex < TnumOfAvatars ; ++Tindex)
{
Vname += llList2String(NewTab, Tindex) + ", ";
}
Vname = llDeleteSubString(Vname, -2, -1);
}
else Vname = "nobody";
integer OnumOfAvatars = llGetListLength(IdTab);
if (OnumOfAvatars > 0)
{
Vname += "\n Others (" + (string)OnumOfAvatars + "): ";
for(Tindex = 0; Tindex < OnumOfAvatars ; ++Tindex)
{
Vname += "secondlife:///app/agent/" + llList2String(IdTab, Tindex) + "/username" + ", ";
}
Vname = llDeleteSubString(Vname, -2, -1);
}
llOwnerSay("--------------------------"
+ "\n Visitors Today:"
+ "\n List (" + (string)TnumOfAvatars + "): " + Vname
+ "\n --------------------------");
}
}
changed(integer change)
{
if (change & CHANGED_REGION_START)
{
llSleep(60.0);
llSetTimerEvent(60.0);
}
}
timer()
{
integer UpDate = FALSE;
list AvatarsDetect = llGetAgentList(AGENT_LIST_PARCEL, []);
integer numOfAvatars = llGetListLength(AvatarsDetect);
if (numOfAvatars > 0)
{
integer ObjectGroup = FALSE;
list details = llGetObjectDetails(llGetKey(),[OBJECT_GROUP]);
if(llList2Key(details, 0)) ObjectGroup = TRUE;
integer index;
for (index = 0; index < numOfAvatars; ++index)
{
key id = llList2Key(AvatarsDetect, index);
if (llSameGroup(id) && ObjectGroup) ;
else if (id != Zowner)
{
string VisitorName = llGetUsername(id);
if (VisitorName)
{
if (llListFindList(NewTab, [VisitorName]) == -1) NewTab += [VisitorName];
else jump Next;
}
else
{
if (llListFindList(IdTab, [id]) == -1) IdTab += [id];
else jump Next;
}
UpDate = TRUE;
++DCount;
++NVisits;
}
@Next;
}
AvatarsDetect = [];
}
if (ZDate != Ztime())
{
llSleep(1.0);
ZDate = Ztime();
if (ZDate == "01") llSetObjectDesc("0");
else llSetObjectDesc((string)NVisits);
llResetScript();
}
else if (UpDate) Zcount();
}
}