I'm working on a Customized File Scene, where you can choose to Save, Load or even Erase a file from the game.
It works like this: When I chose a file there will activate a Command Window with the option I want. After I use this Command Window I want it to disapear and the game go back to the list.
Scene_Save.prototype.onSaveSuccess = function() { SoundManager.playSave(); this._actionWindow.close //THE LINE I NEED this.activateListWindow();};This ".close" is not working. What else can I try?
You need parenthesis at the end, because it is a function. In ruby, adding them was not a requirement, but in Javascript it is. If you're trying to call a function, you'll need parenthesis. That should fix your issue here.
Yeah, fixed. But I have another problem now. After the first command everything goes allright. But if I try to open again the Command WIndow, the game freezes and the console don't give any alert. Everything just stays frozen.
I'm activating the window with this command:
var _Scene_File_create = Scene_File.prototype.create; Scene_File.prototype.create = function() { _Scene_File_create.call(this); this._listWindow.height = this._listWindow.fittingHeight(8); var x = 0; var y = this._listWindow.y + this._listWindow.height; var width = Graphics.boxWidth; var height = Graphics.boxHeight - y; this._statusWindow = new Window_SavefileStatus(x, y, width, height); this._statusWindow.setMode(this.mode()); this._listWindow.statusWindow = this._statusWindow; this._listWindow.callUpdateHelp(); this._listWindow.refresh(); this.addWindow(this._statusWindow); this._actionWindow = new Window_FileAction(); this._actionWindow.setHandler('salvar', this.commandSave.bind(this)); this._actionWindow.setHandler('carregar', this.commandLoad.bind(this)); this._actionWindow.setHandler('deletar', this.commandErase.bind(this)); this._actionWindow.setHandler('cancelar', this.popScene.bind(this)); }; //////////////////////////////////////////////////////////////////////////////////////////////Scene_Save.prototype.onSavefileOk = function() { Scene_File.prototype.onSavefileOk.call(this); this.addWindow(this._actionWindow); };Yet, the "this.popscene();" works well, or if I just manually go out and then in the file scene again. If I stays there and try a new file, the game freezes.
You're adding the window to be drawn, you're not activating it. I'd suggest you add the window in the create function, and hide it until you want it to be visible. Once it should be visible, unhide and activate it like so:
this._actionWindow.show();this._actionWindow.activate();The reason popScene works is because the scene itself is checking for that input, it's not the window doing it.
Thank you very much, it worked!
Now, If it's not ask to much, how should I do to the screen behind the command window get dark when using it, then light again when it hides? (just like happens when you call the Game End Scene, but without it having to be a scene. 😛 )
window.close or even scene.pop