Jump to content

Help With a List Limit - Problem Resolved - Thank you for the help.


Perrie Juran
 Share

You are about to reply to a thread that has been inactive for 4154 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm having trouble with a list limit in the security script I use (a free one from the library).

In the globals is reads:

 64 // limit the white list to 25 users
65 integer gIntWhite_LstLen = 25;


Right now I have 10 names in the white list.  When I go to add another name it tells me I have reached the maximum, I need to delete one first.

Have I reached a 'natural limit?'  (Not sure how else to say that.)

I am trying to avoid posting all 780 lines of code here.  I can  not find anywhere else in the code that imposes a limit on the white list.  In additional notes on the script it says:

 

28 list. This limit is imposed to keep memory usage down.
29 - Allows for up to 25 in the white list for the same reason as stated above. When this limit is reached you will be notified that if you want to add another avi you
30
31 will have to delete one from the White List first.
 
If I need to post more info to get help with this I will, but as I said, it's 780 lines.
 
Thanks in advance for your help.

Perrie

 

Link to comment
Share on other sites

The limit you've reached is one imposed by the script, not by LSL.

It's a bit hard to tell without looking at the script, but I'd start by looking for tests involving llGetListLength() or, though less likely, llGetFreeMemory().

If you don't want to post a huge script here (which you could by formatting it with the code button and then hiding it behind a spoiler button, I guess), you could post it on pastebin.com and put the url in here.

Link to comment
Share on other sites


Innula Zenovka wrote:

A quick look suggests that, at lines 529--537, when you add people as administrators you also add them to the separate whitelist (which isn't the way I would do it).

Could that be the issue?  That you have 15 people on the Administrator's list? 

Grrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

Last night I tried three times, got the message I was over the 10 Ava limit, did "show white'" and it returned ten names.

I decided to get back to this today.  I just went to check to see total number of names, White Listed, Admins, Ejected.

Well I now show 25 names on the White List.  They are all correct / supposed to be on it.

ETA, I am the only Admin.

Frustrating SL.

Thank you for looking at this.

Would there be a noticeable consequence if I upped the name limit?

Link to comment
Share on other sites

That's exactly it, Innula.  The variable  gLstIgnore includes the owner's name (line 105), the whitelist avatars (line 442),and the administrators (line 500).  Line 193 compares the length of that composite string to gIntWhite_Listen, which is set at 25.  What it should do instead is compare to that plus gIntAdmin_LstLen, which is another 6 avs long, plus gLstOwnerName (which has no specified maximum length).  So line 193 should be changed to say

if (llGetListLength(gLstIgnore) >= (gIntWhite_LstLen + gIntAdmin_LstLen + llGetListLength(gLstOwnerName)))

I think that should take care of the problem, except for clarifying some of the comments so that it's clear to the user that the maximum is the sum of all three lists (25 + 6 + ? , where ? is probably always going to be a small number like 1 or 2).

@Perrie-- The consequence of increasing the limit much beyond this is that you might run out of script memory.  If that happens, it will lock up and need to be restarted (which means, of course, that you'll have to re-enter all of the names again.)

ETA:  Also notice (line 115) that the owner does not need to put his/her own name in gLstAdminNames, since it's automatically checked anyway.

Link to comment
Share on other sites


Rolig Loon wrote:

That's exactly it, Innula.  The variable 
gLstIgnore
includes the owner's name (line 105), the whitelist avatars (line 442),and the administrators (line 500).  Line 193 compares the length of that composite string to
gIntWhite_Listen
, which is set at 25.  What it should do instead is compare to that plus
gIntAdmin_LstLen
, which is another 6 avs long, plus
gLstOwnerName
(which has no specified maximum length).  So line 193 should be changed to say
if (llGetListLength(gLstIgnore) >= (gIntWhite_LstLen + gIntAdmin_LstLen + llGetListLength(gLstOwnerName)))

I think that should take care of the problem, except for clarifying some of the comments so that it's clear to the user that the maximum is the sum of all three lists (25 + 6 + ? , where ? is probably always going to be a small number like 1 or 2).

@Perrie-- The consequence of increasing the limit much beyond this is that you might run out of script memory.  If that happens, it will lock up and need to be restarted (which means, of course, that you'll have to re-enter all of the names again.)

ETA:  Also notice (line 115) that the owner does not need to put his/her own name in
gLstAdminNames
, since it's automatically checked anyway.

Ty Rolig.

Looking at this again, I did have one other question.

It says in the notes at the bottom, line 21, That Avatar names are case sensitive.  This has been a pain when adding people.  Is there any way to eliminate the case sensitive issue?

Link to comment
Share on other sites

Sure, but you'll have to be careful to watch for each place in the script that adds a name to one of the whitelists.  What you'd want to do is save the name as llToLower(whatever_the_name_is), thus creating lists that are all lower case.  THEN, look for every place in the script where a user's name is compared to the collected whitelists (I think there's only one place, actually), and convert the detected name to lower case as well during the comparison.  So something like

     if (~ListFindList (gLstIgnore,[llToLower(llDetectedName(0))]) )

 EDIT: Even easier (and more reliable) than that last step, change line 114 to be

gStrToucherName = llToLower(llDetectedName(0)); // find out who is touching us

EDIT again:  YES!  Innula's done the heavy lifting.  :smileyvery-happy:

Link to comment
Share on other sites

Yeah, I would have it compare usernames, which aren't case sensitive.

Here, hidden by the spoiler, is a completely untested stab at it.   I've also included (I hope) Rolig's fix.

You should be able to give it usernames or legacy names (or Frodo Resident, if you want) and it will convert them.   I think I've changed everything necessary but I stress it's completely untested and my stuff rarely works first time.

// Script Name: Mango_Wylders_Security_Orb.lsl// Author: mangowylder//Dialog menu driven parcel security orb// Downloaded from : http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=1674// This program is free software; you can redistribute it and/or modify it.// Additional Licenes may apply that prevent you from selling this code// and these licenses may require you to publish any changes you make on request.//// There are literally thousands of hours of work in these scripts. Please respect// the creators wishes and Copyright law and follow their license requirements.//// License information included herein must be included in any script you give out or use.// Licenses may also be included in the script or comments by the original author, in which case// the authors license must be followed, and  their licenses override any licenses outlined in this header.//// You cannot attach a license to any of these scripts to make any license more or less restrictive.//// All scripts by avatar Ferd Frederix, unless stated otherwise in the script, are licensed as Creative Commons By Attribution and Non-Commercial.// Commercial use is NOT allowed - no resale of my scripts in any form.  // This means you cannot sell my scripts but you can give them away if they are FREE.  // Scripts by Ferd Frederix may be sold when included in a new object that actually uses these scripts. Putting my script in a prim and selling it on marketplace does not constitute a build.// For any reuse or distribution, you must make clear to others the license terms of my works. This is done by leaving headers intact.// See http://creativecommons.org/licenses/by-nc/3.0/ for more details and the actual license agreement.// You must leave any author credits and any headers intact in any script you use or publish.///////////////////////////////////////////////////////////////////////////////////////////////////// If you don't like these restrictions and licenses, then don't use these scripts.//////////////////////// ORIGINAL AUTHORS CODE BEGINS ////////////////////////////////////////////// Mango Wylder's parcel Security Orb//Heavily modified version of Security Orb script found here: http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=1119// Written by Mango Wylder except where noted// Please see the notecard for usage// I wrote this script a couple of years ago.// Did some cleanup 09/10/2012// Got rid of llInstantmessage// Changed to llRegionSayto to get rid of delay// Added some sanity checks// Hope I didn't break anything :)// If so let me know// Heavily modified version of Security Orb script found here// http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=1119// There is very little of the original code in this script.// What original code is left is after sensor(integer nr)// and little of that is left// There is a problem with this script and the original script.// http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=1119// It uses llSleep when an avi is detected.// Why is this a problem?// Well if you invite someone to your parcel and they are not allowed,// you can't do anything with the scanner once the avi is detected during the Warn Time period (sleep time)// i.e You can't turn it off for example.// The Avi will get booted then you will have to have to make changes to the Security Orb to// allow the visitor.// You might ask why not just use a timer?// I'm using the timer to ensure no stray listens and to prevent writing to the wrong list in the// event of no user input.// I'm working on a major rewrite but for now it is what it is :)// Mango Wylder//Globals// additional and untested modfications by Innula Zenovka to usernames rather than legacy names// fix by Rolig Loon for issues with number of names allowed on whitelistlist    gLstChoices = ["Show Admin", "Add Admin", "Del Admin", "Show White", "Add White", "Del White", "Turn On", "Turn Off", "Orb Status", "More", "Cancel"];list    gLstChoicesMore = ["ShowBan",  "PurgeBan", "DelBan", "ShowEjected", "DelEject", "ClearEject", "Warn Time", "SetRange", "SetBanTime", "<< Back", "Group Mode", "Scan Rate"];list    gLstChoiceGroup = ["Group On", "Group Off"];list    gLstOwnerName = [];list    gLstAdminNames = [];//      scanner ignores anyone in this listlist    gLstIgnore = [];//      ejected is where avi's are logged if scanner is on and not in White Listlist    gLstEjected = [];//      LstBan is where avi's are added with a timestamp if they return within BanTimelist    gLstBan = [];//      LstEjectR is where avi's are add if they come back a second time within BanTime//      avi's will automatically be deleted from LstEjectR when added to LstBan//      this combination allows for the third visit within BanTime and LLTeleportHome//      Three strikes and you are outlist    gLstEjectR = [];//      find out if the toucher is authorizedkey     gKeyToucherID;//      default scanner range is 30 meteresfloat   gFltRange = 30.0;//      default warning time is 30 secondsfloat   gFltWarnTime = 30;float   gFltScanRate = 30;integer gIntChannel_Dialog;integer gIntChannel_Chat;integer gIntListen_Id;integer gIntListen_Id_Chat;//      limit the white list to 25 usersinteger gIntWhite_LstLen = 25;//      limit ejected list to 25 (25 plus the unix time stamp for each aviinteger gIntEject_LstLen = 50;//      limit admin list to 12 usersinteger gIntAdmin_LstLen = 6;//      initial scanner rangeinteger gIntRange = 30;//      initial bantime in seconds (1 hour)integer gIntBanTime = 3600;//      initial bantime in hoursinteger gIntBanTimeH = 1;integer gIntMasterRW = TRUE;integer gIntWhiteAD;integer gIntActive;integer gIntSetBanTime;integer gIntEjected;integer gIntBanned;integer gIntSetRange;integer gIntWarnTime;integer gIntSetWarnTime;integer gIntSetScanRate;integer gIntVectorX;//      scanner will ignore anyone with the same active group tag if activatedinteger gIntGroupSet = 0;string  gStrWarnTime = "30";string  gStrBanTime = "1";string  gStrRange = "30";string  gStrScanRate = "30";string  gParcelName;string  gStrToucherName;string  gStrNewOwnerName;string parcelName(vector p) {    return llList2String(llGetParcelDetails(p, [PARCEL_DETAILS_NAME]) , 0);}//from the wiki https://wiki.secondlife.com/wiki/Category:LSL_Avatar/Namestring agentUsername(string agentLegacyName) {    return llDumpList2String(llParseString2List(llToLower(agentLegacyName)+" ", [" resident ", " "],[]), ".");}default{    state_entry()    {        gLstOwnerName = [gStrNewOwnerName = llGetUsername (llGetOwner ())] + gLstOwnerName;        gLstIgnore = [gStrNewOwnerName] + gLstIgnore;        gIntChannel_Dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) ); // set a negative integer chat channel for the dialog box        gIntChannel_Chat = 7; // Set a chat channel to listen to owners commands        gParcelName = parcelName(llGetPos());    }    touch_start(integer total_number)    {        gKeyToucherID = llDetectedKey(0);        gStrToucherName = llGetUsername(llDetectedKey(0)); // find out who is touching us        list vOwnerAdminNames = gLstOwnerName + gLstAdminNames;        if(~llListFindList(vOwnerAdminNames, [gStrToucherName])) // find out if the toucher is in the owners/admins list. If so they may proceed        {            gKeyToucherID = llDetectedKey(0);            llDialog(gKeyToucherID, "Please make a choice.", gLstChoices, gIntChannel_Dialog);            gIntListen_Id = llListen(gIntChannel_Dialog, "", gKeyToucherID, "");            gIntChannel_Chat = 7;            llSetTimerEvent(20); //set a time limit to llListen        }        else        {            llSay (0, "You are not authorized"); // if toucher isn't in the owner/admin list they get a warning        }    }    listen(integer channel, string name, key id, string choice)    {        if(channel == gIntChannel_Dialog)        {            if (~llListFindList(gLstChoices, [choice]))  // verify dialog choice            {                if (choice == "Cancel")                {                    llListenRemove(gIntListen_Id);                }                else if (choice == "More")                {                    llDialog(gKeyToucherID, "Pick an option!", gLstChoicesMore, gIntChannel_Dialog); // present submenu on request                }                else if (choice == "Orb Status")                {                    if (gIntActive == 1)                    {                        llRegionSayTo(gKeyToucherID, 0, "Security Orb is active and scanning at " + gStrRange + " meters in eject mode" + " Scan Rate is set at " + gStrScanRate + " seconds.");                        llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds");                    }                    else                    {                        llRegionSayTo(gKeyToucherID, 0, "Security Orb is turned off"  + " Scan Rate is set at " + gStrScanRate + " seconds" );                        llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds");                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "Turn On")                {                    if (gIntActive == 1)                    {                        llRegionSayTo(gKeyToucherID, 0, "Security Orb is already armed and scanning at " + gStrRange + " meters. I will eject anyone I can find unless they're in your White list." );                        llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds" + " Scan Rate is set at " + gStrScanRate + " seconds.");                    }                    else                    {                        gIntActive = 1;                        llRegionSayTo(gKeyToucherID, 0, "Security Orb is armed and scanning at " + gStrRange + " meters. I will eject anyone I can find unless they're in your White list." );                        llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds" + " Scan Rate is set at " + gStrScanRate + " seconds.");                        llSensorRepeat( "", "", AGENT, gFltRange, PI, gFltScanRate );                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "Turn Off")                {                    llSensorRemove();                    gIntActive = 0;                    llRegionSayTo(gKeyToucherID, 0, " Security Orb is turned off");                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "Show White")                {                    llRegionSayTo(gKeyToucherID, 0, "Here's your White list");                    integer i;                    integer s = llGetListLength(gLstIgnore);                    do                        llRegionSayTo(gKeyToucherID, 0, llList2String(gLstIgnore,i));                    while(s>++i);                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                if (choice == "Add White")                {                    if (llGetListLength(gLstIgnore) >= (gIntWhite_LstLen + gIntAdmin_LstLen + llGetListLength(gLstOwnerName)))//Rolig                    {                        llRegionSayTo(gKeyToucherID, 0, " You have reached the maximum allowed in the White List.");                        llRegionSayTo(gKeyToucherID, 0, " If you want to the White List, you will need to delete one first");                    }                    else                    {                        gIntWhiteAD = 1;                        if(gIntWhiteAD == 1) {                            llRegionSayTo(gKeyToucherID, 0, "Please Enter name to Add in chat window on Channel /7");                            gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                            llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                        }                    }                }                else if (choice == "Del White")                {                    gIntWhiteAD = 2;                    llRegionSayTo(gKeyToucherID, 0, "Please Enter name to Delete in chat window on Channel /7");                    gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "Add Admin")                {                    if (llGetListLength(gLstAdminNames) >= gIntAdmin_LstLen)                    {                        llRegionSayTo(gKeyToucherID, 0, " You have reached the maximum allowed Administrators.");                        llRegionSayTo(gKeyToucherID, 0, " If you want to add another Administrator, you will need to delete one first");                    }                    else if(~llListFindList(gLstOwnerName, [gStrToucherName]))                    {                        gIntWhiteAD = 3;                        llRegionSayTo(gKeyToucherID, 0, "Please Enter name of the Administrator to Add in chat window on Channel /7");                        gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                    }                    else                    {                        llSay (0, "You are not authorized to add to the administrators list"); // if toucher isn't in the owner they get a warning                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "Show Admin")                {                    if (gLstAdminNames == [])                    {                        llRegionSayTo(gKeyToucherID, 0, " The Administrators list is empty");                    }                    else                    {                        llRegionSayTo(gKeyToucherID, 0, "Here's your Administrators list");                        llRegionSayTo(gKeyToucherID, 0, llList2CSV(gLstAdminNames));                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "Del Admin")                {                    if(~llListFindList(gLstOwnerName, [gStrToucherName]))                    {                        if (gLstAdminNames == [])                        {                            llRegionSayTo(gKeyToucherID, 0, " The Administrators list is empty");                        }                        else if (gLstAdminNames)                        {                            gIntWhiteAD = 4;                            llRegionSayTo(gKeyToucherID, 0, "Please Enter name of the Admin to Delete in chat window on Channel /7");                            gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                        }                        else                        {                            llRegionSayTo(gKeyToucherID, 0, "You are not authorized to remove from the administrators list"); // if toucher isn't in the owner they get a warning                        }                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }            }            if (~llListFindList(gLstChoicesMore, [choice]))  // verify dialog choice            {                if (choice == "Warn Time")                {                    gIntSetWarnTime = 1;                    llRegionSayTo(gKeyToucherID, 0, "Please enter the new warning time on Channel /7");                    gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                    llListenRemove(gIntListen_Id); //remove the listen on gIntChannel_Dialog                }                else if (choice == "Scan Rate")                {                    gIntSetScanRate = 1;                    llRegionSayTo(gKeyToucherID, 0, "Please enter a Scan Rate from 5 to 60 seconds in the chat window on Channel /7");                    gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "SetRange")                {                    gIntSetRange = 1;                    llRegionSayTo(gKeyToucherID, 0, "Please enter the new scan range on Channel /7");                    gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "ShowEjected")                {                    if (gLstEjected == [])                    {                        llRegionSayTo(gKeyToucherID, 0, " The ejected list is empty");                    }                    else                    {                        llRegionSayTo(gKeyToucherID, 0, "Here's your ejected list");                        integer i;                        integer s = llGetListLength(gLstEjected);                        do                            llRegionSayTo(gKeyToucherID, 0, llList2String(gLstEjected,i));                        while(s>++i);                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "DelEject")                {                    if (gLstEjected == [])                    {                        llRegionSayTo(gKeyToucherID, 0, " The ejected list is empty");                    }                    else                    {                        gIntEjected = 1;                        llRegionSayTo(gKeyToucherID, 0, "Please enter name to delete in chat window on Channel /7");                        gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "ClearEject")                {                    if (gLstEjected == [])                    {                        llRegionSayTo(gKeyToucherID, 0, " The ejected list is already empty");                    }                    else                    {                        gIntEjected = 2;                        llRegionSayTo(gKeyToucherID, 0, "This will clear the Ejected List. Do you wish to proceeed? Enter y or n on Channel /7");                        gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "DelBan")                {                    if (gLstBan == [])                    {                        llRegionSayTo(gKeyToucherID, 0, " The Banned list is already empty");                    }                    else                    {                        gIntBanned = 1;                        llRegionSayTo(gKeyToucherID, 0, "This will clear the Banned List. Do you wish to proceeed? Enter y or no on Channel /7");                        gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "PurgeBan")                {                    if (gLstBan == [])                    {                        llRegionSayTo(gKeyToucherID, 0, " The ejected Ban list is empty");                    }                    else                    {                        integer length = llGetListLength(gLstBan); //purge avi's that have been gone longer than Ban Time                        integer i = - 1;                        integer BOOT_TIME = llGetUnixTime(); // store current time                        for (; i < length; i += 2) // for all timestamps                        {                            if (BOOT_TIME - llList2Integer(gLstBan,i) > gIntBanTime) //compare timestamp with current time                            {                                integer j = i - 1;                                gLstBan = llDeleteSubList(gLstBan, j, i);                                i -= 2;  // offset                                length -= 2; // offset                            }                        }                        llRegionSayTo(gKeyToucherID, 0, " The ejected Ban list has been purged of entries greater than " + gStrBanTime + " hour(s). Use Show Ban to see current entries.");                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "ShowBan")                {                    if (gLstBan == [])                    {                        llRegionSayTo(gKeyToucherID, 0, " The Banned list is empty");                    }                    else                    {                        llRegionSayTo(gKeyToucherID, 0, llList2CSV (gLstBan));                    }                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "SetBanTime")                {                    gIntSetBanTime = 1;                    llRegionSayTo(gKeyToucherID, 0, "Please enter Ban time in hours on Channel /7");                    gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "Group Mode")                {                    llDialog(gKeyToucherID, "Please ensure the Security Console is set to the correct group before enabling this feature.", gLstChoiceGroup, gIntChannel_Dialog);                }                else if (choice == "<< Back")                {                    llDialog(gKeyToucherID, "What do you want to do?", gLstChoices, gIntChannel_Dialog); // present main menu on request to go back                }            }            if (~llListFindList(gLstChoiceGroup, [choice]))  // verify dialog choice            {                if (choice == "Group On")                {                    gIntGroupSet = 1;                    llRegionSayTo(gKeyToucherID, 0, "Group Mode protection is activated");                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }                else if (choice == "Group Off")                {                    gIntGroupSet = 0;                    llRegionSayTo(gKeyToucherID, 0, "Group Mode protection is de-activated");                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                }            }        }        //end of channel_dialog        if(channel == gIntChannel_Chat)        {                    if (gIntMasterRW = TRUE) // check to see if modifying any list is still allowwd (not timed out)                        {  if(~llListFindList([1,2,3,4],[gIntWhiteAD])){            choice = agentUsername (choice);                if (gIntWhiteAD == 1)//ensure we should be here adding to the White List                {                    if(~llListFindList(gLstIgnore, [choice]))                    {                        llRegionSayTo(gKeyToucherID, 0, choice + " is already in the White List");                    }                    else if(~llListFindList(gLstEjected, [choice]))                    {                        integer i = llListFindList(gLstEjected, [choice]);                        gLstEjected = llDeleteSubList(gLstEjected, i,i);                        llRegionSayTo(gKeyToucherID, 0, choice + " was in the Ejected list " + choice + "  has been removed from the Ejected list" );                        if(~llListFindList(gLstBan, [choice]))                        {                            integer j = llListFindList (gLstBan, [choice]);                            gLstBan = llDeleteSubList(gLstBan, j,j + 1 ); //remove the avi and their timestamp from the Ban List                        }                        gLstIgnore = gLstIgnore + [choice]; //mono optimized list append                    }                    else                    {                        gLstIgnore = gLstIgnore + [choice]; //mono optimized list append                        llRegionSayTo(gKeyToucherID, 0, choice + " has been added to the White List");                    }                    llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                    llListenRemove(gIntListen_Id); //remove the listen on channel_dialog                    gIntWhiteAD = 0;                }                else if (gIntWhiteAD == 2) // ensure we should be here removing from the White List                {                    if(~llListFindList(gLstOwnerName, [choice]))                    {                        llRegionSayTo(gKeyToucherID, 0, "You can not remove the owner name from the White list!");                    }                    else                    {                        integer j = llListFindList(gLstIgnore, [choice]);                        if (j == -1)                        {                            gIntWhiteAD = 0;                            llRegionSayTo(gKeyToucherID, 0, choice + " isn't in the White list");                            llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                            llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                            return;                        }                        else {                            gLstIgnore = llDeleteSubList(gLstIgnore, j,j);                            llRegionSayTo(gKeyToucherID, 0, choice + " has been removed from the White list");                        }                    }                    llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                }                else if (gIntWhiteAD == 3) // ensure we should be here adding to the Administrators List                {                    if(~llListFindList(gLstAdminNames, [choice]))                    {                        llRegionSayTo(gKeyToucherID, 0, choice + " is already in the Admin List");                    }                    else if(~llListFindList(gLstIgnore, [choice]))                    {                        gLstAdminNames = gLstAdminNames + [choice];                        llRegionSayTo(gKeyToucherID, 0, choice + " has been added to the Administrators list");                    }                    else if(~llListFindList(gLstEjected, [choice]))                    {                        integer j = llListFindList(gLstEjected, [choice]);                        gLstEjected = llDeleteSubList(gLstEjected, j,j);                        llRegionSayTo(gKeyToucherID, 0, choice + " was in the Ejected list " + choice + "  has been removed from the Ejected list" );                        if(~llListFindList(gLstBan, [choice]))                        {                            integer k = llListFindList (gLstBan, [choice]);                            gLstBan = llDeleteSubList(gLstBan,k,k + 1 );                        }                        gLstAdminNames = gLstAdminNames + [choice];                        gLstIgnore = gLstIgnore + [choice];                        llRegionSayTo(gKeyToucherID, 0, choice + " has been added to the Administrators list");                    }                    else                    {                        gLstAdminNames = gLstAdminNames + [choice];                        gLstIgnore = gLstIgnore + [choice];                        llRegionSayTo(gKeyToucherID, 0, choice + " has been added to the Administrators list");                    }                    gIntWhiteAD = 0;                    llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                }                else if (gIntWhiteAD == 4) // ensure we should be here to remove from Administrators list                {                    integer j = llListFindList(gLstAdminNames, [choice]);                    if ( j == -1)                    {                        llRegionSayTo(gKeyToucherID, 0, choice + " isn't in the Administrators list");                    }                    else                    {                        gLstAdminNames = llDeleteSubList(gLstAdminNames, j,j); // remove the person from the admin list                        llRegionSayTo(gKeyToucherID, 0, choice + " has been removed from the Administators list");                    }                    gIntWhiteAD = 0;                    llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                }                }                else if (gIntSetRange == 1) // set the scanner range                {                    gIntRange = (integer) choice;                    if (gIntRange)                    {                        gStrRange = choice;                        gFltRange = (float) gIntRange;                        llSensorRemove();                        llSensorRepeat("", "", AGENT, gFltRange, PI, gFltScanRate);                        gIntActive = 1;                        llRegionSayTo(gKeyToucherID, 0, "Changed range to: " + gStrRange + " meters and restarted the scanner");                        llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds" + " Scan Rate is set at " + gStrScanRate + " seconds.");                    }                    else                    {                        llRegionSayTo(gKeyToucherID, 0, "Invalid entry. Please enter an integer in meters up to 96 meters.");                    }                    llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                    gIntSetRange = 0;                }                else if (gIntSetWarnTime == 1) // set the scan warn time                {                    gIntWarnTime = (integer) choice;                    if (gIntWarnTime)                    {                        gStrWarnTime = choice;                        gFltWarnTime = (integer) gIntWarnTime;                        llRegionSayTo(gKeyToucherID, 0, " Warning time has been changed to " + gStrWarnTime + " seconds");                    }                    else                    {                        llRegionSayTo(gKeyToucherID, 0, "Invalid entry. Please try again!");                    }                    llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                    gIntSetWarnTime = 0;                }                else if (gIntEjected == 1) // remove an avi from the Ejected list                {                    integer j = llListFindList(gLstEjected, [choice]);                    if ( j == -1)                    {                        llRegionSayTo(gKeyToucherID, 0, choice + " isn't in the Ejected list");                        llListenRemove(gIntListen_Id_Chat); // remove the listen on channel_chat                        gIntEjected = 0;                        return;                    }                    gLstEjected = llDeleteSubList(gLstEjected, j,j);                    llRegionSayTo(gKeyToucherID, 0, choice + " has been removed from the Ejected list");                    gIntEjected = 0;                    llListenRemove(gIntListen_Id_Chat); // remove the listen on channel_chat                }                else if (gIntEjected == 2) // clear the Ejected list                {                    if (choice == "y")                    {                        llRegionSayTo(gKeyToucherID, 0, "Resetting the Ejected List");                        gLstEjected = [];                    }                    if (choice == "n")                    {                        llRegionSayTo(gKeyToucherID, 0, "Aborting");                    }                    gIntEjected = 0;                    llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                }                else if (gIntBanned == 1) // clear the Ban list                {                    if (choice == "y")                    {                        llRegionSayTo(gKeyToucherID, 0, "Resetting the Banned List");                        gLstBan = [];                    }                    if (choice == "n")                    {                        llRegionSayTo(gKeyToucherID, 0, "Aborting");                    }                    gIntBanned = 0;                    llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat                }                else if (gIntSetBanTime == 1) // set the bantime in hours                {                    gIntBanTime = (integer) choice;                    if (gIntBanTime)                    {                        gIntBanTime = gIntBanTime * 3600; // convert hours entered to seconds (3600 seconds in an hour)                        gIntBanTimeH = gIntBanTime / 3600;                        gStrBanTime = (string) gIntBanTimeH;                        string hours;                        if (gIntBanTime > 3600)                        {                            hours = " hours";                        }                        else                        {                            hours = " hour";                        }                        llRegionSayTo(gKeyToucherID, 0, " Ban time set to " + gStrBanTime +  hours);                    }                    else                    {                        llRegionSayTo(gKeyToucherID, 0, "Invalid entry. Please enter an integer in hours. i.e. Enter 2 for 2 hours");                    }                    gIntSetBanTime = 0;                    llListenRemove(gIntListen_Id_Chat); // remove the listen on channel_chat                }                else if (gIntSetScanRate == 1) // set the scan rate in seconds                {                    gFltScanRate = (float) choice;                    if (gFltScanRate)                    {                        gStrScanRate = choice;                        llRegionSayTo(gKeyToucherID, 0, "ScanRate set to " + gStrScanRate + " seconds. Restarted the scanner");                        llSensorRemove();                        llSensorRepeat("", "", AGENT, gFltRange, PI, gFltScanRate);                        gIntActive = 1;                        llRegionSayTo(gKeyToucherID, 0, "Security Orb is active and scanning at " + gStrRange + " meters in eject mode" + " Scan Rate is set at " + gStrScanRate + " seconds.");                        llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds");                    }                    else                    {                        llRegionSayTo(gKeyToucherID, 0, "Invalid Entry. Please enter a Scan Rate between 10 and 60 seconds. i.e /7 30");                    }                    gIntSetScanRate = 0;                    llListenRemove(gIntListen_Id_Chat); // remove the listen on channel_chat                }            }        }    }    timer()    { //TIMES UP!        llListenRemove(gIntListen_Id_Chat);        llListenRemove(gIntListen_Id);        gIntMasterRW = FALSE;        llRegionSayTo(gKeyToucherID, 0, "Times is up to make changes");        llSetTimerEvent(0); // Stop the timer from being called repeatedly    }    sensor(integer nr)    { // Here is where all people found in its vincinity are returned.        // first we make sure the scanner is active before we continue        if (gIntActive == 1)        {            integer i;            do{                integer found = FALSE;                if (gIntGroupSet == 1)                {                    if (llSameGroup(llDetectedKey(i)))                    {                        found = TRUE;                    }                }                string vNameTest = llGetUsername(llDetectedKey(i));                integer j;                // we scan through the list of names to see if this person is whitelisted                if(~llListFindList(gLstIgnore,[vNameTest])){                found = TRUE;                }            /*    for (j = 0; j < llGetListLength(gLstIgnore); ++j)                {                    if (llList2String(gLstIgnore, j) == vNameTest){                        // they are in in the white list                        found = TRUE;                    }                } */                // verify the avi is on our parcel                vector pos = llDetectedPos(i);                string pname = parcelName(pos);                if (pname == gParcelName)                {                    gIntVectorX = 1;                }                if (found == FALSE && gIntVectorX == 1 && llOverMyLand(llDetectedKey(i)) && (llDetectedKey(i) != llGetOwner())) // When the person has not been found we start to check if this person is on our land. And on popuar reques we will never kick the owner                 {                    if (~llListFindList (gLstEjectR, [vNameTest]))                    {                        integer index = llListFindList(gLstEjectR, [vNameTest]);                        integer BOOT_TIME_TEST = llList2Integer(gLstEjectR, index + 1);                        integer BOOT_TIME = llGetUnixTime();                        integer timetest = (BOOT_TIME - BOOT_TIME_TEST);                        if (timetest  <=  gIntBanTime )                        {                            llInstantMessage(llDetectedKey(i), "You are on private property. This is the second time you have been detected. If you are detected again you will be teleported home with no warning!"); // Let's notify this user that he has a few seconds to leave                            if (llOverMyLand(llDetectedKey(i)))                            {                                llInstantMessage(llDetectedKey(i), "GOODBYE!");                                llInstantMessage(llGetOwner(), "Ejecting from our home: "+ vNameTest);                                llEjectFromLand(llDetectedKey(i));                                gLstBan = gLstBan + [vNameTest, llGetUnixTime()];                                gLstEjectR = llDeleteSubList(gLstEjectR,index,index + 1 );                            }                        }                        if (timetest  >=  gIntBanTime )                        {                            gLstEjectR = llDeleteSubList(gLstEjectR,index,index + 1 );                        }                        if (llGetListLength(gLstEjectR) > gIntEject_LstLen)                        {                            gLstEjectR = llDeleteSubList(gLstEjectR, 0, 1 );                        }                    }                    else if (~llListFindList(gLstBan, [vNameTest]))                    {                        integer index = llListFindList(gLstBan, [vNameTest]);                        integer BOOT_TIME_TEST = llList2Integer(gLstBan, index + 1);                        integer BOOT_TIME = llGetUnixTime();                        integer timetest = (BOOT_TIME - BOOT_TIME_TEST);                        if (timetest  <=  gIntBanTime )                        {                            llInstantMessage(llDetectedKey(i), "You have been twice ejected recently. Ejecting Home!");                            llTeleportAgentHome (llDetectedKey(i));                            llInstantMessage(llGetOwner(), "Ejecting from our home: "+vNameTest + ". Ejected within the last hour. No warning");                        }                        if (timetest  >=  gIntBanTime )                        {                            gLstBan = llDeleteSubList(gLstBan,index,index + 1 );                        }                        // auto purge                        if (llGetListLength(gLstBan) > gIntEject_LstLen)                        {                            gLstBan = llDeleteSubList(gLstBan, 0, 1 );                        }                    }                    else                    {                        // let's notify this user that they have a few seconds to leave                        llInstantMessage(llDetectedKey(i), "You are on private property. You will be ejected from this parcel in " + gStrWarnTime + " seconds.");                        // wait the time we gave them to leave                        llSleep(gFltWarnTime);                        if (llOverMyLand(llDetectedKey(i))) // Ok let's see if they have left.                        { // if they are still on lets say BYE to them, and tell the owner someone is kicked off the land                            llInstantMessage(llDetectedKey(i), "GOODBYE!");                            llInstantMessage(llGetOwner(), "Ejecting from our home: "+vNameTest);                            // and finaly we really kick them off                            llEjectFromLand(llDetectedKey(i));                            gLstEjectR = gLstEjectR + [vNameTest, llGetUnixTime()];                            if (~llListFindList(gLstEjected, [vNameTest]))                            {                                return; // already in the ejected list so exit                            }                            else                            {                                gLstEjected = gLstEjected + vNameTest;                            }                        }                        // auto purge                        if (llGetListLength(gLstEjected) > gIntEject_LstLen)                        {                            gLstEjected = llDeleteSubList(gLstEjected, 0, 1 );                        }                    }                }            }while ((++i) < nr);        }    }}

 

 

 

Link to comment
Share on other sites

Sorry, was an extra day before I got back to this / got to test it.

The case sensitive issue has been taken care of.

Now I may be misunderstanding something here.  I thought part of the idea was to not add Admins to the White List but to ignore (read / not eject) Admins separately?  It is still adding the Admins to the White List.

Otherwise appears to be working perfectly. 

Also, I'm a tad confused by two things in the script. 

 

64 // limit the white list to 25 users
65 integer gIntWhite_LstLen = 25;
66 // limit ejected list to 25 (25 plus the unix time stamp for each avi
67 integer gIntEject_LstLen = 50;
68 // limit admin list to 12 users
69 integer gIntAdmin_LstLen = 6;

1.  I had asked about the consequence of increasing the number of Ava's that could be added to the White List and Rolig said I could run out of Memory.  But I see it can store 50 names in the eject list.

2.  Why the difference in numbers for Admins between line 68 and line 69?

And again, many thanks for your help. 

ETA:  I guess what I may be not understanding is if it the memory length in a list that causes the problem or is it the total of all lists in an individual script?

 

Link to comment
Share on other sites

Well, it's true that the reason to worry about making the lists too long is that you'll exceed memory and lock up the script.  Scripters like to be pretty conservative about staying away from those limits.  Without actually testing this particular script, its hard to say how many more names you might be able to add before getting into trouble.

Notice that the comment on line 66 says to limit the ejected list to 25 plus the unix time stamp for each avi.  That is, the number of elements in the list named gLstEjectR should be < 50 (= 25 + 25).  The variable called gIntEject_LstLen is not the number of ejected avatar names.  It's the number of elements in that list, including the timestamps.

The same is not true for gLstAdminNames, which is simply a list of names. That one's a little confusing except remember that there are two "administrator" lists, combined on line 115.  The second list, gLstOwnerName could have some unspecified number of people in it too. I suspect that the note on line 68 is just saying "Don't let gInetAdmin_LstLen + llGetListLength(gLstOwnerName) get bigger than 12."

Comment lines in scripts are generally the scripter's notes to herself.  Especially in a script this long, it's easy to forget why you did things the way you did.  If a scripter doesn't lead a trail of breadcrumbs, she won't be able to understand her own work six months later.  The notes aren't necessarily meant to make sense to anyone else, though.  The important thing is that the scripter knows what they mean.

Link to comment
Share on other sites

I simply adopted Rolig's solution which, in effect, says that the limit to the length of gLstIgnore should be the sum of the limits of various lists of people we're ignoring (whitelist, admins and owners).   

It would certainly be possible to rewrite the script in the way you suggest, and it would probably be a better script that way, but that would involve a major rewrite rather simply changing one line.   

Link to comment
Share on other sites

Thanks again to both you and Rolig for your help and insight.

I looked at and tried several scripts before settling on this one and chose it for it's overall ease of use and that I could customize it.

On thing I disliked about some of the security orbs I saw for sale was there was no way to reset the eject time.  I think 10 seconds is ridiculous.  I wanted to give someone time to exit graciously.

Also being able to change the warning message:

"You are now trespassing on sovereign Martian territory.  If you choose to say you may find your self the subject of prodding and poking by our scientists..........."

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4154 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...