Saturday, September 13, 2014

Hovering Text [Level 1]



Hovering or floating text is that sometimes annoying lettering that appears above (and sometimes in front of) a prim.

Hovering text can be any color, can be broken into multiple lines, and can be solid or transparent. Messages are limited to 254 bytes. The distance at which hover text can be viewed is dependent upon the size of the prim. Bigger equals visibility at a longer distance.

Hovering text is set by a script, and will remain even if the script is removed from a prim. The Scrubber script I shared will remove it, or, if the script is still in the prim, you can remove the text between quotation marks in the llSetText line so it reads "". The official way to remove hover text, however, is with the line that follows:


llSetText("", ZERO_VECTOR, 0);

Here's what a llSetText line looks like:

//  two lines of orange text
 
    llSetText("I am\non two lines!", <1.0, 0.4, 0.0>, 1.0);

The characters \n breaks the message into two lines. Each use of /n will insert an extra line.

Since this is a level one post I'll say only that your message goes between the quotation marks, the color is specified by the numbers in brackets, and the last number determines the level of transparency (alpha); 0.0 is invisible and 1.0 is solid.

The numbers in brackets specify, in order, red, green, and blue color channels. By varying the numbers between 0.0 and 1.0 you can generate thousands of different colors.The Second Life scripting Wiki page for hover text shows seventeen common colors. <1.0, 1.0, 1.0>, for instance, is white.

Here's a sample hover text script for you to use. Your message will appear in white hovering text. You can alter the characters between the quotation marks to anything you like.

Cut and paste the text below into a script in your prim

//==================

default
{
    state_entry()
    {
        llSetText ("Your message goes here", <1.0, 1.0,1.0>, 1.0);
    }
}

//===============


No comments:

Post a Comment