Break lines in plugin command

Hi people!

I'm doing a plugin command that puts a text in a help window.
However, I can't make this plugin command put a text with more than one line. When I insert \n or \\n, the line won't break, instead, the text continues.

I can use a script call to put this text too, and it works fine with line breaks.

I only put the 4 plugin commands together to take the print, but I'm not using the four at the same time. But that's is my tries.
changehelp = command
menu = args[0]
0 = args[1]
the rest of the text is the args[2] and so on(using slice and join, to put them together. Maybe it is the cause?).
Spoiler
bk0dtio.png

9Wut5VT.png


So, how can I make the plugin command to recognize the \n for line break?
Below is a part of my code. t
Code:
    if(command.toLowerCase() === 'changehelp') {
    let arg0 = args[0].toLowerCase();
    let helpType;
    let helpText = '';
        switch (arg0){
            case "menu":
                helpType = Eli.Param.HelpWindows.menuText;
            break;
            case "itemcategory":
                helpType = Eli.Param.HelpWindows.itemCtText;
            break;
            case "skillcommand":
                helpType = Eli.Param.HelpWindows.skillTypeText;
            break;
            case "equipcommand":
                helpType = Eli.Param.HelpWindows.equipCmdText;
            break;
            case "equipslot":
                helpType = Eli.Param.HelpWindows.equipSlotText;
            break;
            case "options":
                helpType = Eli.Param.HelpWindows.optionsText;
            break;
            case "gameend":
                helpType = Eli.Param.HelpWindows.gameEndText;
            break;
        };
        helpText = args;
        helpType[args[1]] = helpText.slice(2).join(" ");
    };
@Eliaquim Is this a custom help window, or the standard help window? Is the window using the drawText or drawTextEx function to print the text? The text in the first two plugin commands should work.
Hi @Ossra !
It's not a custom one. It is the standard, that I put in the scene menu.
Spoiler
Code:
Scene_Menu.prototype.create = function() { // overwrite
    Scene_MenuBase.prototype.create.call(this);
    this.createHelpWindow();
    this.createCommandWindow();
etc...
}

Scene_Menu.prototype.createHelpWindow = function() {
    this._helpWindow = new Window_Help();
    this.addWindow(this._helpWindow);
}

Eli.HelpWindows.Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function() {
    Eli.HelpWindows.Scene_Menu_createCommandWindow.call(this);
    this._commandWindow.setHelpWindow(this._helpWindow);
}
};

Hmm...
Now that you talk about the drawText and drawTextEx, I realize that I never though about that.
But I guess that is the drawTextEx because I can use other escape characters like \c[x] \v[x] etc.

But the plugin is setting the text with the function:
Code:
.setText('text here');

That I think that can be found here(RM MV 1.6.2):
Code:
Window_Help.prototype.setText = function(text) {
    if (this._text !== text) {
        this._text = text;
        this.refresh();
    }
};

Window_Help.prototype.refresh = function() {
    this.contents.clear();
    this.drawTextEx(this._text, this.textPadding(), 0);
};

[[[EDIT]]]] - When I put the text through the parameter(
@type note[] ) of the plugin, it works ok. I press ENTER there, and the \\n appears in the parameter(text).
I think that maybe this is related to how I set the parameter?
Code:
menuText: JSON.parse(Eli.Parameters['Menu Help Text'] || '[]').map(JSON.parse),
@Eliaquim Hmm, well, from what I see of your code and what you have described, the text should be displaying properly. Is it possible to share the code for the entire plugin?
@Ossra Yes, right here.
@Eliaquim Tack a 'replace' onto the end of the line which is joining the argument array :

Code:
helpType[args[1]] = helpText.slice(2).join(" ").replace(/\\n/g, '\n');

The issue seems to be that the newline character is not being properly converted.
@Eliaquim Tack a 'replace' onto the end of the line which is joining the argument array :

Code:
helpType[args[1]] = helpText.slice(2).join(" ").replace(/\\n/g, '\n');

The issue seems to be that the newline character is not being properly converted.
You read my mind xD
Thanks for the fix! I was already a lot of time trying to figure it out ^^

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/break-lines-in-plugin-command.115420/