Whats wrong with this code?

Hi all!!

My goal is to display text after an attack, I want the text to be there for 90 frames then clear off.
This is the code Im using:
Code:
var text = 'Congratulations!';
var wait = 90;
SceneManager._scene._logWindow.addText(text, wait);
SceneManager._scene._logWindow.clear();

The problem is, the last line "SceneManager._scene._logWindow.clear();" makes no text appear, Im assuming thee text is displayed but the 90 frame wait its not kicking in, if I dont insert that last line, the text is displayed but not cleared out after the 90 frames.

I tried placing de number 90 instead of the "wait" variable, to no avail.

Any tips or pointers?

Thanks!!!
I'm not SUPER skilled at JavaScript yet but I'll try to help. 🙂
It looks to me like the addText() function only takes one argument- the text itself. So it's not doing anything with the second argument.
Try:

var text = 'Congratulations!';
var wait = 90;
SceneManager._scene._logWindow.addText(text);
SceneManager._scene._logWindow._waitCount = wait;

I'm not sure if that's going to clear after the 90 frames or not.

EDIT:
Actually it looks like this is going to be closer to the way the game does it:
SceneManager._scene._logWindow.push('addText', text);
SceneManager._scene._logWindow.push('wait');
SceneManager._scene._logWindow.push('wait');
SceneManager._scene._logWindow.push('wait');
SceneManager._scene._logWindow.push('wait');
SceneManager._scene._logWindow.push('wait');
SceneManager._scene._logWindow.push('clear');

Each 'wait' command is 16 ticks, and the addText command automatically adds one wait. I'd try that.
Yep, it works!!!

Thanks man, again =)

Original thread: https://forums.rpgmakerweb.com/threads/whats-wrong-with-this-code.86425/