ID:2210823
 
(See the best response by Lummox JR.)
Hey, I'm trying to make a player ranking system and I'm having lots of trouble. What I wanted was for a stat in a certain tab to show a list in the order from higher level var to lower level var.

I've tried lots of stuff and I feel like I'm not even close to getting it. All I got so far is a list of all players online and their levels, but not in an order.

I'm not asking for someone to just give me a code, but some base would be of great help. Thanks (=
The general problem is called "sorting" and it's pretty well understood. There are a couple libraries that sort lists generally, so that you can provide a custom sorting function, such as comparing by level.
You'd need a sorting algorithm. Of those, a bubble sort or insertion sort are likely the easier to implement and understand, although maybe not the most cpu-efficient ones available, one of which would be merge sort.

For examples in DM, you could check out SortProcs or read the pseudo-code on Wikipedia.
Thanks guys I'll take a look
Best response
Bubble sort is one of the worst sorts you can use unless there's some specific reason to use it. It's easier to understand, but IMO selection and insertion sorts are also easy. Insertion sort has a bad worst-case behavior and good best-case. Since this application is likely for a very small list, I recommend insertion sort. Insertion sort is also stable, which I think you want here.

Another common sort is quicksort. It is not stable, but relatively fast. Its worst case is terrible, but very rare. You use this for large lists.

Merge sort is close to quicksort for performance, and is stable; but it requires extra work space. This is also best used with large lists.

There are many other good algorithms out there, like dual-pivot quicksort, and Timsort, although they're harder to implement.