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:
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:
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:
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();
};
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;
};