ID:2246018
 
Not Feasible
Applies to:DM Language
Status: Not Feasible

Implementing this feature is not possible now or in the foreseeable future
Disclaimer: This is just a stupid idea of myself, but who knows, some people might find it useful, who knows.

I'm asking if it could be possible to add a new argument to animate that calls a certain proc after the end of the animation. Using it would look somewhat like that then:

mob/player/proc
Teleport(var/x as num, var/y as num, var/z as num)
src.transition=new
src.client.screen+=transition
animate(src.transition,alpha=0,time=5,execute=src.DeleteFadeIn)
src.loc="[x],[y],[z]"

DeleteFadeIn()
src.client.screen-=transition


This would help greatly with timing certain events with animations and animations among themselves. Currently, to time it right, I usually use a lot of sleep(time of animation) and it would be cool to circumvent the use thereof altogether. Whether this is realizable or not, no idea.
Basically, this is what you want:
animate(thing, time = t, execute = SomeProc)

and this is how it's currently done:
animate(thing, time = t)
spawn(t) SomeProc()

Is that right?
Somewhat. I thought it might be a good way to circumvent spawn by the animate calling it freely once it's done animating, which could free up some lag maybe in some cases. As I said, maybe a stupid idea.
It's actually not that bad, I can definitely see the use in it. It would probably have to take a full proc path instead of just 'SomeProc' to be more in line with other manual methods of proc execution but it would save some headaches for sure. Not sure it would help with overhead any since it would probably be like using call() and spawn() together internally.
The biggest benefit would be that it runs on real time, not byond time.

This is why a spawn() version of the same thing can appear to lag, its normal for there to be some drift in how world.time progresses forward compared to reality, but because animate() runs on the client, it uses actual time to space out its animations, not game time, and the drift between the two causes the spawn() to run a little late.

/tg/ uses its own timer system that trys to take this into account for such things.
Lummox JR resolved issue (Not Feasible)
Here's the problem with what you're asking: All procs run on the server. This would literally be no different than doing a spawn() or a sleep(), because it's impossible to time this to client-side animation.
Any way to make animates stack then, like having different animate() for the same obj and instead of all of them being executed at the same time, letting one be executed after another?
Animations are already sequential by default. Having multiple animations run at the same time on the same object (parallel animations) wasn't even possible until 511.
In response to Kayren
To elaborate, you simply leave the object out of successive calls to animate(), as the DM reference says.
// Shift 32 pixels to the east for 0.2 seconds
animate(thing, time = 2, pixel_x = 32)

// then shift back for 0.2 seconds.
animate(time = 2, pixel_x = 0)
Thanks guys, I'll keep that sequential stuff in mind.