Message Board
default
{
string title = "Aktuelle Termine";
string subtitle = "September 2008";
string text = "";
string draw = "";
state_entry()
{
llListen(42, "", llGetOwner(), "");
llListen(43, "", llGetOwner(), "");
llListen(44, "", llGetOwner(), "");
}
listen( integer channel, string name, key id, string message )
{
llOwnerSay("Chan: " + channel + ", Msg: " + message);
if (channel == 44) {
title = message;
}
if (channel == 43) {
text = "";
redoBoard();
}
if (channel == 42) {
text += message + "\n";
redoBoard();
}
}
void redoBoard()
{
resetText();
drawTitle(title);
drawSubTitle(subtitle);
drawText(text);
commitText();
}
void drawTitle(string s)
{
draw += "MoveTo 40,80; PenColour RED; FontSize 48; Text " + s + ";";
}
void drawSubTitle(string s)
{
draw += "MoveTo 160,160; FontSize 32; Text " + s + ";";
}
void drawText(string s)
{
draw += "PenColour BLACK; MoveTo 40,220; FontSize 32; Text " + text + ";";
}
void resetText()
{
draw = "";
}
void commitText()
{
osSetDynamicTextureData("", "vector", draw, "1024", 0);
}
}