Difference between revisions of "Under Age Boot"

From Second Life Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LSL Header}}
Security device example to teleport home accounts below a minimum age limit; can be useful in combating free griefer accounts.  
Security device example to teleport home accounts below a minimum age limit; can be useful in combating free griefer accounts.  


Line 7: Line 8:
# Deed to match the land group
# Deed to match the land group
# Place the prim reasonably close to the parcel landing point
# Place the prim reasonably close to the parcel landing point
# Set the prim description field to be the minmimum age accounts must be in days  
# Set the prim description field to be the minimum age accounts; must be in days  


Operation:
Operation:
Line 13: Line 14:
# No special instructions. It operates stand alone once installed.
# No special instructions. It operates stand alone once installed.


//////////////////////////////////////////////////////////////////////////////////////
<source lang="lsl2">
//
//////////////////////////////////////////////////////////////////////////////////////
//    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 ];
   
    result += llList2Integer(days, (llList2Integer(parse_date, 1) - 1));
      
      
    if (year/4 == llRound(year/4)) result += 1;
    //Fixed the leap year calculation below  ~Casper Warden, 28/10/2015.
           
    //if (year/4 == llRound(year/4)) result += 1;
    result += llList2Integer(parse_date, 2);
    result += llFloor((year-2000) / 4);
 
    return result;
    result += llList2Integer(parse_date, 2);
}
 
   
    return result;
default
}
{
 
    on_rez(integer param)
default
    {
{
        llResetScript();
    on_rez(integer param)
    }
    {
      
        llResetScript();
    state_entry()
    }
    {
 
        AGE_LIMIT = (integer)llGetObjectDesc();
     state_entry()
          
    {
        if (AGE_LIMIT < 2)
        AGE_LIMIT = (integer)llGetObjectDesc();
        {
 
            AGE_LIMIT = 2;
         if (AGE_LIMIT < 2)
        }
        {
          
            AGE_LIMIT = 2;
        llSetObjectName("Unknown Underage Boot - " + llGetRegionName());
        }
          
 
        llVolumeDetect(TRUE);
         llSetObjectName("Unknown Underage Boot - " + llGetRegionName());
          
         llVolumeDetect(TRUE);
        if (llOverMyLand(llGetKey()) == FALSE)
         if (llOverMyLand(llGetKey()) == FALSE)
        {
        {
            llSay(0, "Requires proper group deeds to work on this land.");
            llSay(0, "Requires proper group deeds to work on this land.");
        }
        }
          
         llSensorRepeat("", "", AGENT, 100.0, PI, 1.0);
        llSensorRepeat("", "", AGENT, 100.0, PI, 1.0);
         llOwnerSay("Set Avatar age in the description, currently it is set for " +
          
            (string)AGE_LIMIT + " days.");
        llOwnerSay("Set Avatar age in the description, currently it is set for " +
    }
            (string)AGE_LIMIT + " days.");
 
    }
     sensor(integer num_detected)
      
    {
    sensor(integer num_detected)
        if (llOverMyLand(llGetKey()) == FALSE)
    {
        {
        if (llOverMyLand(llGetKey()) == FALSE)
            return;
        {
        }
            return;
 
        }
         integer i;
          
 
        integer i;
         for (i = 0; i < num_detected; i++)
          
        {
        for (i = 0; i < num_detected; i++)
            key agent = llDetectedKey(i);
        {
             if (llSameGroup(agent) == FALSE)
            key agent = llDetectedKey(i);
            {
              
                if (llListFindList(agent_list, [ agent ]) < 0)
            if (llSameGroup(agent) == FALSE)
                {
            {
                    if (llGetListLength(agent_list) == 0)
                if (llListFindList(agent_list, [ agent ]) < 0)
                    {
                {
                        agent_list += agent;
                    if (llGetListLength(agent_list) == 0)
                         llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
                    {
                    }
                        agent_list += agent;
                    else
                          
                    {
                        llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
                        agent_list += agent;
                    }
                    }
                    else
                }
                    {
            }
                        agent_list += agent;
        }
                    }                      
    }
                }
 
            }
     dataserver(key queryid, string data)
        }
    {
    }
        AGE_LIMIT = (integer)llGetObjectDesc();
      
 
    dataserver(key queryid, string data)
         integer today = date2days(llGetDate());
    {
        integer age = date2days(data);
        AGE_LIMIT = (integer)llGetObjectDesc();
         key agent = llList2Key(agent_list, 0);
          
         string name = llKey2Name(agent);
        integer today = date2days(llGetDate());
 
               
         if (AGE_LIMIT < 2)
        integer age = date2days(data);
        {
          
            AGE_LIMIT = 2;
        key agent = llList2Key(agent_list, 0);
             llSetObjectDesc((string)AGE_LIMIT + " : SET AGE LIMIT HERE");
          
        }
        string name = llKey2Name(agent);
 
          
         if (name != "")
        if (AGE_LIMIT < 2)
        {
        {
            if ((today - age) < AGE_LIMIT)
            AGE_LIMIT = 2;
            {
              
                if (llOverMyLand(agent))
            llSetObjectDesc((string)AGE_LIMIT + " : SET AGE LIMIT HERE");
                {
        }
                    llSay(0, name + ", you are too young to be here.");
          
                    llTeleportAgentHome(agent);
        if (name != "")
                }
        {
            }
            if ((today - age) < AGE_LIMIT)
            else
            {
            {
                if (llOverMyLand(agent))
            }
                {
        }
                    llSay(0, name + ", you are too young to be here.");
        else
           
        {
                    llTeleportAgentHome(agent);
            llTeleportAgentHome(agent);
                }
        }
            }
 
            else
        agent_list = llDeleteSubList(agent_list, 0, 0);
            {
         if (llGetListLength(agent_list) != 0)
            }
        {
        }
            llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
        else
        }
        {
    }
            llTeleportAgentHome(agent);
}
        }
</source>
           
 
        agent_list = llDeleteSubList(agent_list, 0, 0);
 
          
{{LSLC|Library}}
        if (llGetListLength(agent_list) != 0)
        {
            llRequestAgentData(llList2Key(agent_list, 0), DATA_BORN);
        }
    }
}

Latest revision as of 10:18, 28 October 2015

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 minimum age accounts; must be in days

Operation:

  1. No special instructions. It operates stand alone once installed.
//////////////////////////////////////////////////////////////////////////////////////
//
//    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));
    
    //Fixed the leap year calculation below  ~Casper Warden, 28/10/2015.
    //if (year/4 == llRound(year/4)) result += 1;
    result += llFloor((year-2000) / 4);

    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);
        }
    }
}