Window_Selectable problem

So I was able to create a selectable window but I cant activate it or draw anything on it
It's just a blank window, I cant choose options or do anything with that window and the highlighted option isn't flashing
When I type "SceneManager._scene._menuSelectable.show()" in the console window appears on the screen as it supposed to
but when I type"SceneManager._scene._menuSelectable.activate()" nothing happens
I used this script
function MyWindow() {
this.initialize.apply(this, arguments);
}


MyWindow.prototype = Object.create(Window_Base.prototype)
MyWindow.prototype.constructor = MyWindow;

MyWindow.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, 220, 0, Graphics.boxWidth - 220, Graphics.boxHeight);
this.drawAllItems();
}
MyWindow.prototype.drawAllItems = function() {
this.contents.clear();
this.drawText(Dimeon.Windows.text, 0, 0, Graphics.boxWidth, 48, 'center');
}


// ------------------------------
function MenuScene() {
this.initialize.apply(this, arguments);
}

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

MenuScene.prototype.initialize = function(x, y, width, height) {
Scene_MenuBase.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Dimeon.Windows.lh);
}

MenuScene.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this._myScene = new MyWindow(0, 0, 320, 240);
this.addChild(this._myScene);

this._menuSelectable = new MenuSelectable(0, 0, 100, 100);
this._menuSelectable.hide();
this._menuSelectable.select(0);
this._menuSelectable.setHandler("ok", this.commandOk.bind(this));
this._menuSelectable.setHandler("cancel", this.commandCancel.bind(this));
this.addChild(this._menuSelectable);
}
MenuScene.prototype.commandOk = function() {
this._menuSelectable.activate();
SoundManager.playOk();
}
MenuScene.prototype.commandCancel = function() {
SceneManager.pop();
SoundManager.playCancel();
}

MenuScene.prototype.update = function() {
if (!this.drawnWindows){
this._myScene.drawAllItems();
this.drawnWindows = true;}
if (Input.isTriggered("cac")){ SceneManager.pop();
SoundManager.playCancel();
}
};
//===========
function MenuSelectable() {
this.initialize.apply(this, arguments);
}


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

MenuSelectable.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Dimeon.Windows.lh * 2);
this.refresh();
this.hide();
this._index = -1;
this._cursorFixed = false;
this._cursorAll = false;
this._stayCount = 0;
this._helpWindow = null;
this._handlers = {};
this._touching = false;
this._scrollX = 0;
this._scrollY = 0;

}
Window_Selectable.prototype.refresh = function(){
this.drawAllItems();
}
Window_Selectable.prototype.drawAllItems = function() {
var topIndex = this.topIndex();
for (var i = 0; i < this.maxPageItems(); i++) {
var index = topIndex + i;
if (index < this.maxItems()) {
this.drawItem(index);
}
}
};
Window_Selectable.prototype.maxPageRows = function() {
return 3;
}

Window_Selectable.prototype.maxItems = function() {
return 2;
}

Window_Selectable.prototype.itemHeight = function() {
return (this.height - this.padding * 2) / this.maxPageRows();
}

Window_Selectable.prototype.maxPageItems = function () {
return this.maxPageRows() * this.maxCols();
}

Window_Selectable.prototype.drawItem = function(index) {
var itemRect = this.itemRect(index);
this.drawText("text", itemRect.x, itemRect.y, itemRect.width / 2, itemRect.height / 2, 'center');
this.drawTextEx("saddsa", 0, 0);
this.drawFace("Actor2", 1 + index, itemRect.x, itemRect.y, itemRect.width / 2, itemRect.height / 2);
};
if anyone has an idea why it isn't working please help!
Code:
MenuSelectable.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Dimeon.Windows.lh * 2);
this.refresh();
this.hide();
this._index = -1;
this._cursorFixed = false;
this._cursorAll = false;
this._stayCount = 0;
this._helpWindow = null;
this._handlers = {};
this._touching = false;
this._scrollX = 0;
this._scrollY = 0;

}
Window_Selectable.prototype.refresh = function(){
this.drawAllItems();
}
Window_Selectable.prototype.drawAllItems = function() {
var topIndex = this.topIndex();
for (var i = 0; i < this.maxPageItems(); i++) {
var index = topIndex + i;
if (index < this.maxItems()) {
this.drawItem(index);
}
}
};
Window_Selectable.prototype.maxPageRows = function() {
return 3;
}

Window_Selectable.prototype.maxItems = function() {
return 2;
}
You forgot to change the name from Window_Selectable to MenuSelectable. Also, you defined MenuSelectable as Window_Selectable prototype, but call Window_Base prototype initialize.
If you want, I suggest you watch my youtube tutorial series. It's in my signature.
Code:
MenuSelectable.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Dimeon.Windows.lh * 2);
this.refresh();
this.hide();
this._index = -1;
this._cursorFixed = false;
this._cursorAll = false;
this._stayCount = 0;
this._helpWindow = null;
this._handlers = {};
this._touching = false;
this._scrollX = 0;
this._scrollY = 0;

}
Window_Selectable.prototype.refresh = function(){
this.drawAllItems();
}
Window_Selectable.prototype.drawAllItems = function() {
var topIndex = this.topIndex();
for (var i = 0; i < this.maxPageItems(); i++) {
var index = topIndex + i;
if (index < this.maxItems()) {
this.drawItem(index);
}
}
};
Window_Selectable.prototype.maxPageRows = function() {
return 3;
}

Window_Selectable.prototype.maxItems = function() {
return 2;
}
You forgot to change the name from Window_Selectable to MenuSelectable. Also, you defined MenuSelectable as Window_Selectable prototype, but call Window_Base prototype initialize.
If you want, I suggest you watch my youtube tutorial series. It's in my signature.
Yeah tnx for pointing that out, I also typed "_myScene" instead of "_menuSelectable" in this part
MenuScene.prototype.update = function() {
if (!this.drawnWindows){
this._myScene.drawAllItems();
this.drawnWindows = true;}
if (Input.isTriggered("cac")){ SceneManager.pop();
SoundManager.playCancel();
}
};
So I was able to get the text and actor face on screen but I still can't activate it, the highligthed option isn't flashing and I can only select options through "SceneManager._scene._menuSelectable.select()" command.
I also made this according to your tutorial but you wrote the code before you recorded the video and you didn't show some parts of the code.
I think that I missed something, I have 2 handlers in _menuSelectable but how does the game even decide which option in the window is which handler?
There certainly must be another function that I'm missing
In Window_Selectable prototype you have one ok handler for each selection. The game decides it through the .index() of the window when selected.

The biggest problem I see in your code is, your menuscene's update function doesn't call Scene_Menubase's update function.
In Window_Selectable prototype you have one ok handler for each selection. The game decides it through the .index() of the window when selected.

The biggest problem I see in your code is, your menuscene's update function doesn't call Scene_Menubase's update function.
Yea apparently that was the main reason
Thx again
And I would suggest you either let the viewers download your js or show the full code you write in your tutorials cause sometimes its confusing
Like in episode 3 when you wrote the code before recording and didn't show the most of it as if you were expecting viewers to already know how to create command and selectable windows
Noted. But that is why youtube comments exist 😛

Original thread: https://forums.rpgmakerweb.com/threads/window_selectable-problem.114604/