Xiija Posted July 12 Share Posted July 12 (edited) I just can't wake up today... I have train tracks that report their number, & start, mid, and end vectors via regionsay as a string. after removing the indexing, i'm left with the 3 vectors, that i wish to add to a list. "<30.404861, 44.845428, 23.429020>, <25.404861, 44.845428, 23.429020>, <20.404861, 44.845428, 23.429020>" how would one save these strings as vectors? i can get the first one ... integer Index = llSubStringIndex(vec, ">,"); string st = llGetSubString(vec, 0 , Index ); Edited July 12 by Xiija Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted July 12 Share Posted July 12 string vectors = "<30.404861, 44.845428, 23.429020>, <25.404861, 44.845428, 23.429020>, <20.404861, 44.845428, 23.429020>"; list data = llCSV2List(vectors); vector first = llList2Vector(data, 0); ... 1 Link to comment Share on other sites More sharing options...
Innula Zenovka Posted July 12 Share Posted July 12 (edited) 46 minutes ago, Wulfie Reanimator said: string vectors = "<30.404861, 44.845428, 23.429020>, <25.404861, 44.845428, 23.429020>, <20.404861, 44.845428, 23.429020>"; list data = llCSV2List(vectors); vector first = llList2Vector(data, 0); ... To make that work, I think you need to read the first item in the list "data" as a string (which is what it is) and then cast it as a vector, thus: Quote string vectors = "<30.404861, 44.845428, 23.429020>, <25.404861, 44.845428, 23.429020>, <20.404861, 44.845428, 23.429020>"; list data = llCSV2List(vectors); vector first = (vector) llList2String(data, 0); Otherwise it will report "first" as having the value ZERO_VECTOR, because there aren't any vectors in the list data, only strings that look like vectors. Edited July 12 by Innula Zenovka 1 Link to comment Share on other sites More sharing options...
Xiija Posted July 12 Author Share Posted July 12 (edited) 51 minutes ago, Wulfie Reanimator said: vector first = llList2Vector(data, 0); TY , i hadda change a lil bit, but works, vector first = (vector)llList2String(data, 0); ( Innula beat me! ) Edited July 12 by Xiija Link to comment Share on other sites More sharing options...
Love Zhaoying Posted July 12 Share Posted July 12 12 minutes ago, Innula Zenovka said: To make that work, I think you need to read the first item in the list "data" as a string (which is what it is) and then cast it as a vector, thus: I had forgotten that llCSV2List() was event smart enough even to separate on the "<..>", so it's not too terrible if you have to cast it back to a Vector. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now