Jump to content

linked prim name?


Tighern McDonnell
 Share

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

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

Recommended Posts

Working on making a hud with a single script in it to do multiple functions. I want to make linked prims touchable... The two ways I can think to do it is have each prim with a script that says its name or something on a - channel to the main script. The main script then using a listen will exicute that function... There other way I don't know if it is possible. Well I think it is but have no idea how to make it happen. Where the prim is linked to the main and is named "command" the main script knows that button is pressed and exicutes the command. 

I know how to do the listen version but I also know that is slow and can be a bit laggy. Any help in where to get started would be most apreciated. The ultimate goal is to make it so there is one script so I can send out a updater that will use the llRemoteLoadScriptPin function to update the hud quite often as it is a RP hud with teleport locations that change once every month or so.

Link to comment
Share on other sites

Particularly if you've got a large linkset to check, you may find it speeds things up to have the script note, beforehand, the link numbers and names you're interested in.

Something like this:

integer button1;integer button2;list buttons;find_prims(){    integer max = llGetNumberOfPrims();    buttons=[];    do {        string s = llGetLinkName(max);        if("Button 1"==s){            button1 = max;            buttons+=[button1];        }        else if ("Button 2"==s){            button2 = max;            buttons+=[button2];        }        //and so on    }    while (--max);}default{    state_entry()    {        find_prims();    }    on_rez(integer start_param)    {        find_prims();    }    attach(key attached)    {        if (attached){            find_prims();        }    }    touch_start(integer total_number)    {        integer n = llDetectedLinkNumber(0);        if(~llListFindList(buttons,[n])){ // don't bother to look up which it is, unless we know it's a prim we're interested in            if(n == button1){                // do something            }            else if (n == button2){                //do something else            }        }    }}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3652 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...