Lauftext
Wird das Skript angezogen (also das dazugehörige Objekt), erscheint ein Lauftext, der ständig seine Farbe ändert. Einstellbar ist es per Chat.
// script copyright by Rebekka Revnik
list ColorNames = ["rot", "gelb", "grün", "hellgrün", "olive", "blau", "hellblau", "dunkelblau", "lila", "pink", "braun", "grau", "silber", "schwarz", "weiß"];
list ColorVals = [<255,0,0>,<255,255,0>,<0,128,0>,<0,255,0>,<128,128,0>,<0,0,255>,<0,255,255>,<0,0,128>,<128,0,128>,<255,0,255>,<128,0,0>,<192,192,192>,<128,128,128>,<0,0,0>,<255,255,255>];
float Time = 0.05;
integer Count = 2;
integer Count1 = Count;
integer Pos = 0;
integer Width = 20;
integer Channel = 45;
integer id;
integer Zufall = FALSE;
vector Color = <1,0,0>;
string Text = "Dies ist ein Testtext. Dies ist ein Testtext.";
string Display = "";
StepLeft()
{
if (Text == "") return;
Display = llGetSubString(Text, Pos, Pos + Width - 1);
Pos++;
if (Pos >= llStringLength(Text) / 2) Pos =0;
}
default
{
attach(key attached)
{
if (attached != NULL_KEY)
{
llSetAlpha(0,ALL_SIDES);
llSetText(Display, Color, 1.0);
llSetTimerEvent(Time);
llOwnerSay("Gib /45 hilfe ein, um den Hilfstext anzuzeigen");
id = llListen(Channel,"", llGetOwner(), "");
} else
{
llSetAlpha(1,ALL_SIDES);
llSetTimerEvent(0.0);
llListenRemove(id);
}
}
timer()
{
StepLeft();
if (Zufall)
{
Count1--;
if (Count1 == 0)
{
Color.x = llFrand(1);
Color.y = llFrand(1);
Color.z = llFrand(1);
Count1 = Count;
}
}
llSetText(Display, Color, 1.0);
}
listen(integer channel, string name, key id, string message)
{
list msglist;
string msg;
msglist = llParseString2List(message, [" "], []);
msg = llToLower(llList2String(msglist, 0));
if (msg == "text")
{
if (llGetListLength(msglist) > 1)
{
Text = llGetSubString(message, 5, llStringLength(message) - 1);
Text += " " + Text;
Pos = 0;
} else Text = "";
} else if (msg == "hilfe") llGiveInventory(llGetOwner(), "Notecard");
else if (msg == "breite")
{
integer x;
x = (integer)(llList2String(msglist,1));
if (x > 0) Width = x;
} else if (msg == "farbe")
{
if (llList2String(msglist, 1) == "zufall") Zufall = TRUE;
else
{
integer x;
x = llListFindList(ColorNames, [llList2String(msglist, 1)]);
if (x != -1)
{ Color = llList2Vector(ColorVals, x);
Zufall = FALSE;
}
}
}
}
}