Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Greeter and automatic notecard giver script

Benz Bingyi
Registered User
Join date: 21 May 2007
Posts: 48
05-24-2007 14:45
This is a script that will greet and give avatars a notecard without them touching anything.
Notecards will only be given once because a list is being created with avatars who allready recieved the notecard.
This can be resetted when you reset the list whit the command: reset list



CODE

string welcome;

// Global variables
list visitor_list;
float range = 15.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;
}

init()
{
welcome = llGetObjectDesc();
llOwnerSay( "Visitor List Maker started...");
llOwnerSay( "The owner can say 'help' for instructions.");
llSensorRepeat( "", "", AGENT, range, TWO_PI, rate );
llListen(0, "", llGetOwner(), "");
}
// States
default
{
state_entry()
{
init();
}
on_rez( integer param )
{
init();
}
touch_start( integer num )
{
welcome = llGetObjectDesc();
}

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 )
{
llInstantMessage( llDetectedKey( i ), welcome + detected_name);
visitor_list += detected_name;
llOwnerSay ( detected_name + " has been added to your visitors list at " + llGetRegionName() );
llGiveInventory(llDetectedKey(0), "Benz Shop low priced lots of flexi items.");
}
}
}
}

listen( integer channel, string name, key id, string message )
{
if( id != llGetOwner() )
{
return;
}

if( message == "help" )
{
llOwnerSay( "This object records the names of everyone who" );
llOwnerSay( "comes within "+ (string)range + " meters." );
llOwnerSay( "Commands the owner can say:" );
llOwnerSay( "'help' - Shows these instructions." );
llOwnerSay( "'say list' - Says the names of all visitors on the list.");
llOwnerSay( "'reset list' - Removes all the names from the list." );
llOwnerSay ( "TO change the greeting - change the object description and touch the object" );
}
else
if( message == "say list" )
{
llOwnerSay( "Visitor List:" );
integer len = llGetListLength( visitor_list );
integer i;
for( i = 0; i < len; i++ )
{
llOwnerSay( llList2String(visitor_list, i) );
}
llOwnerSay( "Total = " + (string)len );
}
else
if( message == "reset list" )
{
visitor_list = llDeleteSubList(visitor_list, 0, llGetListLength(visitor_list));
llOwnerSay( "Done resetting.");
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
05-31-2007 09:48
/54/1b/187662/1.html
_____________________
i've got nothing. ;)
Marylou Lane
Registered User
Join date: 3 Mar 2007
Posts: 60
06-05-2007 09:02
excuz me but your script doesn't work...
nothing is happening and the touch "button" doesn't react when I touch...
it only counts visitors but doesn't give anything...
too bad because this would interest me too... a script that gives automatically a notecard and a LM....
Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
Missing Something
07-20-2007 15:24
hmm... just what I wanted but not working for me.... (insert sad face here)
Angel Lamar
Registered User
Join date: 19 Jul 2006
Posts: 7
Inventory being given to owner
01-03-2008 20:19
when i used this...the is inventory notecard get sent to me not the person...is there something i have to change? would someone have a look at this and see if something is wrong pls...and ty for posting this :)