Jump to content

How i can use PRIM_LINK_TARGET to target the link number by desc ? and thanks everyone for help =))


Simoo0
 Share

You are about to reply to a thread that has been inactive for 1308 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I want to target a link by desc in this Function llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_LINK_TARGET,....here i want to tell it prim desc.., PRIM_COLOR,...]);

so what should I do to do this ? 

and thanks all for helping ))

Link to comment
Share on other sites

Whenever you need to refer to a link repeatedly by number, it makes sense to build yourself a variable that holds the link number, in state_entry:

state_entry()
{
    integer i;
    while ( i < llGetNumberOfPrims() )
    {
        ++i;
        if ( llGetLinkName(i) == "Door Handle")   // or whatever ...
        {
             iDoorLink = i;
        }
    }
}

assuming that iDoorLink is a global integer variable.  If you don't want to use the link's name, you could put an identifying label in its Description field, as you suggested, and then check

string strLinkName = llList2String( llGetLinkPrimitiveParams( i,[PRIM_DESC] ),0);

Thereafter, you can use iDoorLink as your link number when you use SLPPF.

Edited by Rolig Loon
  • Like 1
Link to comment
Share on other sites

I found this one which they can control the Linkset by name so we can convert this to Desc instead ?
default{    state_entry()    {        string sName = "Root";        integer iPrims = llGetNumberOfPrims();        while(iPrims)        {            if (sName == llGetLinkName(iPrims))            {                llSetLinkPrimitiveParamsFast(iPrims, [PRIM_GLOW, ALL_SIDES,0.5]);            }            --iPrims;        }    }
Link to comment
Share on other sites

Of course.  As I said before,

14 hours ago, Rolig Loon said:

If you don't want to use the link's name, you could put an identifying label in its Description field, as you suggested, and then check

string strLinkName = llList2String( llGetLinkPrimitiveParams( i,[PRIM_DESC] ),0);

That's a little more cumbersome than just using the link's name, but it works just as well.

Edited by Rolig Loon
  • Like 1
Link to comment
Share on other sites

I created more than prims and Linked them together and it should All prims that have in its Description field "New" for example .. should be transparent  , but it didn't work i don't why !

 integer iDoorLink ;
default
{   

    touch_start(integer total_number)
    
{
    integer i;
    string strLinkName = llList2String( llGetLinkPrimitiveParams( i,[PRIM_DESC] ),0);
    
    while ( i < llGetNumberOfPrims() )
    {
        ++i;
        if ( llGetLinkName(i) == "New")   // or whatever ...
        {
           llSetLinkPrimitiveParamsFast(iDoorLink, [
                PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.0]);
 
             iDoorLink = i;
        }
    }
}
}

Edited by Simoo0
Link to comment
Share on other sites

Think about the logic a bit.  😉

integer iLinkNumber;

default
{   
    state_entry()
    {
        integer i; 
        while ( i < llGetNumberOfPrims() )
        {
            ++i;
            string strLinkName = llList2String( llGetLinkPrimitiveParams( i,[PRIM_DESC] ),0);
            if (strLinkName == "the_special_code_I_have_put_into the_Link_I_am_looking_for")  // Whatever you put in the Description of that prim
            {
                iLinkNumber = i;
            }
        }
    }
                                    
    touch_start(integer total_number)
    {
        if ( llDetectedLinkNumber(0) == iLinkNumber )   
        {
           llSetLinkPrimitiveParamsFast(iLinkNumber, [
                PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.0]);
        }
    }
}

 

Edited by Rolig Loon
STUPID FORUM FORMATTING SYSTEM!
  • Like 1
Link to comment
Share on other sites

I tried to apply this in world but it didn't work , i put the prim description between bracktes whatever prim name i let it Object by default and the script should disappear all prims with the same description but it didn't , I don't know why 🤔

if (strLinkName == "the_special_code_I_have_put_into the_Link_I_am_looking_for")
Link to comment
Share on other sites

Well, no, it won't.  You left out a vital part of your explanation when you told us what you are doing.  You never said that there's more than one prim with the magic word in its description. This script is only looking for the first one that it finds and ignoring any others.  Rather than write this script for you --- which is not what this forum is for --- I suggest that you take what's here and save all link numbers for prims that have your magic code in them to a list (like lLinkNumbers ) instead of saving just one link number as the integer variable iLinkNumber. When you have created that list, then you can make a similar loop in the touch_start event to apply the texture to all links in lLinkNumbers

Incidentally, because this script applies the textures once and that's it, you really don't need a script at all.  In the amount of time it takes to write a throwaway script, you could texture all the appropriate links by hand a dozen times.  It's interesting to write a script like this for practice, but you really don't need it.

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1308 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...