(See the best response by Magicsofa.)
a litte trouble
im attempting a tactics type RPG & am uneducated about how to
"sort a list by there movement variable"
any insight?

Best response
Well, you have to loop through elements in the list, testing the relevant value, and swapping positions. I assume you have a list of mobs, so you can easily pass the list to a proc and then have the proc modify it into a sorted version. Like so:

for(var/i = 1, i < L.len, ++i)
var/mob/M = L[i]
var/k = i
var/hi = M.moves //whatever your movement variable is
for(var/j = i + 1, j <= L.len, ++j)
M = L[j]
if(M.moves > hi)
k = j
hi = M.moves
if(i != k)
M = L[i]
L[i] = L[k]
L[k] = M

Bascially there are two 'cursors' (i and j) and a max value (hi). Each j loop looks through the remaining list for something that scores higher than i. If you're not sure what's going on I recommend using sleep() and some output on each iteration so that you can see it working.
thanks for the help i will go ahead & give this a shot
if no avail :/ then ill have to come back

Login to reply.