User:Daemonika Nightfire/Scripts/Hovertext Helper

From Second Life Wiki
Jump to navigation Jump to search

*DS* Hovertext Helper

Copy / paste this script into a New Prim and change the Primcolor with the Editmenu.

//----- *DS* Hovertext Helper by Daemonika Nightfire (daemonika.nightfire) -----//

string text  = "Just change the Prim-Color.";
vector color = <1,1,1>;
float alpha  = 1.0;

SetText()
{
    color = llGetColor(0);
    alpha = llGetAlpha(0);
    llSetText("llSetText(\"Text!\", " + (string)color + ", " + llGetSubString((string)alpha,0,3) + ");",color,alpha);
    llWhisper(0,"\n\nllSetText(\"Text!\", " + (string)color + ", " + llGetSubString((string)alpha,0,3) + ");");
}

default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_NAME, "*DS* Hovertext Helper",
        PRIM_TEXT, text, color, alpha, PRIM_FULLBRIGHT, ALL_SIDES, TRUE,
        PRIM_TYPE, PRIM_TYPE_CYLINDER, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>,
        PRIM_TEXTURE, ALL_SIDES, "40ca82a1-c00d-39db-6c7d-ec7d48df4de3", <1,1,0>, <0,0,0>, 0]);
    }

    touch_start(integer num)
    {
        SetText();
    }

    changed(integer ch)
    {
        if(ch & CHANGED_COLOR)
        {
            SetText();
        }
    }

    on_rez(integer st)
    {
        llResetScript();
    }
}

you get a Chatmessage looks like this:

*DS* Hovertext Helper flüstert: 
llSetText("Text!", <0.00000, 1.00000, 0.00000>, 1.00);

Copy / paste the complete last line from the Chat History into a New Script.

Example

default
{
    state_entry()
    {
        llSetText("Text!", <0.00000, 1.00000, 0.00000>, 1.00);
    }

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