setWaitMode() error in custom plugin

● ARCHIVED · READ-ONLY
Started by lambzor 4 posts View original ↗
  1. Trying to use
    Code:
    this.setWaitMode("message")
    in a js plugin. however i get an error saying it is not a function. How do i get access to this method?
  2. setWaitMode is a method of Game_Interpreter. If you're not invoking it from a member of that class, try this instead:
    Code:
    $gameMap._interpreter.setWaitMode('message');
    Or, if it's for troop events:
    Code:
    $gameTroop._interpreter.setWaitMode('message');
  3. That is exactly it! Thank you. One more question related to this subject:
    How do you use this with a loop?
    The following example does not work. Is there a way to do something like this?

    Code:
    data.forEach(obj => {
     $gameMessage.add(obj.text)
    })
    $gameMap._interpreter.setWaitMode('message')

    Is there a way to let the interpreter know it should wait for the last message?

    Code:
    // wait for:
    data[data.length - 1].text
  4. Not sure why that wouldn't work for you, I just tested in a project with no plugins and the following in an event and it worked OK. Two message boxes show (the last line overflows to the next message) and the animation only plays when the second message is closed.
    Code:
    ◆Script:['bla','ble','bli','blo','blu'].forEach(function(e) {
    :      :  $gameMessage.add(e);
    :      :});
    :      :$gameMap._interpreter.setWaitMode('message');
    ◆Show Animation:Player, Song
    Maybe try checking your "data" variable to see if it's empty or something? :kaoswt: You can use console.log(data) to output values to the console (F8 during test-play).