Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sign Up Board

Trinity Flower
Junior Member
Join date: 13 Jul 2003
Posts: 9
08-29-2003 02:11
I need a way for ppl it be able to put there name on a sign up board. Can this be done?:confused:
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
08-29-2003 14:12
Normally I don't allow requests, but since there is such a high volume of people looking for a script similar to this, I thought I would allow it :D So lets go you script monkeys.
_____________________
i've got nothing. ;)
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
08-29-2003 23:01
A BIG thanks to Arpie Perkins who helped me truncate my commentary to readable lengths in this script :D .

CODE

// Just doing some minor cosmetic changes here.
// Gotta be careful to not overdocument, unless its a tutorial you dont need to explain the language.
// Also naming the variables well will make the code self explanatory.

//Global variables go below:
list gWhoRegistered; //List of names

integer NOT_FOUND_IN_LIST = -1; //This is declared just to keep everything clear.

default
{
state_entry()
{
llSay(0, "Registration script active.");

//Passing llGetOwner()
//tells it to only listen for the owner of the object this script is on.
llListen(0,"",llGetOwner(),"");
}

// When an avatar clicks on an object:
touch_start(integer total_number)
{
//'total_number' represents the person(s) touching the object.
//Since there can be many people touching the object,
//we need to check every instance of total_number.
//To do this, we use a loop.

llSay(0, "Touched, registering name.");

integer i; // represents the instance of total_number we're checking against.

for(i = 0; i < total_number; i++)
{
string name = llDetectedName(i); // get the name of the toucher that i represents

//Test to see if name is already registered (already in the list)
if(llListFindList(gWhoRegistered,[name]) == NOT_FOUND_IN_LIST)
{
gWhoRegistered += name; // adds name to the list

llSay(0,"Thank you for registering " + name + ".");
}
else
{
llSay(0,name + " is already registered.");
}
}
}

// When an avatar or object says something.
// It gives the channel of the message,the name of the message sender,
//the key (UUID) of the message sender, and the actual message.
listen(integer channel, string name, key id, string message)
{
if(message == "clear")
{
gWhoRegistered = []; //Clears the list.
llSay(0,"List cleared."); //Confirmation message.
}
else if(message == "list")
{
//Cycle through all the elements of the list.
//We do mostly the same thing here as we did in the 'touch_start' event.

llSay(0,"Registered names:");
integer i;

for(i = 0; i < llGetListLength(gWhoRegistered); i++)
{
//llList2String() returns the element on gWhoRegistered at position i
string name = llList2String(gWhoRegistered,i);

//Says the index where name is at, as well as the name.
//Add 1 to i because the list starts at 0, to make it easier to understand.
llSay(0,(string)(i + 1)+ ": " + name);
}

llSay(0,"Done reading list."); //Confirmation message.
}
}
}


I hope this is what you needed!

-Chris
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
Arpie Perkins
Junior Member
Join date: 21 Jul 2003
Posts: 7
thanks
08-31-2003 13:09
Thanks for the credit Chris, but it was all your work. I don't deserve it. ;-)
_____________________
/* TAANSTAFL */
Tooter Claxton
Oculea/182/217/49
Join date: 6 Oct 2006
Posts: 7
nice one
08-19-2007 01:59
just what i needed, thanks!