I always tend to have this problem.
Say I try to do something like that
get_current_image will return the wrong result, because the animation for the slide_image() has not ended.
Is there a wait function or something?
setTimeout is not that ideal too since multiple calls stacks up the queue.