LSL feature request. The described function does not exist. This article is a feature request.
If a prim exists in the link chain at linknumber, displays text that hovers over the prim with specific color and translucency (specified with alpha).
void llSetLinkText( integer linknumber, string text, vector color, float alpha );
Forced delay: 0.0 seconds. Energy: 10.0.
LINK_* flagSee: SVC-2367
Note that this feature was added under a different name, see PRIM_TEXT.
SetLinkText(integer linknumber, string text, vector color, float alpha)
{
llSetLinkPrimitiveParamsFast(linknumber, [PRIM_TEXT, text, color, alpha]);
}
|
|
|||||||||||||||||||||
llSetLinkText(linknumber, "", <1.0, 1.0, 1.0>, 1.0);
llSetLinkText(LINK_THIS, "Doesn't work...\n", <1.0, 0.0, 0.0>, 1.0);
llSetLinkText(LINK_THIS, "It works!\n ", <0.0, 1.0, 0.0>, 1.0);
Example of how llSetLinkText could be used to show prims names and link numbers in red text:
default
{
state_entry()
{
integer link = llGetNumberOfPrims();
for (; link >= 0; --link)
{
llSetLinkText(link, (string)link + ": " + llGetLinkName(link), <1.0, 0.0, 0.0>, 1.0);
}
}
}
By default the floating text will appear on a single line. However, the floating text can be spread over multiple lines by using a line break "\n" (read SplitLine in section 'See Also').
llSetLinkText(LINK_THIS, "First line\nSecond line", <1.0, 1.0, 1.0>, 1.0);
| Color | Code |
|---|---|
| White | <1.0, 1.0, 1.0> |
| Gray | <0.5, 0.5, 0.5> |
| Black | <0.0, 0.0, 0.0> |
| Red | <1.0, 0.0, 0.0> |
| Green | <0.0, 1.0, 0.0> |
| Blue | <0.0, 0.0, 1.0> |
The x, y & z components of the vector are used to represent red, green, and blue respectively. The range is different then traditional RGB, instead of being 0 -> 255, LSL uses 0 -> 1. <1.0, 1.0, 1.0>, means "white" and <0.0, 0.0, 0.0> means "black":
llSetLinkText(LINK_THIS,"White", <1.0, 1.0, 1.0>, 1.0);
llSetLinkText(LINK_THIS, "Black", <0.0, 0.0, 0.0>, 1.0);
The 1.0 is the alpha setting. 1.0 means fully opaque, and 0.0 would be completely transparent (invisible):
llSetLinkText(LINK_THIS, "Half transparent green", <0.0, 1.0, 0.0>, 0.5);
Create this script in inventory and drag it onto an object to erase all its set texts:
// http://wiki.secondlife.com/wiki/llSetLinkText
default
{
state_entry()
{
llSetLinkText(LINK_SET, "", <1.0, 1.0, 1.0>, 1.0);
llRemoveInventory(llGetScriptName());
}
}
Each prim that makes up an object has an address, a link number. To access a specific prim in the object, the prim's link number must be known. In addition to prims having link numbers, avatars seated upon the object do as well.
When an avatar sits on an object, it is added to the end of the link set and will have the largest link number. In addition to this, while an avatar is seated upon an object, the object is unable to link or unlink prims without unseating all avatars first.
There are two functions of interest when trying to find the number of prims and avatars on an object.
llGetNumberOfPrims() - Returns the number of prims and seated avatars.llGetObjectPrimCount(llGetKey()) - Returns only the number of prims in the object but will return zero for attachments.integer GetPrimCount() { //always returns only the number of prims
if(llGetAttached())//Is it attached?
return llGetNumberOfPrims();//returns avatars and prims but attachments can't be sat on.
return llGetObjectPrimCount(llGetKey());//returns only prims but won't work on attachments.
}See llGetNumberOfPrims for more about counting prims and avatars.
If a script located in a child prim erroneously attempts to access link 0, it will get or set the property of the linkset's root prim. This bug (BUG-5049) is preserved for broken legacy scripts.
If you use LINK_THIS as linknumber, this function will have the same effect than llSetText