Difference between revisions of "LlSetText"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{LSL Function/color|color}}
{{LSL Function/color|color}} {{LSL Function/alpha|alpha}} {{LSL_Function
{{LSL_Function
|func_id=152
|func_id=152
|func_sleep=0.0
|func_sleep=0.0
Line 7: Line 6:
|sort=SetText
|sort=SetText
|p1_type=string|p1_name=text|p1_desc=text to display between the quotes
|p1_type=string|p1_name=text|p1_desc=text to display between the quotes
|p2_type=vector|p2_name=color|p2_desc
|p2_type=vector|p2_name=color
|p3_type=float|p3_name=alpha|p3_desc=visibility, 0.0 is fully transparent and 1.0 is fully visible.
|p3_type=float|p3_name=alpha
|func_desc=Displays '''text''' over a prim with specific '''color''' and transparency (specified with '''alpha''').
|func_desc=Displays '''text''' over a prim with specific '''color''' and transparency (specified with '''alpha''').
|return_text
|return_text
Line 54: Line 53:
|also
|also
|notes=Most commonly, this is included in the default code for an object (see example above).
|notes=Most commonly, this is included in the default code for an object (see example above).
 
|cat1=Effects
|cat2
|cat3
|cat4
}}
}}

Revision as of 09:33, 1 March 2007

Summary

Function: llSetText( string text, vector color, float alpha );

Displays text over a prim with specific color and transparency (specified with alpha).

• string text text to display between the quotes
• vector color color in RGB <R, G, B> (<0.0, 0.0, 0.0> = black, <1.0, 1.0, 1.0> = white)
• float alpha from 0.0 (clear) to 1.0 (solid) (0.0 <= alpha <= 1.0)

Caveats

  • The floating text is a property of the prim and not the script, thus the text will remain if the script is deactivated or removed.
    • To remove floating text, one must assign an empty string with llSetText("", <1.0, 1.0, 1.0>, 1.0);
All Issues ~ Search JIRA for related Bugs

Examples

Example colors:

vector white = <1.0, 1.0, 1.0>;
vector red = <1.0, 0.0, 0.0>;
vector green = <0.0, 1.0, 0.0>;
vector blue = <0.0, 0.0, 1.0>;
vector grey = <0.5, 0.5, 0.5>;
vector black = <0.0, 0.0, 0.0>;
llSetText("I am on", <1.0, 1.0, 1.0>, 1.0);

<1.0, 1.0, 1.0> represents the values for red, green, and blue. <1.0, 1.0, 1.0>, means "white" and <0.0, 0.0, 0.0> means "black".

llSetText("I am off", <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).

Example of how llSetText could be included in default code:

default
{
    state_entry()
    {
         llSay(0, "Hello, Avatar!");
         llSetText("Prize Box", <0.0, 1.0, 0.0>, 1.0);
    }

    touch_start(integer total_number)
    {
         llSay(0, "Touched.");
    }
}

Notes

Most commonly, this is included in the default code for an object (see example above).

See Also

Articles

•  Color in LSL
•  Translucent Color

Deep Notes

Search JIRA for related Issues

Signature

function void llSetText( string text, vector color, float alpha );