I recently discovered the sort command.. which would probably be far more efficient than my horrible code if I could get it to work for me in other than a very simple array.
If instead i have a type that looks something like this:
type targetarray
quantity as integer
beastyno[150] as integer
distancetoexit[150] as float
end type
targets as targetarray
so it might look like:
Quantity:4 //number of beasties in target scope
beastyno[4,6,2,13] // filled with my beasty reference numbers
distancetoexit[13,40,20,11} // filled with their respective distance to exit.
If I then wanted to sort beastyno on distancetoexit I'd get something like:
Quantity:4
distancetoexit [11,13,20,40] < sort this smallest first
beastyno[13,4,2,6] < and rearrange these to match
and then get my answer by querying
target=targets.beastyno[1]
is that possible? or am I being lazy? I do currently have something that works, just wondering if I'm missing a simple trick.