edit: ok this capx does an insertion sort based on your needs, hopefully
I based the array on your capx rather than what you've indicated above, as the order is different in the capx.
i.e. name, value rather than value, name. I'll let you plug it into your code.
[attachment=0:3je792y0][/attachment:3je792y0]
Apart from the issues with your actual algorithm implementation, there's a basic way you're trying to loop that won't work. You're trying to use them like for loops in normal languages.
e.g.
[quote:3je792y0]System: For i from 1 to A_Initiative.Width-1
and then
[quote:3je792y0]System: Set current to A_Initiative.at(i, 1)
You need to use 'loopindex', not 'i'. 'i' is just a tag for the loop. e.g. you could refer to loopindex(i). Normally I use "X" or "Y" or similar, if I need to use it.