Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

list[vector] -> string -> list[vector] -> vector?

Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-07-2006 08:37
:D I've fought list for a day. :o
One object has a list whose elements are vectors. I want it to give the list to another object. It can use only Listen, no linked. And I want to use the list in the second object, that is, I need to take vector from the list.
Just tried string type cast, it turned to be a single element in the list.
Using llParseString2List, those vectors turned to be seperate elements by each float value. :o
Please anyone, help me.
_____________________
:) Seagel Neville :)
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
05-07-2006 08:45
read vectors from your list one by one, convert them to strings, pass the strings to the other object, cast them back to vectors and compile them into a list again there as they come?

list[vector] -> vector -> string -> | object boundary | -> vector -> list[vector]

also /54/c4/103908/1.html
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
05-07-2006 11:53
Why not use llDumpList2String ?

string say_string = llDumpList2String( vetor_list,"X" );

Say the string to the other object ( has to be below 256 chars tho )

Then parse the received string back into a list

list other_vector = llParseString2List( message,["X"],[] );

If the list contains only vectors then the character X is never used and can be used as a valid seperator.

( you will probably need to cast them to vectors before using them tho );

vector dummy = (vector)llList2String( other_vetor, index ) ;
Sky Honey
Coder
Join date: 16 May 2005
Posts: 105
05-07-2006 12:34
I had the same problem a while ago. This worked for me. From llList2Vector :

From: someone
Note: llList2Vector will not automatically cast a string to a vector. Thus, if you attempt to retrieve a list element consisting of a vector cast to a string like "<1,2,4>", llList2Vector will return ZERO_VECTOR or <0,0,0>. This can be avoided by using llList2String and casting directly, as in:
vector foo = (vector)llList2String(["<1,2,4>"], 0);
_____________________
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-07-2006 16:06
Thank you guys, :)

Joannah, I hated to let it communicate so much, but I will do that as the last resort.

Adriana, I didn't use llDumpList2String. I'll give it a try.

sky, yeah, I used string to let them communicate and the string was transfered well. I just couldn't get them as vectors. I used (vector)llList2String.
_____________________
:) Seagel Neville :)
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-08-2006 09:48
Thank you, Adriana. :) I made sure that llDumpList2String and llParseString2List worked fine. Yay, I learned it. :)
_____________________
:) Seagel Neville :)
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
05-08-2006 11:12
More than welcome :-)