Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Change size of 40 linked prims

Pete001 Andrew
Registered User
Join date: 7 Sep 2007
Posts: 2
10-30-2007 02:03
Hi,

I'm trying 3 differet was to tell my 40 linked prims to change their size.
See below.
The message sending stuff produces random results, some prims do what they should do others don't but really in a random way.
The enumeration of all prims in a loop changes all prims the first time but gets worse the more often I call it.

Is the LSL simply unreliable or do I something wrong here.
I checked if all prims have the script attached.
That there are enough prims supported on the sim.(I don't rez any new prims)
Is there a 30prim limit when linking objects together? I think I've seen this with cars.
I know there is a 64 message limit for llmessagelinked but not for llSay

The root prim calls
llSay(INTRERCOMCHANNEL_SETPRIMSIZE, (string)objsize);
And all 40 prims should do something
default
{
state_entry()
{
llListen(INTRERCOMCHANNEL_SETPRIMSIZE,"", NULL_KEY,"";);
}

on_rez(integer num)
{
llResetScript();
}
listen(integer channel, string name, key id, string message)
{
llSay(0, data);
vector objsize = (vector) message;
list primparams;
primparams = [];
primparams = [PRIM_SIZE, objsize];
llSetPrimitiveParams(primparams);
}
}


I tried the same with

llMessageLinked(LINK_SET, SETPRIMSIZE, (string)objsize ,"0";);
and
link_message(integer sender, integer channel, string data, key id)

And the third way was to enumerate all 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);
}
}
}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
10-30-2007 06:39
if I understand correctly llSay is working(assuming all prims are within 20m), but link messages are failing? and you want all prims to resize to the same size?

a few things
llSetPrimitiveParams will silently fail if the vector is < .01 or > 10 in ANY dimension
llSay messages don't always arrive in the order sent if they are sent quickly
llMessageLinked has intermittant failures when sending, using LINK_SET this can make look VERY random

a posible solution is to move all child prim scripts into one prim, and use llSetLinkPrimitiveParams... and a single llMessageLinked call targeted to the single prim with copies of the script below
CODE

key vKeyActivateMessage = "bob";
integer vIntTargetPrim;
default{
state_entry(){
vIntTargetPrim = (integer)llGetSubString( llGetScriptName(), -1, -1 );
}

link_message( integer vIntSender, integer vIntTotalNumber, string vStrVector, key vKeyControlMessage ){
if (vKeyActivateMessage == vKeyControlMessage){
if (vIntTotalNumber > vIntTargetPrim){
llSetLinkPrimitiveParams( vIntTargetPrim, [PRIM_SIZE, (vector)vStrVector] );
}
}
}

when you copy the script it will get a number after it, delete the first un numbered copy

in your caller script,
vIntLinkTarget = //-- the prim that your sub scripts reside in
vVecNewSize = //-- the size you want them to be
vIntAmount = llGetNumberOfPrims(); //-- change to a number to only set the linked prims under that number
llMessageLinked( vIntLinkTarget, vIntAmount , vVecNewSize, "bob" );

if the mesage fails it should fail for all this way. (but I've never seen targeted messages fail yet)

you can also loop from a single script with
CODE

vVecNewSize = //-- the size you want them to be
vIntAmount = llGetNumberOfPrims(); //-- change to a number to only set the linked prims under that number
while (vIntAmount ){
llSetLinkPrimitiveParams( vIntAmount, [PRIM_SIZE, vVecNewSize ] );
--vIntAmount;
}

but this will take roughly #of-prims * 0.2 seconds to complete
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Pete001 Andrew
Registered User
Join date: 7 Sep 2007
Posts: 2
hack
10-30-2007 07:43
Thanks for your example.

>llSetPrimitiveParams will silently fail if the vector is < .01 or > 10.
I considered this and kept the size vector in range.

>llSay messages don't always arrive in the order sent if they are sent quickly
Is very fast and unordered, but this doesn't matter. What bothers me is that it reaches just ~30 linked prims. But really i an unordered way.
The prims change the size really fast (within 1second) and I can toggle the size between <1,1,1> to <10,10,1> very quickly.
But I have no idea why I don't reach all 40?
It can't be a problem with range of 20m because the first, fourth, fifth, seventh prim change size,so not the one farest away

>llMessageLinked has intermittant failures
This means llMessageLinked is unreliable by design so I can't use it.

Your version seems to be a great hack around. But hack around which limitation.
Are there any limitations that I'm not aware of?

The llSetLinkPrimParams has this strange sleep for 0.2 seconds integrated which makes it really slow.(8s for 40 prims)
llSay looks much faster.

I have no idea why I can't simply enumerate all linked prims rest assured that my script will never hang or stop working.

Maybe the sim is to busy to process my script continually.