07-26-2007 21:36
Time to end my silent protest of the failure to fix embedded php/lsl tags for posting script here . . .

Originally developed for crosses above the graves of dead SLP Bonus Slot Machines, this 'memorial script' displays comments submitted by avatars as floating text. Of course such a script could be used for many other purposes, such as receiving public comments or serving as a low prim bulletin board.

This script records up to 20 messages submitted by avatars (preserving the most recent 20) and displays the messages one at a time, in random or linear order, as floating text above the object containing the script. Each message is displayed in a random color.

Avatars submit text by clicking "Eulogize" on the touch menu of the object or by touching the object.

This script also accepts donations or payments.

MEMORIAL SCRIPT INSTRUCTIONS:

Edit the default text that appears over the memorial.

string DEFAULT_TEXT = "[YOUR DESCRIPTIVE FLOATING TEXT]";

Change integer IM_OWNER = TRUE; to integer IM_OWNER = FALSE; if you don't want to recieve submitted eulogies via instant message.

Change integer integer RANDOM = TRUE; to integer integer RANDOM = FALSE; if you want the messages displayed in the order recieved.

LGA No Rights Reserved 2007

CODE


integer IM_OWNER = TRUE;
integer RANDOM = TRUE;
list agents = [];
list handles = [];
list messages = [];

string DEFAULT_TEXT = "SL Gambling\nR.I.P.\nDeactivated 7-26-07\nTouch to leave a Eulogy.\nPay to donate to Lost Causes.";

default
{
on_rez(integer start_param)
{
llSetTouchText("Eulogize");
}

state_entry()
{
llSetText(DEFAULT_TEXT,<.95,.12,.06>,1);
messages += DEFAULT_TEXT;
llSetPayPrice(PAY_DEFAULT, [10, 40, 100, 1000]);
}

touch_start(integer total_number)
{
integer i;
for (i=0; i<total_number; i++)
{
agents += llDetectedKey(i);
handles += llListen(0, "", llDetectedKey(i), "");
llSay(0, llDetectedName(i) + ", the next 255 characters you type in chat will appear as a Eulogy on " + llGetObjectName() + ".");
}
}

listen(integer channel, string name, key id, string message)
{
integer agent_index = llListFindList(agents, [id]);
if (agent_index != -1)
{
llListenRemove(llList2Integer(handles, agent_index));
handles = llDeleteSubList(handles, agent_index, agent_index);
agents = llDeleteSubList(agents, agent_index, agent_index);
messages += message + " - " + name;
llSay(0, "Thank you, " + name + ", your eulogy has been added to the cue.");
}
if ( llGetListLength(messages) > 20 ) llDeleteSubList(messages,2,2);
llSetText(message + " - " + name,<.12,.95,.06>,1);
if ( IM_OWNER == TRUE ) llInstantMessage(llGetOwner(),message);
llSetTimerEvent(12);
}

timer()
{
integer msg_total = llGetListLength(messages);

if ( msg_total > 0 )
{
if ( RANDOM == TRUE ) llListRandomize(messages,1);
integer count;
for ( count=0; count<msg_total; count++)
{
float x = llFrand(1.0);
float y = llFrand(1.0);
float z = llFrand(1.0);
vector Y_COLOR = <x,y,z>;
vector COLOR = Y_COLOR;
llSetText(llList2String(messages,count),COLOR,1);
llSleep(5);
}
llSetText(DEFAULT_TEXT,<.95,.12,.06>,1);
}
}

money(key giver, integer amount)
{
llInstantMessage(giver,"Thank's for your $" + (string)amount + " donation.");
}
}