ID:132725
 
Would it be possible to get flick to return a value? I'm not sure if there's functionality to do this already, but I'd just looked it up in the reference.

In this sense, I want flick to be able to do this:
mob/proc/dostuff()
sleep(flick("attacking",src))
uber_cool_stuff()


Instead of having to know how long the icon states are, because they might vary from x to y.
Would be better to actually have the basic ability to know an animation's length in ticks (without having to play it on something).
mob/verb/animation()
var/state = "myanim"
var/n = get_animation_duration(src.icon,state)
flick(state,src)
sleep(n)
src << "animation finished"

This kind of thing doesn't make sense to add to flick() itself, unless instead they add a flag to it that makes it not return until the animation has finished playing (which would be quite convenient), so you could do it like this instead:
mob/verb/put_on_cape()
src.can_move = 0
src.invincible = 1
flick("putcape",src,1)
src.invincible = 0
src.can_move = 1
//player is invincible while putting on cape
In response to Kaioken
Kaioken wrote:
Would be better to actually have the basic ability to know an animation's length in ticks (without having to play it on something)

Agreed, it's always better to seperate things out into different functions. Having it combined with flick() would make this specific problem simpler, but it would make only this problem easier, and it would leave people still wanting this ability outside of flick().
flick(myIcon, theObject)
sleep(myIcon.duration("my state"))
In response to Loduwijk
Actually, I like this.
Sometimes getting the value of how long the icon_state lasted without having to know the actual icon has it's advantages.
I'd rather have a simple return value instead of a work around to find the duration.
In response to Maximus_Alex2003
How exactly can you not know what the atom's icon is, when it's stored in its icon var? You don't make sense.
Giving flick() such a return value doesn't make sense either, since it's meant for playing an animation, not getting info about something, which should be separate. That's like getting rid of winget() and somehow using winset() to get data about controls.
In response to Kaioken
Kaioken wrote:
How exactly can you not know what the atom's icon is, when it's stored in its icon var? You don't make sense.

EDIT: I made perfect sense...
Some of us want to know what an icon's total delay value of an icon_state without actually knowing the icon.
ex; not having to if() a whole bunch of icons in your source.
ex;
proc/Wait_A_Minte()
var/X = src.icon_state
sleep(getdelay("[X]",'A.dmi'))


Giving flick() such a return value doesn't make sense either, since it's meant for playing an animation, not getting info about something, which should be separate. That's like getting rid of winget() and somehow using winset() to get data about controls.

You wrongly reposted to me...
If not, then you clearly didn't read right...

I said, icon_state delay.
Besides, if not a return value for flick() then some sort of way to get the delay time of an icon_state during run time.
In response to Kaioken
Kaioken wrote:
How exactly can you not know what the atom's icon is, when it's stored in its icon var? You don't make sense.
Giving flick() such a return value doesn't make sense either, since it's meant for playing an animation, not getting info about something, which should be separate. That's like getting rid of winget() and somehow using winset() to get data about controls.

Personally, I think it makes perfect sense, though it does leave room to be expanded on, as the posters above have done.