_interpreter.setWaitMode("message") doesn't work as expected

ndruha

Warper
Member
Joined
Jul 13, 2019
Messages
2
Reaction score
1
First Language
ukrainian
Primarily Uses
RMMV
Hi. I'm new to RPG Maker MV, but experienced in game dev and programming. I would like to make my first game in RPG Maker to learn it. I tried to make a small game with visual event commands, and after succeeding, I'm now moving everything to Javascript, as I want to have my full game logic base in javascript only, in order to be unit-testable and portable to a different engine in future.

My question today is about how I wait after the message appears on screen to do something else? In the event command it happens by itself, but it's not like that in javascript. Here is my event handler function, where I tried to wait:

PHP:
SceneLighthouse.prototype.exitEvent = function() {
    $gameMessage.add("<WordWrap>I don't have any reasons to exit my small cosy lonely place right now.");
    $gameMap._interpreter.setWaitMode("message");
    $gamePlayer.moveStraight(8);
}
I want to achieve that the character move up only after the dialog box disappears. However, she moves up right together with the message appearance on the screen. What am I doing wrong here? RPG maker version is 1.6.2.

The second question is about my way to workaround this, using setTimeout:

PHP:
SceneLighthouse.prototype.exitEvent = function() {
    $gameMessage.add("<WordWrap>I don't have any reasons to exit my small cosy lonely place right now.");
    this.wait(() => !$gameMessage.isBusy(), () => $gamePlayer.moveStraight(8));
}
So I'm waiting while the $gameMessage.isBusy() becomes false again.
That works, where the wait function is simply this:

PHP:
SceneLighthouse.prototype.wait = function(predicate, callback) {
    setTimeout(() => {
        if (predicate() === true) {
             callback();
        }
        else {
            this.wait(predicate, callback)
        }
    }, 100);
}
Is this way ok in RMMV, or is there any concernes? If this is ok, then I would rather use this general way for my waits for anything in the game to not mess with the engine specifics too much.
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,547
Reaction score
1,024
First Language
EN
Primarily Uses
RMMV
My question today is about how I wait after the message appears on screen to do something else? In the event command it happens by itself, but it's not like that in javascript. Here is my event handler function, where I tried to wait:

PHP:
SceneLighthouse.prototype.exitEvent = function() {
    $gameMessage.add("<WordWrap>I don't have any reasons to exit my small cosy lonely place right now.");
    $gameMap._interpreter.setWaitMode("message");
    $gamePlayer.moveStraight(8);
}
I want to achieve that the character move up only after the dialog box disappears. However, she moves up right together with the message appearance on the screen. What am I doing wrong here?
This is expected behaviour. The interpreter is for converting event commands to code; your code says "add some text to $gameMessage, tell the interpreter to wait until the message is gone, and move the player up 1 tile". The moveStraight call does not pass through the interpreter, it is a method called there and then. If you're porting all your events to pure JavaScript, there's no need to retain the event interpreter~
 

ndruha

Warper
Member
Joined
Jul 13, 2019
Messages
2
Reaction score
1
First Language
ukrainian
Primarily Uses
RMMV
This is expected behaviour. The interpreter is for converting event commands to code; your code says "add some text to $gameMessage, tell the interpreter to wait until the message is gone, and move the player up 1 tile". The moveStraight call does not pass through the interpreter, it is a method called there and then. If you're porting all your events to pure JavaScript, there's no need to retain the event interpreter~
Thank you for clarification!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

The video of a psycho chasing people on the streets with a sword before getting subdued is wild. Apparent screenshots of his Twitter feed before it went private reveal a dangerous delusional mindset. I heard there was a bow person too. The crazies are really coming out of the woodworks.
Stream will be live shortly with some Witcher 3, followed by a session of the Interactive Text Adventure! Feel free to drop by!
Managed to find a way to hang a bed cover over my window. So no more being toasted alive in the afternoon!:kaoswt2:
So, uh, has anyone tried buying any resources from KokoroReflections? Because I've been looking for a 'buy' button on the site for like 10 minutes now and can't find one.
Any also thought it's too cringy to put the word "and you" in your credit as a special thanks?
Cause that's what I thought...

Forum statistics

Threads
97,993
Messages
948,401
Members
129,255
Latest member
RPGLordLight
Top