Xed Saunders Posted April 6, 2020 Share Posted April 6, 2020 i'm going mad with a simple thing, i can't see what i'm doing wrong, i am sorting a list composed by strings. list names=["36.321","name2","30.456","name1","30.455","name3","29.452","name4"]; list sorted=llListSort(names,2,TRUE); llSay(0,"output:"+(string)sorted); this works and produce Object: output:29.452name430.455name330.456name136.321name2 this don't list newentry=[]; list allbest=[]; default { state_entry() { llListen(-3500, "", "", ""); } listen(integer channel, string name, key id, string listener) { newentry=newentry+[llParseString2List(listener,[""],[" "])]; allbest=llListSort([newentry],1,TRUE); llSay(0,"output:"+(string)allbest); } } produce output:36.234name534.234name132.234name4 is the order i type them in the chat with /-3500 TimeName can't llistsort be used with a listener? tia Link to comment Share on other sites More sharing options...
KT Kingsley Posted April 6, 2020 Share Posted April 6, 2020 (edited) The second script you've posted will never work: you have lists inside lists: [llParseString2List(listener,[""],[" "])] [newentry] The result of llParseString2List is a list, so putting it inside brackets is putting a list inside a list. And the same applies to newentry. In the llListSort call you set a stride of 1. I think you mean 2 there. In the llParseList2String call you don't specify any separators, but you do include a space in the spacers. Separators are discarded, while spacers are included in the list as items in their own right. I think you want them the other way around. Also, a slightly neater way to see what a list contains is to use the function llList2CSV which separates the list items from each other with commas. I think the example below might be what you're looking for: list newentry=[]; list allbest=[]; default { state_entry() { llListen(-3500, "", "", ""); } listen(integer channel, string name, key id, string listener) { newentry=newentry+llParseString2List(listener,[" "],[]); allbest=llListSort(newentry,2,TRUE); // llSay(0,"output:"+(string)allbest); llOwnerSay ("Output: " + llList2CSV (allbest)); } } Edited April 6, 2020 by KT Kingsley Link to comment Share on other sites More sharing options...
Xed Saunders Posted April 6, 2020 Author Share Posted April 6, 2020 thanks. i'll try iw as i can login, by the way doing a quick copy and paste i've pasted an error in the stride, which is 1, your guess was correct 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