11-22-2004 03:52
There are a couple of scripts under llSetScale on the wiki that are supposed to resize an entire linked set of objects. Here's a link to it on a static wiki, but I'll include the code at the end just in case.
http://lslwiki.sdfjkl.org/llsetscale.html

Originally I tried to use this on a link set that was aound 240 prims, but I only put the child script into some of them. When I tell it to resize all of the prims with the child script move as they should but only some of them change their scale. I've then broke the linked sets into smaller (50-70 prim) pieces, and had the same result. Just today I put the child script into all of 53 prims in a set and only 3 of them scaled up. We've also done many other tests such as...
- changing the llPrimParams function into separate llSetPos & llSetScale
- putting a delay between those two function calls
- swapping the order of the calls
- putting a delay in the root prim to slow the linked message calls
etc...etc...

The prims have never all scaled as they should, but on every occasion the prims have moved as they should. When I say they don't scale I mean they literally stay their original size. (and no... I'm not hitting a prim size limit)

Is this a bug? Does anyone know if it's actually possible to resize a large linked set of objects?

--------------------------------------------------------------

Put this script into each prim of the object:
CODE

default {
link_message(integer sender_num, integer num, string str, key id) {
float scale; // size factor
list primparams;

scale = (float)str;

primparams = [];

primparams += [PRIM_SIZE, llGetScale() * scale]; // resize

if (llGetLinkNumber() > 1) { // only move if we're not the root object
primparams += [PRIM_POSITION, llGetLocalPos() * scale]; // reposition
}

llSetPrimitiveParams(primparams);
}
}


And additionally this script into the parent prim of the linked set:
CODE

// rescales the linked set by the specified factor. factor > 1 makes it larger, < 1 smaller
// example: "/9 2.5"
Resize(float scale) {
integer num_prims = llGetNumberOfPrims();
integer i;

for (i = 1; i <= num_prims; i++) { // first prim in a linked set is 1
llMessageLinked(i, 0, (string)scale, NULL_KEY);
}

}

default {
state_entry() {
llListen(9, "", llGetOwner(), "");
}

listen(integer channel, string name, key id, string message) {
float scale;

scale = (float)message;
if ( scale == 0.0 ) return; // we don't resize by factor 0.0

llSay(0, "Resizing by factor " + (string)scale);

Resize(scale);
}
}