
CODE
// Left/Right Justify llSetText
// by Zodiakos Absolute
// Note: It works funky and is not correct. This is as close as *I* can get it without resorting to arcane lists lists of glyph dimensions and such. Works best on numbers, which seem fairly constant width.
// To use, just use LeftJustify or RightJustify, with the parameter as the text you want to use.
// The script works by padding each letter with two spaces on either the front or the end of the string. This isn't perfect, but might do the trick depending on what you use it for.
LeftJustify(string text)
{
integer i;
string dotext;
for(i=0;i<llStringLength(text);i++)
{
dotext+=" ";
}
dotext+=text;
llSetText(dotext, <1,1,1>, 1);
}
RightJustify(string text)
{
integer i;
for(i=0;i<llStringLength(text);i++)
{
text+=" ";
}
llSetText(text, <1,1,1>, 1);
}
default
{
state_entry()
{
llListen(0,"",NULL_KEY,"");
}
listen(integer channel, string name, key id, string message)
{
RightJustify(message);
}
}