Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Trouble with vectors in a list

Thom Wozniak
Registered User
Join date: 13 Nov 2007
Posts: 15
11-23-2007 18:02
I have a list with a float and two vectors coming in CSV format in on a link_message. I translate that into list form properly, with llCSV2List(), but the following gives these results.

float f1 = 0.555;
vector v11 = <1.0,1.0,1.0>;
vector v21 = <2.0,2.0,2.0>;

string message = llList2CSV([f1,v11,v21]);

list incoming = llCSV2List(message); // take incoming message and make a list
float f = llList2Float(incoming, 0);
vector v1 = llList2Vector(incoming, 1);
vector v2 = llList2Vector(incoming, 2);
llOwnerSay("incoming: " + (string)incoming); // print the created list
llOwnerSay("f: " + (string)f); // print the value of the float
llOwnerSay("v1: " + (string)v1); // print the value of the first vector
llOwnerSay("v2: " + (string)v2); // print the value of the second vector


The output is as follows.

Object: incoming: 0.555000<0.000000, 0.000000, 0.000000><1.000000, 1.000000, 1.000000>
[17:57] Object: f: 0.555000
[17:57] Object: v1: <0.00000, 0.00000, 0.00000>
[17:57] Object: v2: <0.00000, 0.00000, 0.00000>


Why are the vectors not getting pulled out of the list? When I pull out all of the CSV stuff and leave the list ok from start to finish, it comes out right. It is only when I translate into CSV and back that I lose the ability to pull out the vectors. WHY ME LORD!!!???
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-23-2007 18:20
Try it like this:
Remember, llCSV2List "All list items will be of type string, regardless of their contents"

This script outputs:
new: incoming: 0.55500<1.00000, 1.00000, 1.00000><2.00000, 2.00000, 2.00000>
new: f: 0.55500
new: v1: <1.00000, 1.00000, 1.00000>
new: v2: <2.00000, 2.00000, 2.00000>

CODE

float f1 = 0.555;
vector v11 = <1.0,1.0,1.0>;
vector v21 = <2.0,2.0,2.0>;
default
{
touch_start(integer total_number)
{
string message = llList2CSV([f1,v11,v21]);
list incoming = llCSV2List(message); // take incoming message and make a list
float f = llList2Float(incoming, 0);
vector v1 = (vector)llList2String(incoming, 1);
vector v2 = (vector)llList2String(incoming, 2);
llOwnerSay("incoming: " + (string)incoming); // print the created list
llOwnerSay("f: " + (string)f); // print the value of the float
llOwnerSay("v1: " + (string)v1); // print the value of the first vector
llOwnerSay("v2: " + (string)v2); // print the value of the second vector
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Thom Wozniak
Registered User
Join date: 13 Nov 2007
Posts: 15
11-23-2007 18:43
Okay, this is REALLY strange. I logged out of SL, went home from work, and logged back on. When I did, I touched the same dang texture that wasn't working earlier, and it worked just fine. WTH?
Thom Wozniak
Registered User
Join date: 13 Nov 2007
Posts: 15
11-23-2007 18:46
Oh, wait, nvrmind. I still had the CVS removed. Thanks for the llList2String tip. That worked perfectly. I never would have figured that one out!