Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Transferring prim params by string

Richard Pinkerton
Registered User
Join date: 20 Jan 2005
Posts: 125
02-20-2005 08:27
Just a test I've created a prim and put this script in it:-

CODE

// when touched, IM the owner with the name of the object and a CSV'd list of prim params
default {
touch_start(integer num_detected) {
list o = [];
integer n;
integer side;

llInstantMessage(llGetOwner(), llGetObjectName());

o += [PRIM_TYPE] + llGetPrimitiveParams([PRIM_TYPE]);
o += [PRIM_MATERIAL] + llGetPrimitiveParams([PRIM_MATERIAL]);
o += [PRIM_ROTATION] + llGetPrimitiveParams([PRIM_ROTATION]);
o += [PRIM_SIZE] + llGetPrimitiveParams([PRIM_SIZE]);

side = llGetNumberOfSides();
while(side--) {
o += [PRIM_COLOR, side] + llGetPrimitiveParams([PRIM_COLOR, side]);
}

side = llGetNumberOfSides();
while(side--) {
o += [PRIM_TEXTURE, side] + llGetPrimitiveParams([PRIM_TEXTURE, side]);
}

llInstantMessage(llGetOwner(), llList2CSV(o));
}
}


Then I've pasted the CSVified list (somewhat shortened here for brevity) into the following script which is placed in a fresh prim.

CODE

default
{
touch_start(integer total_number)
{
list L = llCSV2List("9, 2, 0, <0.000000, 1.000000, 0.000000>, 0.000000, <0.000000, 0.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, 2, 3, 8, <0.000000, 0.000000, 0.147809, 0.989016>, 7, <0.240000, 0.240000, 0.140000>");
llWhisper(0, (string)llGetListLength(L));
llSetPrimitiveParams(L);
}
}


When I touch this new prim however nothing happens except the whisper. Any ideas whats up?
Rhombur Volos
King of Scripture & Kebab
Join date: 6 Oct 2004
Posts: 102
02-20-2005 09:42
You might want to remove the "s.
Zonax Delorean
Registered User
Join date: 5 Jun 2004
Posts: 767
02-20-2005 09:48
If I remember right, this is because the parameters are not converted well by llCSV2List.
First of all, if you have

CODE
<1.000, 2.000, 3.000>


That will be split into 3 (string) list entries, not one vector!
Eg.
CODE
[ "<1.000", "2.000", "3.000">]


Addititonally, even if the CSV conversion is right, you'll get a "<1.000, 2.000, 3.000>" string, and NOT a vector. That might also be a problem.
Zonax Delorean
Registered User
Join date: 5 Jun 2004
Posts: 767
02-20-2005 09:50
Oh yes, Rhombur might be right!

If you use

CODE
L = [ 1.000, 2.000, <1.0, 2.0, 3.0> ];


That can work. No need for CSV2List.
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
02-20-2005 09:58
From: Zonax Delorean
If I remember right, this is because the parameters are not converted well by llCSV2List.
First of all, if you have

CODE
<1.000, 2.000, 3.000>


That will be split into 3 (string) list entries, not one vector!
Eg.
CODE
[ "<1.000", "2.000", "3.000">]


Addititonally, even if the CSV conversion is right, you'll get a "<1.000, 2.000, 3.000>" string, and NOT a vector. That might also be a problem.

You are incorrect in your former reason, correct in your latter. llCSV2List handles vectors properly, it just doesnt preserve the type of the value.
==Chris
Richard Pinkerton
Registered User
Join date: 20 Jan 2005
Posts: 125
02-20-2005 10:07
Right, I thought it might have been something in the get/setprimitiveparams code.

So I need to use this script (or something like it) from the wiki....
http://secondlife.com/badgeo/wakka.php?wakka=llCSV2List

Jeez, this is going to be slow..