Change font size
It is currently Tue Dec 18, 2018 12:37 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: Visitor List Recorder
PostPosted: Tue Sep 02, 2008 2:10 am 
Site Admin
User avatar

Joined: Sat Feb 02, 2008 5:27 pm
Posts: 843
this script will create a visitor list with total count with range setting.
{L_CODE}:
// Global variables
list visitor_list;
float range = 10.0; // in meters
float rate = 1.0; // in seconds


// Functions
integer isNameOnList( string name )
{
    integer len = llGetListLength( visitor_list );
    integer i;
    for( i = 0; i < len; i++ )
    {
        if( llList2String(visitor_list, i) == name )
        {
            return TRUE;
        }
    }
    return FALSE;
}

// States
default
{
    state_entry()
    {
        llSay(0, "Visitor List Maker started...");
        llSay(0, "The owner can say 'help' for instructions.");
        llSensorRepeat( "", "", AGENT, range, TWO_PI, rate );
        llListen(0, "", llGetOwner(), "");
    }
     
               
    sensor( integer number_detected )
    {
        integer i;
        for( i = 0; i < number_detected; i++ )
        {
            if( llDetectedKey( i ) != llGetOwner() )
            {
                string detected_name = llDetectedName( i );
                if( isNameOnList( detected_name ) == FALSE )
                {
                    visitor_list += detected_name;
                }
            }
        }   
    }
   
    listen( integer channel, string name, key id, string message )
    {
        if( id != llGetOwner() )
        {
            return;
        }
       
        if( message == "help" )
        {
            llSay( 0, "This object records the names of everyone who" );
            llSay( 0, "comes within "+ (string)range + " meters." );
            llSay( 0, "Commands the owner can say:" );
            llSay( 0, "'help'  - Shows these instructions." );
            llSay( 0, "'say list'   - Says the names of all visitors on the list.");
            llSay( 0, "'reset list' - Removes all the names from the list." );
        }
        else
        if( message == "say list" )
        {
            llSay( 0, "Visitor List:" );
            integer len = llGetListLength( visitor_list );
            integer i;
            for( i = 0; i < len; i++ )
            {
                llSay( 0, llList2String(visitor_list, i) );
            }
            llSay( 0, "Total = " + (string)len );
        }
        else
        if( message == "reset list" )
        {
            visitor_list = llDeleteSubList(visitor_list, 0, llGetListLength(visitor_list));
            llSay( 0, "Done resetting.");
        }
    }       
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net