MV How to make a simple window?

Hi guys, I'm learning a bit of javascript and I would like to try to create a window to practice some ideas on it

However I can't get my window to show in the game

Here is my code:
function helloWorld() { var simpleWindow= new Window_Base(200,200,300,300); simpleWindow.activate(); simpleWindow.open(); simpleWindow.show(); simpleWindow.drawText("Hello World", 200,200,300,"center"); }
Then in the game I have an event that calls this function, I have tested it by adding $gameMessage.add("hi"); in the script and works.

I have tried to look at code examples on the internet, but nevertheless they seem very complex for my current knowledge of js, I would appreciate any help to understand how classes work in rpg maker.
I see that the topic has a RMMV tag, but you've got your profile set to "Primarily Uses: RMMZ". The answer to your question depends on which of those is accurate. Assuming that your question truly pertains to RMMV, here is the corrected version of your code:

JavaScript:
function helloWorld()
{
    var simpleWindow = new Window_Base(200, 200, 300, 300);
    SceneManager._scene.addWindow(simpleWindow);
    simpleWindow.drawText("Hello World", 0, 114, 300, "center");
}

Basically, your main issue is that you needed to add the window to a scene. SceneManager._scene.addWindow(simpleWindow); adds the window to the current scene. It will be active and visible by default, so you don't need the activate/open/show lines.

Also, the way you had your drawText function set up, the text wouldn't have been visible, so I adjusted those parameters a little.

But if you actually meant to choose RMMZ in the subject prefix, then you'll want to use this instead:
JavaScript:
function helloWorld()
{
    var simpleWindow = new Window_Base(new Rectangle(200, 200, 300, 300));
    SceneManager._scene.addWindow(simpleWindow);
    simpleWindow.drawText("Hello World", 0, 114, 300, "center");
}

But ultimately, if you want to do anything useful with this knowledge, you're going to need to learn how to make your own window class, and possibly your own scene class as well. You're gonna have to either buckle down and try to understand those tutorials, or you're going to have to read through the engine code for examples.
I see that the topic has a RMMV tag, but you've got your profile set to "Primarily Uses: RMMZ". The answer to your question depends on which of those is accurate. Assuming that your question truly pertains to RMMV, here is the corrected version of your code:

JavaScript:
function helloWorld()
{
    var simpleWindow = new Window_Base(200, 200, 300, 300);
    SceneManager._scene.addWindow(simpleWindow);
    simpleWindow.drawText("Hello World", 0, 114, 300, "center");
}

Basically, your main issue is that you needed to add the window to a scene. SceneManager._scene.addWindow(simpleWindow); adds the window to the current scene. It will be active and visible by default, so you don't need the activate/open/show lines.

Also, the way you had your drawText function set up, the text wouldn't have been visible, so I adjusted those parameters a little.

But if you actually meant to choose RMMZ in the subject prefix, then you'll want to use this instead:
JavaScript:
function helloWorld()
{
    var simpleWindow = new Window_Base(new Rectangle(200, 200, 300, 300));
    SceneManager._scene.addWindow(simpleWindow);
    simpleWindow.drawText("Hello World", 0, 114, 300, "center");
}

But ultimately, if you want to do anything useful with this knowledge, you're going to need to learn how to make your own window class, and possibly your own scene class as well. You're gonna have to either buckle down and try to understand those tutorials, or you're going to have to read through the engine code for examples.

Thank you so much for your help

And yes, I think I forgot to configure the profile to show that I also have MV, which I acquired in these Chinese New Year deals.

I was reading a little over some of the scripts that came with MV (itemBook and Enemybook, js) together with RPG Maker MV library, If you have any particular recommendations for learning I would love to hear from you and again thank you very much for your help.
another way to learn JS is to learn from other plugins that uses windows
and how those are made and how they draw information into them.

there are a bunch to learn from through 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-simple-window.144615/