10-29-2007 02:07
Hi,

I need some help with modifying 40 prims that are linked together into one object.
The root prim sends the message
llMessageLinked(LINK_SET, SETPRIMSIZE, (string)objsize ,"0";);
And all linked prims receive the message

default
{
state_entry()
{
}

on_rez(integer num)
{
llResetScript();
}

link_message(integer sender, integer channel, string data, key id)
{
if (channel == SETPRIMSIZE)
{
llSay(0, data);
vector objsize = (vector) data;
list primparams;
primparams = [];
primparams = [PRIM_SIZE, objsize];
llSetPrimitiveParams(primparams);
}
}
}

This works sometimes. All 40 linked prims change their size.
I toggle the primsize between <10,10,1> and <1,1,1>
But if I call this multiple times with some seconds pause between by clicking on the touch button I get random results. Some linked prims work perfectly, others simply don't get the message. I doub le checked that the script is attached to each linked prim.
Is it guaranteed that llMessageLinked distributes the message, can I rely on this. Or is this just a function that may send a message if there is enough time in the sim?

What could cause troubles here.

The land supports the number of prims and I don't rez new prims.

The minimum and maximum objects size shouldn't be a problem here because I don't make them larger than10m.

Is there a distance limit so that the message is just sent within 5m??
But my results are very random. It doesn't look like linked prims that are more far away don't get the message, absolutely not.


Because this message stuff doesn't do the job I tried to simply enumerate the linked prims

SetObjectSize(string obj, vector objsize)
{
if(obj == "";) return;

objsize.x = GetMax(objsize.x, 0.01);
objsize.y = GetMax(objsize.y, 0.01);
objsize.z = GetMax(objsize.z, 0.01);

integer i;
integer objlength = llStringLength(obj);
obj = llToUpper(obj);
for (i = 1; i <= llGetNumberOfPrims(); i++)
{
string currobj = llToUpper(llGetSubString (llGetLinkName(i), 0, objlength-1));
if (currobj == obj)
{
list primparams;
primparams = [];
primparams = [PRIM_SIZE, objsize];
llSetLinkPrimitiveParams(i, primparams);
}
}
}

All linked prims have the name 'object', the fuctions tries to process each linked prim.
When rezzing the object from inventory all linked primes are resized thats great but when
toggling the size in the touch event
SetObjectSize("object", <10,10,1>;)
or
SetObjectSize("object", <1,1,1>;)
the script stops working. When I rez again from inventory it works perfectly but stops working after tryig to toggle between the sizes.

Is this LSL just an unreliable scripting system, or am I doing something wrong.
I tried these two completely different approaches but none seems to work.

I know there is a 30prims limit for cars should I just link up to 30 prims together.
Why can a script stop working
Please advise.