Fix nested call problem for script engine (when an interepreter calls a function like updateframe, in which case the animation script is reseted before complete).
This fix may cause bugs for old mods, so keep an eye on that to see if a backward compatible flag is required.