Jump to content

llSetLinkPrimitiveParamsFast, question


Rhemah
 Share

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

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

Recommended Posts

Nope.   Take a look at the Wiki article on llSetLinkPrimitiveParamsFast.

This function applies only to the object in which the script is.   There are some constants you can use -- LINK_SET, LINK_ROOT, LINK_ALL_CHILDREN, LINK_THIS and LINK_ALL_OTHERS.   Otherwise you need to specify the actual link numbers you want to affect.

However, what you can do --and, to my mind, should do in appropriate cases --  is use link names or link descriptions to identify the link numbers you are interested in rather than hard-code link numbers.   That's because if you hard code the numbers, the script will almost inevitably get broken at some point if you have to relink to object.

So,what I regularly do is something like

integer counter;integer max;list liPrimsToChange;string lookFor = "Change me";findPrims(){	liPrimsToChange =[];//clear the list	max = llGetNumberOfPrims()+1;	counter = 1;	do {		string str = llList2String(llGetLinkPrimitiveParams(counter,[PRIM_DESC]),0);		if(lookFor==str){//if the prim description is "Change me"			liPrimsToChange+=[counter];//add the link number to the list		}	}	while(++counter<max);}

I call that in state_entry, on_rez, and in the changed event if (change & CHANGED_LINK);

Then at run time I do something like 

	listen(integer channel, string name, key id, string message)	{		if ("change"==message){			max = llGetListLength(liPrimsToChange);			counter=0;			list params;			do{				params+=[PRIM_LINK_TARGET]+[llList2Integer(liPrimsToChange,counter)]+[PRIM_COLOR,ALL_SIDES,<0.5,0.5,1.0>,1.0];			}			while (++counter<max);			llSetLinkPrimitiveParamsFast(LINK_SET,params);		}	}

(I think that's right -- I've not gone in world to test it).

That's telling the script to buiild a list of the prims I'm interested in and then, at run time, build a params list to change them all.  

I could equally loop through the list calling llSetLinkPrimitiveParamsFast to change each prim separately, but this way the change is excuted in one frame.   If it's only a few prims it doesn't make much difference but, in a large build, it can do.

  • Like 1
Link to comment
Share on other sites

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