Window instance blocks ingame saving?

Raen Andaleio

Veteran
Veteran
Joined
Aug 3, 2014
Messages
109
Reaction score
22
First Language
German
Primarily Uses
Hello,


I hope this is the right section, but there's no MV section in Scripting, so...


Anyway, I'm trying to write a plugin that displays a book.


I'm basically displaying two windows in the current map scene, fill them with text, and eventually close the windows again.


The windows are derrived from Window_Base. It looks like this:


//Creates the pages on the map screen - call in Event using $gameSystem.createPages();
Game_System.prototype.createPages = function(){
this._windowBookPageLeft = new Window_BookPageLeft(0, 0);
this._windowBookPageRight = new Window_BookPageRight(RD.Param.windowWidth/2, 0);
SceneManager._scene.addChild(this._windowBookPageLeft);
SceneManager._scene.addChild(this._windowBookPageRight);
};

//Removes the pages - call in Event using $gameSystem.disposePages();
Game_System.prototype.disposePages = function(){
SceneManager._scene.removeChild(this._windowBookPageLeft);
SceneManager._scene.removeChild(this._windowBookPageRight);
};


Now here's the thing: as soon as I actually create an instance of one of the windows


this._windowBookPageLeft = new Window_BookPageLeft(0, 0);


I can no longer save in the game. Selecting save and choosing a save slot, I only hear the buzzer and nothing happens.


This also happens when I create an instance of any other window class, such as Window_Base or Window_Gold. As soon as I instantiate, saving is disabled.


Using the "change save access" content in the event to try and manually turn on saving again does not help either.


I don't understand what's going on here. Can anyone help? I'll attach the entire script to the post.

View attachment BooksAndScrolls.js
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
Well I'm on my phone, but looking at this briefly you look like you know what you're doing. In the data manager should be a function called saveGame or similar (not saveGameWithoutRescue, that gets called by saveGame). In that function should be a try { } catch { } block. In the catch block, where it plays the buzzer sound, display the error in the console window using console.log, and then try to open a window and save again. The error should tell us exactly why things are not working, and then we can figure things out from there.


EDIT: Now that I'm showered and looking at this again, chances are the error is that you can't save a window. Game_System is saved into a save file so it can be reloaded later, however I don't think windows are valid serializable (saveable) objects, so that's where the error is. It tries, it fails, it buzzes instead of crashes. 
 
Last edited by a moderator:

Raen Andaleio

Veteran
Veteran
Joined
Aug 3, 2014
Messages
109
Reaction score
22
First Language
German
Primarily Uses
Well I'm on my phone, but looking at this briefly you look like you know what you're doing. In the data manager should be a function called saveGame or similar (not saveGameWithoutRescue, that gets called by saveGame). In that function should be a try { } catch { } block. In the catch block, where it plays the buzzer sound, display the error in the console window using console.log, and then try to open a window and save again. The error should tell us exactly why things are not working, and then we can figure things out from there.


EDIT: Now that I'm showered and looking at this again, chances are the error is that you can't save a window. Game_System is saved into a save file so it can be reloaded later, however I don't think windows are valid serializable (saveable) objects, so that's where the error is. It tries, it fails, it buzzes instead of crashes. 


Huh? So basically, as soon as there is a


_window = new Window(0, 0);


something in the code somewhere that gets executed, saving becomes impossible? What do I need to do then? Can I clear this variable in my dispose function somehow?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,430
Reaction score
7,711
First Language
German
Primarily Uses
RMMV
There is a MV section in scripting - not inside the RGSS-scripts, but inside the javascript section because MV doesn't use ruby anymore


I've moved this thread to Learning Javascript. Please be sure to post your threads in the correct forum next time. Thank you.
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
You stored a window in the Game_System class, which is instantiated when a new game begins. Window objects, to my knowledge, cannot be saved, so once you set your windows into $gameSystem, saving will no longer work. Since you shouldn't need to duplicate the EXACT windows after loading, put the windows in Game_Temp and just rebuild them on loading a game. 
 

Raen Andaleio

Veteran
Veteran
Joined
Aug 3, 2014
Messages
109
Reaction score
22
First Language
German
Primarily Uses
You stored a window in the Game_System class, which is instantiated when a new game begins. Window objects, to my knowledge, cannot be saved, so once you set your windows into $gameSystem, saving will no longer work. Since you shouldn't need to duplicate the EXACT windows after loading, put the windows in Game_Temp and just rebuild them on loading a game. 


You, Sir, are a genius. I put it in Game_Temp and call it using &gameTemp now. Everything works like a charm now. Thanks a lot!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top