Difference between revisions of "Under Age Boot"

From Second Life Wiki
Jump to navigation Jump to search
(Brushed up and added to category index)
Line 13: Line 13:
# No special instructions. It operates stand alone once installed.
# No special instructions. It operates stand alone once installed.


//////////////////////////////////////////////////////////////////////////////////////
<lsl>
//
//////////////////////////////////////////////////////////////////////////////////////
//    Version 1.0 Release
//
//    Copyright (C) 2007, Chance Unknown
//    Version 1.0 Release
//  
//    Copyright (C) 2007, Chance Unknown
//    This library is free software; you can redistribute it and/or
//
//    modify it under the terms of the GNU Lesser General Public License
//    This library is free software; you can redistribute it and/or
//    as published by the Free Software Foundation; either
//    modify it under the terms of the GNU Lesser General Public License
//    version 2.1 of the License, or (at your option) any later version.
//    as published by the Free Software Foundation; either
//  
//    version 2.1 of the License, or (at your option) any later version.
//    This library is distributed in the hope that it will be useful,
//
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    This library is distributed in the hope that it will be useful,
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    GNU Lesser General Public License for more details.
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  
//    GNU Lesser General Public License for more details.
//    You should have received a copy of the GNU Lesser General Public License
//
//    along with this library; if not, write to the Free Software
//    You should have received a copy of the GNU Lesser General Public License
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//    along with this library; if not, write to the Free Software
//
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//////////////////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////////////////
// Set the age in the description field of the prim to reflect the SL account age
 
// of individuals to boot.
// Set the age in the description field of the prim to reflect the SL account age
// of individuals to boot.
integer AGE_LIMIT;
 
integer AGE_LIMIT;
list agent_list;
list agent_list;
 
integer date2days(string data)
integer date2days(string data)
{
{
    integer result;
    integer result;
    list parse_date = llParseString2List(data, ["-"], []);
    list parse_date = llParseString2List(data, ["-"], []);
    integer year = llList2Integer(parse_date, 0);
   
 
    integer year = llList2Integer(parse_date, 0);
    result = (year - 2000) * 365; // Bias Number to year 2000 (SL Avatars Born After Date)
           
    list days = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ];
    result = (year - 2000) * 365; // Bias Number to year 2000 (SL Avatars Born After Date)
 
    result += llList2Integer(days, (llList2Integer(parse_date, 1) - 1));
    list days = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ];
     if (year/4 == llRound(year/4)) result += 1;
   
    result += llList2Integer(parse_date, 2);
    result += llList2Integer(days, (llList2Integer(parse_date, 1) - 1));
 
      
    return result;
    if (year/4 == llRound(year/4)) result += 1;
}
           
 
    result += llList2Integer(parse_date, 2);
default
{
    return result;
    on_rez(integer param)
}
    {
   
        llResetScript();
default
    }
{
 
    on_rez(integer param)
     state_entry()
    {
    {
        llResetScript();
        AGE_LIMIT = (integer)llGetObjectDesc();
    }
 
      
         if (AGE_LIMIT < 2)
    state_entry()
        {
    {
            AGE_LIMIT = 2;
        AGE_LIMIT = (integer)llGetObjectDesc();
        }
          
 
        if (AGE_LIMIT < 2)
         llSetObjectName("Unknown Underage Boot - " + llGetRegionName());
        {
         llVolumeDetect(TRUE);
            AGE_LIMIT = 2;
         if (llOverMyLand(llGetKey()) == FALSE)
        }
        {
          
            llSay(0, "Requires proper group deeds to work on this land.");
        llSetObjectName("Unknown Underage Boot - " + llGetRegionName());
        }
          
         llSensorRepeat("", "", AGENT, 100.0, PI, 1.0);
        llVolumeDetect(TRUE);
         llOwnerSay("Set Avatar age in the description, currently it is set for " +
          
            (string)AGE_LIMIT + " days.");
        if (llOverMyLand(llGetKey()) == FALSE)
    }
        {
 
            llSay(0, "Requires proper group deeds to work on this land.");
     sensor(integer num_detected)
        }
    {
          
        if (llOverMyLand(llGetKey()) == FALSE)
        llSensorRepeat("", "", AGENT, 100.0, PI, 1.0);
        {
          
            return;
        llOwnerSay("Set Avatar age in the description, currently it is set for " +
        }
            (string)AGE_LIMIT + " days.");
 
    }
         integer i;
      
 
    sensor(integer num_detected)
         for (i = 0; i < num_detected; i++)
    {
        {
        if (llOverMyLand(llGetKey()) == FALSE)
            key agent = llDetectedKey(i);
        {
             if (llSameGroup(agent) == FALSE)
            return;
            {
        }
                if (llListFindList(agent_list, [ agent ]) < 0)
          
                {
        integer i;
                    if (llGetListLength(agent_list) == 0)
          
                    {
        for (i = 0; i < num_detected; i++)
                        agent_list += agent;
        {
                         llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
            key agent = llDetectedKey(i);
                    }
              
                    else
            if (llSameGroup(agent) == FALSE)
                    {
            {
                        agent_list += agent;
                if (llListFindList(agent_list, [ agent ]) < 0)
                    }
                {
                }
                    if (llGetListLength(agent_list) == 0)
            }
                    {
        }
                        agent_list += agent;
    }
                          
 
                        llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
     dataserver(key queryid, string data)
                    }
    {
                    else
        AGE_LIMIT = (integer)llGetObjectDesc();
                    {
 
                        agent_list += agent;
         integer today = date2days(llGetDate());
                    }                      
        integer age = date2days(data);
                }
         key agent = llList2Key(agent_list, 0);
            }
         string name = llKey2Name(agent);
        }
 
    }
         if (AGE_LIMIT < 2)
      
        {
    dataserver(key queryid, string data)
            AGE_LIMIT = 2;
    {
             llSetObjectDesc((string)AGE_LIMIT + " : SET AGE LIMIT HERE");
        AGE_LIMIT = (integer)llGetObjectDesc();
        }
          
 
        integer today = date2days(llGetDate());
         if (name != "")
               
        {
        integer age = date2days(data);
            if ((today - age) < AGE_LIMIT)
          
            {
        key agent = llList2Key(agent_list, 0);
                if (llOverMyLand(agent))
          
                {
        string name = llKey2Name(agent);
                    llSay(0, name + ", you are too young to be here.");
          
                    llTeleportAgentHome(agent);
        if (AGE_LIMIT < 2)
                }
        {
            }
            AGE_LIMIT = 2;
            else
              
            {
            llSetObjectDesc((string)AGE_LIMIT + " : SET AGE LIMIT HERE");
            }
        }
        }
          
        else
        if (name != "")
        {
        {
            llTeleportAgentHome(agent);
            if ((today - age) < AGE_LIMIT)
        }
            {
 
                if (llOverMyLand(agent))
        agent_list = llDeleteSubList(agent_list, 0, 0);
                {
         if (llGetListLength(agent_list) != 0)
                    llSay(0, name + ", you are too young to be here.");
        {
           
            llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
                    llTeleportAgentHome(agent);
        }
                }
    }
            }
}
            else
</lsl>
            {
 
            }
 
        }
{{LSLC|Library}}
        else
        {
            llTeleportAgentHome(agent);
        }
           
        agent_list = llDeleteSubList(agent_list, 0, 0);
          
        if (llGetListLength(agent_list) != 0)
        {
            llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
        }
    }
}

Revision as of 02:32, 14 December 2007

Security device example to teleport home accounts below a minimum age limit; can be useful in combating free griefer accounts.

Place this script into a single prim and decorate to taste.

Requirements:

  1. Deed to match the land group
  2. Place the prim reasonably close to the parcel landing point
  3. Set the prim description field to be the minmimum age accounts must be in days

Operation:

  1. No special instructions. It operates stand alone once installed.

<lsl> ////////////////////////////////////////////////////////////////////////////////////// // // Version 1.0 Release // Copyright (C) 2007, Chance Unknown // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // //////////////////////////////////////////////////////////////////////////////////////

// Set the age in the description field of the prim to reflect the SL account age // of individuals to boot.

integer AGE_LIMIT; list agent_list;

integer date2days(string data) {

   integer result;
   list parse_date = llParseString2List(data, ["-"], []);
   integer year = llList2Integer(parse_date, 0);
   result = (year - 2000) * 365; // Bias Number to year 2000 (SL Avatars Born After Date)
   list days = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ];
   result += llList2Integer(days, (llList2Integer(parse_date, 1) - 1));
   if (year/4 == llRound(year/4)) result += 1;
   result += llList2Integer(parse_date, 2);
   return result;

}

default {

   on_rez(integer param)
   {
       llResetScript();
   }
   state_entry()
   {
       AGE_LIMIT = (integer)llGetObjectDesc();
       if (AGE_LIMIT < 2)
       {
           AGE_LIMIT = 2;
       }
       llSetObjectName("Unknown Underage Boot - " + llGetRegionName());
       llVolumeDetect(TRUE);
       if (llOverMyLand(llGetKey()) == FALSE)
       {
           llSay(0, "Requires proper group deeds to work on this land.");
       }
       llSensorRepeat("", "", AGENT, 100.0, PI, 1.0);
       llOwnerSay("Set Avatar age in the description, currently it is set for " +
           (string)AGE_LIMIT + " days.");
   }
   sensor(integer num_detected)
   {
       if (llOverMyLand(llGetKey()) == FALSE)
       {
           return;
       }
       integer i;
       for (i = 0; i < num_detected; i++)
       {
           key agent = llDetectedKey(i);
           if (llSameGroup(agent) == FALSE)
           {
               if (llListFindList(agent_list, [ agent ]) < 0)
               {
                   if (llGetListLength(agent_list) == 0)
                   {
                       agent_list += agent;
                       llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
                   }
                   else
                   {
                       agent_list += agent;
                   }
               }
           }
       }
   }
   dataserver(key queryid, string data)
   {
       AGE_LIMIT = (integer)llGetObjectDesc();
       integer today = date2days(llGetDate());
       integer age = date2days(data);
       key agent = llList2Key(agent_list, 0);
       string name = llKey2Name(agent);
       if (AGE_LIMIT < 2)
       {
           AGE_LIMIT = 2;
           llSetObjectDesc((string)AGE_LIMIT + " : SET AGE LIMIT HERE");
       }
       if (name != "")
       {
           if ((today - age) < AGE_LIMIT)
           {
               if (llOverMyLand(agent))
               {
                   llSay(0, name + ", you are too young to be here.");
                   llTeleportAgentHome(agent);
               }
           }
           else
           {
           }
       }
       else
       {
           llTeleportAgentHome(agent);
       }
       agent_list = llDeleteSubList(agent_list, 0, 0);
       if (llGetListLength(agent_list) != 0)
       {
           llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
       }
   }

} </lsl>