Difference between revisions of "User:Daemonika Nightfire/Scripts/*DS* llFloatLinkNumber() v1.0.02"

From Second Life Wiki
Jump to navigation Jump to search
(Script moved)
Line 1: Line 1:
==*DS* llFloatLinkNumber() v1.0.02==
==*DS* llFloatLinkNumber() v1.0.02==
Usefull helper for Creators & Scripters who dont like to search the LinkNumbers.
Script is moved to [[Tools_(de)#.2ADS.2A_FloatLinkNumber|Tools (DE) / *DS* FloatLinkNumber]]
Just drop this Script into the root Prim of your LINK_SET and touch the root.
<lsl>
/*
    *DS* llFloatLinkNumber() © by Daemonika Nightfire (daemonika.nightfire)
   
    Features:
    usefull helper for Creators & Scripters
    you must not longer drop in each prim a script for get the LinkNumber or LinkName
    you see it all as floating text
    show & hide on touch at each prim in the LINK_SET the LinkNumber & LinkName
   
    Info:
    a single Prim show LinkNumber 0 for the root
    in a LINK_SET show the root the LinkNumber 1
*/
 
integer text = 0;
 
// set TRUE or FALSE for with or without LinkName
integer name = TRUE;
 
Links()
{
    integer i;
    for(i = 0; i <= llGetNumberOfPrims(); i++)
    {
        if(text)
        {
            string num;
            if(i < 2)
            {
                num = (string)i + " (root)";
                if(name)
                {
                    num = (string)i + " (root)\n" + llGetLinkName(i);
                }
            }
            else if(i >= 2)
            {
                num = (string)i;
                if(name)
                {
                    num = (string)i + "\n" + llGetLinkName(i);
                }
            }
            llSetLinkPrimitiveParamsFast(i,[PRIM_TEXT, num, <1,1,0>, 1.0]);
        }
        else if(!text)
        {
            llSetLinkPrimitiveParamsFast(i,[PRIM_TEXT, "", ZERO_VECTOR, 0.0]);
        }
    }
}
 
default
{
    state_entry()
    {
        Links();
    }
   
    touch_start(integer num_detected)
    {
        // you have to touch the root prim for show/hide the floating text
        if(llDetectedKey(0) == llGetOwner() && llDetectedLinkNumber(0) < 2)
        {
            if(!text)
            {
                text = 1;
            }
            else if(text)
            {
                text = 0;
            }
            Links();
        }
    }
   
    on_rez(integer Dae)
    {
        llResetScript();
    }
}
</lsl>

Revision as of 16:11, 15 January 2013

*DS* llFloatLinkNumber() v1.0.02

Script is moved to Tools (DE) / *DS* FloatLinkNumber