MV How to use this.wait(x) in a plugin command (MV)

I try to make a plugin command, that moves pictures around. With normal script calls, I would put this.wait(x) at the end, and everything will work just fine.

When I do this in a plugin command, it will not wait, and just go to the next command straight away. If I have 1 image making multiple movements, it only shows the last movement, overwriting everything I did before.

Code:
        if(command === 'Move') {
            AudioManager.playSe( { name: 'MoveSE', volume: 45, pitch: 100, pan: 0 } );
            $gameScreen.movePicture(99, 1, 408, 312, 100, 100, 255, 0, 15);
            this.wait(15);
        };

Just as example, if I do it like above, it works, but when I run 2 of those close to each other, it will only run the latest one.

I do understand that this.wait(x) is not the correct command, but what can I use instead?
Your code looks correct, but where did you put it?

This short plugin works for me in MV:
JavaScript:
(function() {
'use strict';
  const alias = Game_Interpreter.prototype.pluginCommand;
  Game_Interpreter.prototype.pluginCommand = function(command, args) {
    if (command === "Test") {
      $gameScreen.startFlash([255,255,255,64], 120);  // 25% white, 2 seconds
      this.wait(120);
    } else {
      alias.apply(this, arguments);
    }
  };
})();
Tested with this simple event:

◆Plugin Command:Test ◆Text:None, Window, Bottom : :Go!
Spoiler: Original reply
Well, I've put this in a plugin, inside a function, like you taught me.

However, if I run 2 or more in a row, with more different destinations, it will go straight to the final destination.

The coordinates of the image are determined by a variable. Each "slot" has an Id and each Id corespons with coordinates in an array. This slot Id changes in between the calls.

Like this:
Code:
◆Control Variables:#0004 ♠ Target Slot += 1
◆Plugin Command:Move
◆Control Variables:#0004 ♠ Target Slot += 1
◆Plugin Command:Move
◆Control Variables:#0004 ♠ Target Slot += 1
◆Plugin Command:Move
◆Control Variables:#0004 ♠ Target Slot += 1
◆Plugin Command:Move
◆Control Variables:#0004 ♠ Target Slot += 1

But it doesn't go to slot 1, 2, 3 or 4, but straight to slot 5.

Everything else seems to work just fine, but the script calls just seem to not wait.

When I do
◆Plugin Command:Move
◆Text:None, Window, Bottom: :Go!
◆Plugin Command:Move
◆Text:None, Window, Bottom: :Go!
◆Plugin Command:Move
◆Text:None, Window, Bottom: :Go!

It works... But when I need to do the calls after each other, it just won't. It works if I put a "Wait x frames" there, but then it runs its own wait + the wait I put in, making it wait to long.
Spoiler: 1st edit
Edit: The problem have seem to disappear by itself. I didn't change anything and suddenly it works... 😛 hahaha. I don't know how, but it is good to know this.wait(x); is correct.

Thanks for your input!
Edit again: Oh my god, I am so stupid... The targets were in a straight line, making it seem like a single movement... Haha. Yeah, you're all granted permission to point and laugh at me. 😛
Edit again: Oh my god, I am so stupid... The targets were in a straight line, making it seem like a single movement... Haha. Yeah, you're all granted permission to point and laugh at me. 😛
Hey, don't talk about my friend JohnDoeNews like that! (He's very epic)
Hey, don't talk about my friend JohnDoeNews like that! (He's very epic)
Hahaha. Finally someone who notices.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-use-this-wait-x-in-a-plugin-command-mv.169967/