Dirk Callahan
Junior Member
Join date: 26 Jul 2004
Posts: 1
|
08-19-2004 13:09
I am writing a poker game. In order to rank straights and straight flushes, it would be great if I could easily sort a list of integers (which represent cards) in ascending order. However, either I'm misusing llListSort, or I don't understand its purpose.
Here are a couple real-life examples:
list myList = [40, 6, 28, 5, 36] myList = llListSort(myList, 1, TRUE) llSay(0, llList2CSV)
this is what returns: 6, 5, 36, 28, 40
If I run the script again, and get (for example) this list: 51, 46, 16, 9, 28 it is sorted as: 16, 9, 46, 28, 51
This doesn't make any sense to me, even if it was sorting strings instead of integers.
Any help or insight from the gurus would be much appreciated.
|
Cypher Olsen
Registered User
Join date: 7 Aug 2004
Posts: 54
|
08-19-2004 14:15
I'm certainly not a guru, but from what I can tell you have your sort command setup correctly. This should be working. The only thing I noticed is with your llList2CSV. I'm assuming you just didn't type the whole thing in, but what you have shown is incorrect, i think. you have... list myList = [40, 6, 28, 5, 36] ; myList = llListSort(myList, 1, TRUE) ; llSay(0, llList2CSV)
I think it should be list myList = [40, 6, 28, 5, 36] ; myList = llListSort(myList, 1, TRUE) ; llSay(0, llList2CSV(myList));
Again, I'm sure your actual script probably had this, but It's the only thing I could see. Other than that, I don't know why it wouldn't work. You might try setting STRIDE to 0 instead of 1, but according to the Wiki, both should do the same thing. Good luck!
|