|
LizardTongue Surface
Registered User
Join date: 31 May 2005
Posts: 11
|
04-14-2007 23:56
Got a small issue that is making my fur itch - three days of coding and I'm down to this one problem: Attempting to parse out a list, here's the code: link_message(integer sender_num, integer chan, string data, key id) { if (chan == c_Channel) { list parse = llParseString2List(data,["^"],[]);
llOwnerSay("\nparse0: " + llList2String(parse,0) + "\nparse1: " + llList2String(parse,1) + "\nparse2: " + llList2String(parse,2) + "\nparse3: " + llList2String(parse,3) + "\nparse4: " + llList2String(parse,4));
integer rows = llList2Integer(parse,0); size = llList2Integer(parse,1); apex = llList2Vector(parse,2); lag_delay = llList2Integer(parse,3); vector A = llList2Vector(parse,4);
llOwnerSay("\nrows: " + (string)rows + "\nsize: " + (string)size + "\napex: " + (string)apex + "\nlag_delay: " + (string)lag_delay + "\nA: " + (string)A);
And here's the output from the says: (yes the parse0-4 values are correct) parse0: 4 parse1: 0.250000 parse2: <25.00000, 101.00000, 402.29999> parse3: 0 parse4: <26.00000, 101.50000, 402.29999>
rows: 4 size: 0.000000 apex: <0.00000, 0.00000, 0.00000> lag_delay: 0 A: <0.00000, 0.00000, 0.00000>
Any ideas?
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
04-15-2007 00:11
i didnt really look into it deeply but when you phrase a string into a list the values dont change, ie 25 is actually "25"
sooo when you try to read it as a numerical value it returns 0
you have to read a list as it was saved try using
integer x = (integer)llList2String(list_name, list_pos);
since the list was saved as a string you have to read it as a string and typecast it
|
|
LizardTongue Surface
Registered User
Join date: 31 May 2005
Posts: 11
|
04-15-2007 00:25
That got it. Thanks, could have sworn I tried that about 2 hours back. But it's working now.
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
04-15-2007 01:40
From: Osgeld Barmy you have to read a list as it was saved try using
integer x = (integer)llList2String(list_name, list_pos); Actually, llList2Integer will directly typecast a string element to an integer (as it did for LizardTongue's rows variable), it's only llList2Vector and llList2Rotation which won't. BTW, LizardTongue, your size value came up 0.000000 because you read it with llList2Integer, which truncated everything after the decimal, turning 0.25 into 0.
|