Jump to content

Busy Venue Doorkeeper


Recommended Posts

a conversation here

led to this script provided as a public service

is a venue doorkeeper script that allows time for venue patrons body-attached scripts to settle, and gives the patrons time to reduce their attached scripts before they get ejected. I wrote it off the top of my head, so haven't tested it. Should be right tho, if not then say so and I fix it

// discreet doorkeeper
// script is provided as a public service. (public domain)
// as wrote, waits for not less than 5 minutes to warn a patron who exceeds attached script time
// issues a 2nd warning, 5 minutes after the 1st warning
// then waits for another 5 minutes for the patron to oblige the warnings, before excluding patron from the venue


float MAX_LIMIT = 2.0;  // some max script time total in millisconds. 2.0 is 2 milliseconds
float SCAN_TIME = 300.0;  // 300.0 is 5 minutes

list patrons;
list overstays;

default
{
   state_entry()
   {
      patrons = llGetAgentList(AGENT_LIST_PARCEL_OWNER, []); // initial patrons list
      llSetTimerEvent(SCAN_TIME);
   }

   timer()
   {      
      list overs;
      integer i = llGetListLength(patrons);
      while (~--i)
      {
         key patron = llList2Key(patrons, i);         
         if (llGetAgentSize(patron))  // patron still here since last detected
         {
            // so get their attached script time
            float total;
            list attached = llGetAttachedList(patron);
            integer j = llGetListLength(attached);
            while (~--j)
            {   
               total += 1000.0 * llList2Float(llGetObjectDetails(llList2Key(attached, j), [OBJECT_SCRIPT_TIME]), 1);
            }
            
            // action only when script time total exceeds the limit
            if (total > MAX_LIMIT)
            {
               integer k = llListFindList(overstays, [patron]);
               if (~k)  // patron is on overstays list
               {
                  integer period = llGetUnixTime() - llList2Integer(overstays, k + 1);
                  if (period < 3 * SCAN_TIME)
                  {
                     if (period >= SCAN_TIME) // issues warning two times
                     {
                        llRegionSayTo(patron, 0, "Hi! " + llGetDisplayName(patron)
                           + ". Your detected script time of " + llDeleteSubString((string)total, -4, -1)
                           + "ms, is over " + llDeleteSubString((string)MAX_LIMIT, -4, -1) + "ms"
                           + ". Could you help us out please by removing some of your body attached scripts"
                           + ". HUDs are OK to keep on. Thank you!"
                        );
                     }
                     // keep patron on overstays list
                     overs += llList2List(overstays, k, k+1);
                  }    
                  else // has been 3 scans with 2 warnings issued. so send patron home
                  {
                     llRegionSayTo(patron, 0, "Sorry! " + llGetDisplayName(patron)
                        + ". You never reduced your body attached scripts to below "
                        + llDeleteSubString((string)MAX_LIMIT, -4, -1) + "ms"
                        + ". We going to have to send you home. Please reduce and come back again. Thank you!"
                     );
                     llTeleportAgentHome(patron);
                  }
               }
               else // not on overstays list so append
               {  
                  overs += [patron, llGetUnixTime()];
               }
            }
         }
      }
      overstays = overs;  // update the overstays list
      patrons = llGetAgentList(AGENT_LIST_PARCEL_OWNER, []); // get whoever is now present
   }
}

 

 

 

 

  • Like 1
  • Thanks 1
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...