move picture script call with wait until finish?

hey there, been searching for this for days, but nothing i found actually works. I just want to be able to use the wait command in my own javascript functions, mainly so i can handle animations and all that.
The reason why i need this is because i use way more than 100 pictures at once and thus the editor is useless for this.
So yeah, how exactly do you tell the engine to "wait" until the picture has finished moving? (like you would do if you used the move picture command in the editor)

Thanks in advance!
this.wait(x) x being the wait. but in the editor, if you move a picture over 60 frames,
the wait is also 60 frames, but I dont know how to use that.

there are places to get the info you need though. if you try to search for
wait scriptcall or javascript rpg mv, you should get the info.

there is also information found here for scriptcalls and stuff used for javascript functions.
@ShadowDragon i tried this.wait(x) but with no result, maybe because im calling the function from my own, within a for loop, no idea if it can be used like that, i guess not.
This is such a shame because i can do pretty much anything i want with picture commands, but this is the last bit of info i need to wrap everything up.
These wait routines are part of the event command interpreter. If you call your function via a Script command, that's a single command: the interpreter will run the associated code, then check its wait mode/timer stuff before moving onto the next command.

It sounds like you need to split your code into multiple consecutive commands, so that the interpreter has a chance to realise the picture is moving and wait for it before processing the next command?

Also, note that the this keyword is context-dependent. In a normal Script command in an event, this will reference the current event interpreter. In other contexts, you can try one of these:
JavaScript:
$gameMap._interpreter.wait(x);
$gameTroop._interpreter.wait(x);

Depending on the movements you're after, you might find a plugin like this helpful~

Original thread: https://forums.rpgmakerweb.com/threads/move-picture-script-call-with-wait-until-finish.122026/