Input Number with Javascript

Hello! I'm trying to write in a script a call for the input number window, but i can't get make it appear.
$gameMap._interpreter.setupChoices([choices, -2, 0, 2, 0]); $gameMessage.setChoiceCallback(function(responseIndex) { if(responseIndex == choices.length-2) { i+=6; } else if(responseIndex == choices.length-1) { i-=6; i = Math.max(i, 0); } else if(responseIndex == -2) { i = -2; } else { for(var j = 0; j<choices.length; j++) { if(j == responseIndex) { var a = 0; $gameMessage.setNumberInput(a, 2); $gameMap._interpreter.setWaitMode('message'); } } } $gameSystem._retireChoices = i; }); this.setWaitMode('message');


I thought it was because the game didn't pause for the window, but i did add a pause, so i'm not sure what i am doing wrong. Thanks in advance for the help.
The number input only comes up along with a message box, as the number window is a child of the message one.
So what should i do? Create a blank message box via script before calling the input window?
I'm pretty sure that's how the event command does it.

Original thread: https://forums.rpgmakerweb.com/threads/input-number-with-javascript.134861/