CODE
string TARGET_PRIM_NAME = "Target";
changeAllTargetPrims(list primParams)
{
integer i;
for (i = llGetNumberOfPrims(); i > 0; --i)
{
if (llGetLinkName(i) == TARGET_PRIM_NAME)
{
llSetLinkPrimitiveParams(i, primParams);
}
}
}
Because it's a large linkset and this has to loop though each prim individually, it's pretty slow.
My problem is this. Quite often I'm changing several things about a prim at once. Among these are things like the colour, alpha or texture.
Obviously there exist several specific functions, llSetLinkColor and the like, which let me change just the colour, alpha or texture. These have the advantage that I can use them to change the colour without having to bother about what the prim's alpha is, and vice versa, which is often all I want to do, rather than have to specify PRIM_COLOR, face, color, alpha all the same time, or the texture without having to bother about the repeats and offsets. This is particularly useful because often I don't know what the alpha or colour or whatever are unless I check them, since they may have been changed by something the user has done previously with the script.
Seems to me that when I'm just changing the colour or alpha or texture, I should use the appropriate function to do just that. But I'm not sure how best to handle situations where I'm changing, for example, the colour, texture and glow all at the same time.
I can't store data in the prims' names and description fields very easily, because I'm using those to identify what to change. I guess I could store all the variables in the script, but that's going to be an awful lot of variables and a lot of long lists to read, and it seems way too complicated to me.
Is my only option in these circumstances to change stuff separately, using llSetLinkSomeSpecific and then llSetLinkPrimitiveParams for the rest, and accept it'll take as long as it takes, or is there another way that I'm missing?