HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Arranging integers from greatest to least

09-24-2004, 01:15 AM#1
NightBlade15
Ok, I have a set of 5 integers I need to arrange from greatest to least. Each one has its own separate variable but I want to put them into a single variable array in order from greatest to least so I can allow the greatest number to perform the action associated with its variable first, then the second greatest, third greatest, etc.. These variables will increase and decrease in between uses of them, so I need a trigger to sort them by size before each use (my map will ultimately have up to 8 of these variables for sorting, but right now I only have 5) Any suggestions on a easy way to do this without using a multitude of triggers to sort them?
09-24-2004, 04:01 AM#2
Raptor--
Quote:
Originally Posted by NightBlade15
Ok, I have a set of 5 integers I need to arrange from greatest to least. Each one has its own separate variable but I want to put them into a single variable array in order from greatest to least so I can allow the greatest number to perform the action associated with its variable first, then the second greatest, third greatest, etc.. These variables will increase and decrease in between uses of them, so I need a trigger to sort them by size before each use (my map will ultimately have up to 8 of these variables for sorting, but right now I only have 5) Any suggestions on a easy way to do this without using a multitude of triggers to sort them?

for loop A from 1 to maxints
++++for loop B from 1 to maxints
++++++++if int[A] > int[b] then
++++++++++++set temp = int[b]
++++++++++++set int[b] = int[A]
++++++++++++set int[A] = temp

thats the most basic way to sort items in an array