ID:139710
 
    Matrix2Icon(Info)
var/list/Matrix = Info
var/icon/I = new(icon='blank.dmi',icon_state="MMM")
for(var/x in 1 to 16)
for(var/y in 1 to 16)
I.DrawBox(Matrix[x][y],
25-x, 25-y)

var/icon/newicon = new (I)
for(var/X in 0 to 36)
I.Insert(newicon.Turn(10), "[X*10]") //the problem is caused by this
usr << ftp(I, "Icon.dmi")


Info is a 2 dimensional matrix made out of lists, by the way. Either way, what this does is turn a 16x16 matrix full of hex values into an icon. Then, it's supposed to rotate it and spit out the file for me. However, Insert() is behaving really oddly. When I comment out the for() loop it's in, the proc will give me my icon with only a single state, like it should. However, for some reason, calling Insert() makes the proc output my skin file under the name Icon.dmi. Also, if it makes a difference, I tried switching newicon's and I's roles, and it still did the same thing (even if I just took an empty icon). Also, the icon is turning properly, I checked to make sure.
1. icon.Turn() doesn't return an icon.
2. If you keep Turn()ing the same icon after it's been turned, it'll look really ugly. You're better off having newicon = new(I) inside the loop.
var/icon/newicon
for(var/X in 0 to 360 step 10)
newicon = new(I)
newicon.Turn(X)
I.Insert(newicon, "[X]")
In response to Kaiochao
Yeah, I got #2, I originally didn't turn it repeatedly. However, I figured it would make my computer freeze for a little less time if I changed it for debugging (I got tons of runtime errors...).

But yeah, thanks for #1, I never would've realized that (I'm pretty sure I've done that before, too; tons of procs that don't return values mess with me).