Show my custom Scene and Window via Script call or Console

Spoiler: OLD
I made a window in a plugin that I'm developing.
I would like to do some tests through the console (F8) to check if it is open or closed. However when i type "Window_" it does not appear. How can I do this?
Here is a part of the code:


Spoiler: Code
Code:
function Window_Tempo() {
        this.initialize.apply(this, arguments);
    }
  
    Window_Tempo.prototype = Object.create(Window_Base.prototype);
    Window_Tempo.prototype.constructor = Window_Tempo;

    Window_Tempo.prototype.initialize = function() {
        var width = this.windowWidth();
        var height = this.windowHeight();
        var x = this.tposx();
        var y = this.tposy();
        Window_Base.prototype.initialize.call(this, x, y, width, height);
        this.opacity = 255; // Da windowskin
        this.createContents();
        this.contentsOpacity = 255; // Do que está escrito
        this.clockpicture();     
        this.showBackgroundDimmer();
        this.refresh();
        this.hide();
    };

Window_Tempo.prototype.open = function() {
    if (!this.isOpen()) {
        this._opening = true;
    }
    this._closing = false;
};

Window_Tempo.prototype.close = function() {
    if (!this.isClosed()) {
        this._closing = true;
    }
    this._opening = false;
};

    Window_Tempo.prototype.updateOpen = function() {
        if (this._opening) {
            this.openness += 32;
            if (this.isOpen()) {
                this._opening = false;
            }
        }
    };[/SPOILER]

    Window_Tempo.prototype.updateClose = function() {
        if (this._closing) {
            this.openness -= 32;
            if (this.isClosed()) {
                this._closing = false;
            }
        }
    };

[[EDIT]]

I changed the title to something more appropriate.
And to do the test I copied the code Scene_Status and Window_Status and modified them for Scene_Instructions and Window_Status.

Even so, I can not call them from Console or Script call.

However, within the code I modified the following

Code:
Scene_Menu.prototype.commandGameEnd = function() {
    SceneManager.push(Scene_Instructions);
};

So if i select the command Game End, the scene and window is opened!

But i can not make this open from script call in event or Console. =/
When i try, it's says "Scene_Instructions is not defined"

Here is the code:
Spoiler: Scene_Instructions
Code:
function Scene_Instructions() {
    this.initialize.apply(this, arguments);
}

Scene_Instructions.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Instructions.prototype.constructor = Scene_Instructions;

Scene_Instructions.prototype.initialize = function() {
    Scene_MenuBase.prototype.initialize.call(this);
};

Scene_Instructions.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this._instructionsWindow = new Window_Instructions();
    this._instructionsWindow.setHandler('cancel',   this.popScene.bind(this));
    this._instructionsWindow.setHandler('pagedown', this.nextActor.bind(this));
    this._instructionsWindow.setHandler('pageup',   this.previousActor.bind(this));
    this._instructionsWindow.reserveFaceImages();
    this.addChild(this._instructionsWindow);
};

Scene_Instructions.prototype.start = function() {
    Scene_MenuBase.prototype.start.call(this);
    this.refreshActor();
};

Scene_Instructions.prototype.refreshActor = function() {
    var actor = this.actor();
    this._instructionsWindow.setActor(actor);
};

Scene_Instructions.prototype.onActorChange = function() {
    this.refreshActor();
    this._instructionsWindow.activate();
};

Spoiler: Window_Instructions
Code:
function Window_Instructions() {
    this.initialize.apply(this, arguments);
}

Window_Instructions.prototype = Object.create(Window_Selectable.prototype);
Window_Instructions.prototype.constructor = Window_Instructions;

Window_Instructions.prototype.initialize = function() {
    var width = Graphics.boxWidth;
    var height = Graphics.boxHeight;
    Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
    this._actor = null;
    this.refresh();
    this.activate();
};

Window_Instructions.prototype.setActor = function(actor) {
    if (this._actor !== actor) {
        this._actor = actor;
        this.refresh();
    }
};

Window_Instructions.prototype.refresh = function() {
    this.contents.clear();
    if (this._actor) {
        var lineHeight = this.lineHeight();
        this.drawBlock1(lineHeight * 0);
        this.drawHorzLine(lineHeight * 1);
        this.drawBlock2(lineHeight * 2);
        this.drawHorzLine(lineHeight * 6);
        this.drawBlock3(lineHeight * 7);
        this.drawHorzLine(lineHeight * 13);
        this.drawBlock4(lineHeight * 14);
    }
};

Window_Instructions.prototype.drawBlock1 = function(y) {
    this.drawActorName(this._actor, 6, y);
    this.drawActorClass(this._actor, 192, y);
    this.drawActorNickname(this._actor, 432, y);
};

Window_Instructions.prototype.drawBlock2 = function(y) {
    this.drawActorFace(this._actor, 12, y);
    this.drawBasicInfo(204, y);
    this.drawExpInfo(456, y);
};

Window_Instructions.prototype.drawBlock3 = function(y) {
    this.drawParameters(48, y);
    this.drawEquipments(432, y);
};

Window_Instructions.prototype.drawBlock4 = function(y) {
    this.drawProfile(6, y);
};

Window_Instructions.prototype.drawHorzLine = function(y) {
    var lineY = y + this.lineHeight() / 2 - 1;
    this.contents.paintOpacity = 48;
    this.contents.fillRect(0, lineY, this.contentsWidth(), 2, this.lineColor());
    this.contents.paintOpacity = 255;
};

Window_Instructions.prototype.lineColor = function() {
    return this.normalColor();
};

Window_Instructions.prototype.drawBasicInfo = function(x, y) {
    var lineHeight = this.lineHeight();
    this.drawActorLevel(this._actor, x, y + lineHeight * 0);
    this.drawActorIcons(this._actor, x, y + lineHeight * 1);
    this.drawActorHp(this._actor, x, y + lineHeight * 2);
    this.drawActorMp(this._actor, x, y + lineHeight * 3);
};

Window_Instructions.prototype.drawParameters = function(x, y) {
    var lineHeight = this.lineHeight();
    for (var i = 0; i < 6; i++) {
        var paramId = i + 2;
        var y2 = y + lineHeight * i;
        this.changeTextColor(this.systemColor());
        this.drawText(TextManager.param(paramId), x, y2, 160);
        this.resetTextColor();
        this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
    }
};

Window_Instructions.prototype.drawExpInfo = function(x, y) {
    var lineHeight = this.lineHeight();
    var expTotal = TextManager.expTotal.format(TextManager.exp);
    var expNext = TextManager.expNext.format(TextManager.level);
    var value1 = this._actor.currentExp();
    var value2 = this._actor.nextRequiredExp();
    if (this._actor.isMaxLevel()) {
        value1 = '-------';
        value2 = '-------';
    }
    this.changeTextColor(this.systemColor());
    this.drawText(expTotal, x, y + lineHeight * 0, 270);
    this.drawText(expNext, x, y + lineHeight * 2, 270);
    this.resetTextColor();
    this.drawText(value1, x, y + lineHeight * 1, 270, 'right');
    this.drawText(value2, x, y + lineHeight * 3, 270, 'right');
};

Window_Instructions.prototype.drawEquipments = function(x, y) {
    var equips = this._actor.equips();
    var count = Math.min(equips.length, this.maxEquipmentLines());
    for (var i = 0; i < count; i++) {
        this.drawItemName(equips[i], x, y + this.lineHeight() * i);
    }
};

Window_Instructions.prototype.drawProfile = function(x, y) {
    this.drawTextEx(this._actor.profile(), x, y);
};

Window_Instructions.prototype.maxEquipmentLines = function() {
    return 6;
};
If it doesn't appear in the console, I suspect the plugin is not on.
Window_Tempo is the class, not the object. How do you instantiate it? That is what you need to call up.

So if in Scene_Map you have this._tempWindow = Window_Tempo.new(), you would do something like Scene_Manager.scene._tempWindow to get to it.
If it doesn't appear in the console, I suspect the plugin is not on.
The plugin is on.

Window_Tempo is the class, not the object. How do you instantiate it? That is what you need to call up.

So if in Scene_Map you have this._tempWindow = Window_Tempo.new(), you would do something like Scene_Manager.scene._tempWindow to get to it.

Here is how i instantiate it:
Code:
var _Eli_Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
    Scene_Map.prototype.createDisplayObjects = function() {
        _Eli_Scene_Map_createDisplayObjects.call(this);
        this.createTempoWindow();
        this.createDicasWindow();
    };

    Scene_Map.prototype.createTempoWindow = function() {
        this._TempoWindow = new Window_Tempo();
        this.addChild(this._TempoWindow);
    };

    Scene_Map.prototype.createDicasWindow = function() {
        this._DicasWindow = new Window_Dicas();
        this.addChild(this._DicasWindow);
    };

I tried that to:
Scene_Manager.scene._tempoWindow

but it shows me the error:
Uncaught ReferenceError: Scene_Manager is not defined
at <anonymous>:1:1
SceneManager._scene
SceneManager._scene
Not working to =/
zatzFQX.png


😢.
Javascript is case-sensitive. Look carefully at what you save it as.

Code:
 Scene_Map.prototype.createTempoWindow = function() { 
this._TempoWindow = new Window_Tempo(); 
this.addChild(this._TempoWindow); };

Side-note: The autocompletion in the console is very useful. Before, when you had tried "Scene_Manager" and it didn't exist, instead you could start typing a few characters like "Scen" and then check the autocomplete dropdown.
Same thing if you type "SceneManager._scene._" then you can check the dropdown.
Javascript is case-sensitive. Look carefully at what you save it as.

Side-note: The autocompletion in the console is very useful. Before, when you had tried "Scene_Manager" and it didn't exist, instead you could start typing a few characters like "Scen" and then check the autocomplete dropdown.
Same thing if you type "SceneManager._scene._" then you can check the dropdown.

I tried that, to check the dropdown, and its not there.
To put things more accurate, i try do to the same thing in another way. I create my custom scene and my custom window with a simply copy of the Scene_Status and Window_Status. Please, check the edit i made in the first post.
But still, i can not make then work in script call or in console =/
Do you by any chance have the entire plugin wrapped inside a self-invoking function? If yes, then you will never see your custom classes inside console as they haven't been defined on the highest level.

Note that self-invoking functions are a fairly popular tool to protect your code against namespace clashes, but it is fairly stupid to use otherwise as it brings its own series of problems. It looks like this:

Code:
(function () {
Your code
}())
Do you by any chance have the entire plugin wrapped inside a self-invoking function? If yes, then you will never see your custom classes inside console as they haven't been defined on the highest level.

Note that self-invoking functions are a fairly popular tool to protect your code against namespace clashes, but it is fairly stupid to use otherwise as it brings its own series of problems. It looks like this:

Code:
(function () {
Your code
}())
Yes, I use this! My God, I did not realize it before ... Thank you so much!!!
If I make a plugin command to call this scene, is it possible?
There's only one way to find 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/show-my-custom-scene-and-window-via-script-call-or-console.108386/