Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llSetPrimitiveParams

Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-18-2006 17:45
For the Second Life of me... I can't figure out the syntax for changing the HOLE_SIZE of a ring using llSetPrimitiveParams..

Wiki says a lot, but gives no examples (god, I hate that)...

Please help... just show me a working line :-)


Thx
Ryder
Kalidor Lazarno
Just here to have fun!!
Join date: 1 Feb 2006
Posts: 7
05-18-2006 17:55
There is a nice example in this thread ...


/15/6b/45502/1.html
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-18-2006 18:18
THx... that's cool.... now...

How does one use the command... and change only one parameter? Must one always specify every single parameter?

I tried leaving comma delimited blanks for the multitude of paramaters I did not wish to change... but got a syntax error....
thx,

Ryder
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
05-18-2006 19:34
Use llGetPrimitiveParams to get the current type settings, change the one you want, then do llSetPrimitiveParams, passing the complete data with the change to effect it.
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-18-2006 20:28
OK... I was afraid of that...

(why is there not a LSL users revolt over this... ?)

It's like wanting to change your home phone number... but having to load every one's phone number... changing yours, and writing every phone number back... it's nuts.

BUT Given that I have to do this... what is the best way?

I see that it comes as a list... do I have to disassemble the list... assign each value and vector to a properly declared variable, assign my desired value to the one variable I wish to change... then reassemble the list... and then use llSetPrimitiveParams?

Is there a better way?

I truly have no idea about how to go about this.




Linden: How about changing LSL thus: Null arguments, comma delinated, are ignored. Ex:
llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_CYLINDER, , , 0.45, , , , , , ,])

This makes *way* more sense then the dozens of lines of code and hours of reseasearch I am likely to have to do on this... just to change the size of a hole.


"The reasonable man adapts himself to the world; the unreasonable man persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man." (George Bernard Shaw)
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
05-18-2006 21:20
If this is for an object that you wish to sell then you should know that llSetPrimitiveParams won't change the hole size unless the object owner has mod rights. Hole size, cut/dimple/contour cut etc fall into the set of prim param changes that need owner mod rights to work. Size, location, rotation, texture, etc are in the set of prim param changes that don't require owner mod rights to work.

This is an acknowledged bug in llSetPrimitiveParams(). Scripts are supposed to have mod capability, even if the owner doesn't, because they were put there by someone who had mod rights. It is not going to be fixed in 1.10, but it will probably be fixed within the next few weeks.

Whenever you make a product to sell you should test it by giving one to an alt or a friend to make sure that it still works under next-owner rights.

From: someone
BUT Given that I have to do this... what is the best way?

I see that it comes as a list... do I have to disassemble the list... assign each value and vector to a properly declared variable, assign my desired value to the one variable I wish to change... then reassemble the list... and then use llSetPrimitiveParams?


I always use llListReplaceList() to modify terms in the list returned by llGetPrimitiveParams():

CODE
    state_entry()
{
gClosedParams = llGetPrimitiveParams([ PRIM_TYPE ]);
gOpenParams = llListReplaceList(gClosedParams, [ <0.05, 0.95, 0> ], 2, 2);
gHemiParams = llListReplaceList(gClosedParams, [ <0.25, 0.75, 0> ], 2, 2);
llSetPrimitiveParams([ PRIM_TYPE ] + gHemiParams);
}
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-18-2006 21:40
From: Ryder Spearmann
t's like wanting to change your home phone number... but having to load every one's phone number... changing yours, and writing every phone number back... it's nuts.
I think all of them is your phone number. You want to change some digits in the number. After changing, you complain that you have to push all numbers to call. :D
From: Ryder Spearmann
Is there a better way?
What about using llGetPrimitiveParams([PRIM_TYPE]) first. You can get the current stats as a list. Holesize is 5th in the list. So you can use llListReplaceList, isn't it? I don't know what the trigger you want but anyway, this is the sample.
CODE
list PrimType;

default
{
state_entry()
{
llListen(0, "", "", "");
PrimType = llGetPrimitiveParams([PRIM_TYPE]);
}
listen(integer channel, string name, key id, string message)
{
PrimType = llListReplaceList(PrimType, [message], 4, 4);
llSetPrimitiveParams(PrimType);
}
}
You can say, like "<5, 7, 4>" and change the holesize value.

[EDIT]Ouch, BamBam beated me even 20 minuts ago. :D
_____________________
:) Seagel Neville :)
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
05-19-2006 00:18
Thanks guys... you've been a real help to this newb...
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
06-02-2006 07:30
Very sorry, I realized that I was wrong when I really tried it in world.
Although you said, "hole size", it was "hollow" in the cylinder type. And I found that I couldn't use the list directly that I got by llGetPrimitiveParams.

OK, this is the fixed one.

CODE
list PrimType;

default
{
state_entry()
{
llListen(0, "", "", ""); // A completely open filter for avatar chat
PrimType = llGetPrimitiveParams([PRIM_TYPE]); // Get the current parameter as a list
}
listen(integer channel, string name, key id, string message)
{
float hollow = (float)message; // Hollow value is float
PrimType = llListReplaceList(PrimType, [hollow], 3, 3); // Hollow's element is 4th in the list
list tempPrimType = [PRIM_TYPE]; // Needed the Type at fist of the list to set
PrimType = (tempPrimType + PrimType);
llSetPrimitiveParams(PrimType); // Command is executed.
PrimType = llGetPrimitiveParams([PRIM_TYPE]); // Get the current parameter as a list to command again.
}
}


The hollow's value was float. So you can say from 0 to 1, such as, "0.4".
And I realized that I had to get the current parameter just after setting to execute command again. Sorry for confusing you.

USAGE:
1. Create a cylinder prim.
2. Create a script and copy the above description.
3. Save it.
4. Say, some value, such as, "0.4".
5. Try to say another value.
_____________________
:) Seagel Neville :)
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
06-19-2006 10:39
From: BamBam Sachertorte
If this is for an object that you wish to sell then you should know that llSetPrimitiveParams won't change the hole size unless the object owner has mod rights. Hole size, cut/dimple/contour cut etc fall into the set of prim param changes that need owner mod rights to work. Size, location, rotation, texture, etc are in the set of prim param changes that don't require owner mod rights to work.

This is an acknowledged bug in llSetPrimitiveParams(). Scripts are supposed to have mod capability, even if the owner doesn't, because they were put there by someone who had mod rights. It is not going to be fixed in 1.10, but it will probably be fixed within the next few weeks.


This bug was fixed last week.