ID:788341
 
(See the best response by Forum_account.)
Code:
var/icon/I=icon('player.dmi')
for(var/v in I.IconStates(2))
flick(v,src)
sleep(I.GetFrames(v,1,SOUTH))//Or something like that?


Problem description:

Is there anyway to tell how many frames an Icon has?
Best response
I think there is, but you can't tell what the duration of each frame is. To determine how many frames there are, I think you can load each frame using the icon() proc (you can pass it a frame number). If you pass it a frame number that doesn't exist, there is some way you can tell (in not sure how off the top of my head and I don't have access to Dream Maker), so once you find a frame that doesn't exist you know the animation has fewer frames than that.
icon
proc
GetFrames(icon_state,dir,moving)
for(.=1 to 100)
var/x,y,reset
for(x=1 to Width())
for(y=1 to Height())
if(GetPixel(x,y,icon_state,dir,.,moving))
reset=1
break
if(reset)break
if(!reset)break
.--

This is what I ended up with. I figured I'd keep the dir variable because sometimes some dirs have more states. [Might as well]

Edit:
-I ended up needing to figure out how long the state last for has anyone ever figured that out?