Needs a menu script to work.
// This script keeps a list of messages.
// The owner can play the messages back and erase them.
// Retrieved from Free SL Scripts: http://www.gendersquare.org/sl
// Global variables
list message_list;
integer listen_id = -1; // Lets us turn off listening when we need to
string current_speaker_name = ""; // Who is currently recording a message
readList()
{
integer i;
integer count = llGetListLength( message_list );
llSay( 0, "You have " + (string) count + " messages:" );
for( i = 0; i < count; i++ )
{
llSay( 0, (string)(i+1) + ": " + llList2String(message_list, i) );
}
}
resetList()
{
message_list = llDeleteSubList(message_list, 0, llGetListLength(message_list));
llSay( 0, "Erased all messages.");
}
addMessage( string name, string message )
{
string full_message = name + " said, '" + message + "'";
message_list += full_message;
}
default
{
on_rez( integer start_param )
{
// re-initialize
message_list = llDeleteSubList(message_list, 0, llGetListLength(message_list));
listen_id = -1;
current_speaker_name = "";
}
// Listen to a single line, spoken by the person who pressed
// the "Leave Message" button.
listen( integer channel, string name, key id, string message )
{
if( (channel == 0) && (current_speaker_name == name ) )
{
addMessage( current_speaker_name, message );
llListenRemove( listen_id );
current_speaker_name = "";
listen_id = -1;
llSay(0, "Message recorded: " + message );
}
}
// Process messages from buttons
link_message(integer sender_num, integer num, string message, key id)
{
// Uses a standard button message format:
// "Button Message,