Translations of this page:
  • English (USA)
  • Deutsch (German)

Gruppen-Invitor with Sensor-Attachment

At first you have to create a new prim to put these two scripts in, then edit Range, Rate, BOT_KEY, BOT_GROUP and MASTER to your needs. Update the size of the Prim and WEAR it at your AV/Bot.
The Bot itself and the MASTER can use the chat commands to control the attachment.

REZ it ↔ WEAR it

Additional Features:
→ Visitor List Maker
→ Sensor-System (adjustable Range/Rate)
→ Spam Protection (only one invite per AV)
→ Automatic List Cleanup (adjustable)
→ Debug-System

Skript 1

list visitor_list;
float range = 90.0;    // in meters
float rate  = 30.0;    // in seconds

// Bot UUID ("status 3" gives you the Bot-Key at the GUI)
key BOT_KEY = " >>> HERE <<< ";

// The group UUID in which the bot will invite ("mygroups" at the GUI)
key BOT_GROUP = " >>> HERE <<< ";

// Master UUID (Bot Owner)
key MASTER=" >>> HERE <<< ";

integer gListener1; // Bot
integer gListener2; // Master
integer isNameOnList( string name )
{
    integer len = llGetListLength( visitor_list );
    integer i;
    for( i = 0; i < len; i++ )
    {
        if( llList2String(visitor_list, i) == name )
        {
            if (len > 50)
            {
                visitor_list = [];
                llSay( 0, "List Cleard.");
            }
            return TRUE;
        }
    }
    if (len > 50)
    {
        visitor_list = [];
        llSay( 0, "List Cleard.");
    }
    return FALSE;
}
default
{
    state_entry()
    {
        llSay(0, "Visitor List Maker started...");
        llSay(0, "The owners can say 'help' for instructions."); 
        llSensorRepeat( "", "", AGENT, range, TWO_PI, rate );
        gListener1 = llListen(0, "", llGetOwner(), "");
        gListener2 = llListen(0, "", (string)MASTER, "");
        llMessageLinked(LINK_THIS, 0, (string)BOT_KEY +  "|Group UID: " + (string)BOT_GROUP, NULL_KEY);
    }
    sensor( integer number_detected )
    {
        integer i;
        integer len = llGetListLength( visitor_list );
        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;
                    llMessageLinked(LINK_THIS, 0, (string)BOT_KEY +"|invite " + (string)llDetectedKey(i) + " " + (string)BOT_GROUP, NULL_KEY);
                    llSay( 0, "Invite was send." );
                    if (len > 50)
                    {
                        visitor_list = [];
                        llSay( 0, "List Cleared.");
                    }
                }
            }
        }    
    }
    listen( integer channel, string name, key id, string message )
    {
        if( message == "help" )
        {
            llSay( 0, "This object records the names of everyone who" );
            llSay( 0, "comes within "+ (string)range + " meters." );
            llSay( 0, "The list will be automatically cleared after 50 entries." );
            llSay( 0, "Commands the owners can say:" );
            llSay( 0, "'help'   - Shows these instructions." );
            llSay( 0, "'list'   - Says the names of all visitors on the list.");
            llSay( 0, "'reset'  - Removes all the names from the list." );
        }
        else
        if( message == "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" )
        {
            llListenRemove(gListener1);
            llListenRemove(gListener2);
            visitor_list = llDeleteSubList(visitor_list, 0, llGetListLength(visitor_list));
            gListener1 = llListen(0, "", llGetOwner(), "");
            gListener2 = llListen(0, "", (string)MASTER, "");
            llSleep(1);
            llSay( 0, "Done resetting.");
        }
    }        
}

Skript 2

// InstantMessage per llLinkedMessage (API-Interface)
integer DEBUG = FALSE; // Debug ON|OFF (true|false)
integer isKey(key in) 
{
    if (in) return 2;
    return (in == NULL_KEY);
}
default
{
    link_message(integer sender_num, integer num, string str, key id)
    {
        if (num != 0) { return; }
        list PARS;
        PARS = llParseString2List(str, ["|"], []);
        if (isKey(llList2Key(PARS,0)))
        {
            llInstantMessage(llList2Key(PARS,0), llList2String(PARS, 1));
        }
        if ( DEBUG )
        {
            llSay(DEBUG_CHANNEL, "debug => " + llList2String(PARS, 0) + " => " + llList2String(PARS, 1));
            llWhisper( 0, "debug => " + llList2String(PARS, 0) + " => " + llList2String(PARS, 1));
        }
    }
}



topics/group_invitor_with_sensor-attachment.txt · Last modified: 2008/09/02 14:44 (external edit)
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0