Seeking simple code to rank a series of stats

I’m afraid I don’t have a lot of time, but this is what I’ve come up with.

Note: this will get you the four numbers in the correct order but it doesn’t tell you the name of what each stat represents… I’m assuming you will match them again afterwards or that doesn’t matter? :confused:

*create stat_a 0
*create stat_b 0
*create stat_c 0
*create stat_d 0
*create temp_stat 0
*create first stat_a
*create second stat_c
*create third stat_b
*create fourth stat_d

*comment compare 2 pairs to get highest (first and second) and lowest (third and fourth)
*if stat_b >= stat_a
  *set first stat_b
  *set third stat_a
*if stat_d >= stat_c
  *set second stat_d
  *set fourth stat_c

*comment cross check the lower numbers with the higher numbers
*if fourth >= first
  *set temp_stat fourth
  *set fourth first
  *set first temp_stat
*if third >= second
  *set temp_stat third
  *set third second
  *set second temp_stat

*comment compare top1 and top2 - for first and second place
*if second > first
  *set temp_stat first
  *set first second
  *set second temp_stat

*comment compare third and fourth - swap if necessary.
*label third_fourth
*if fourth > third
  *set temp_stat third
  *set third fourth
  *fourth temp_stat
*goto all_done

Edit: down to 33 lines if you remove the comments and spaces.