POR_SaveCore

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
I really shouldn't browse forums when tired. My apologies, I had no idea a fix had been pushed. Works wonderfully now. You continue to impress <3
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
It would seem that when using DreamX's Random Prefix/Suffix plugin, specifically the overlay feature, a type error occurs. I know your computer isn't functional, but I thought you should know, regardless.
upload_2018-5-24_2-57-46.png

Disabling that feature allows it to work normally, so until I can commission a fix, I'll just do that instead :)
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,050
Reaction score
10,279
First Language
Czech
Primarily Uses
RMMV
@ZServ I may be without a computer, but being without a computer means I can't efficiently make plugins, since I can't playtest them. As long as I can read plugins though, I can still fix my bugs. I just may require more external assistance sometimes. This is not a bug, it's a compatibility issue. But I can clearly understand it thanks to seeing the print screen from console.

This is the incriminated function. It comes from the mentioned DreamX plugin and it's a customized drawIcon. Since my plugin uses drawIcon as well, it's natural these two plugins would collide when somebody tinkers with it.
Code:
DreamX.RandomPrefixSuffix.Window_Base_drawIcon = Window_Base.prototype.drawIcon;
    Window_Base.prototype.drawIcon = function (iconIndex, x, y) {
        if (iconIndex >= paramCombIconStarting) {
            var overlayArrayIndex = iconIndex - paramCombIconStarting;
            var overlayIcons = $gameSystem.overlayIcons[overlayArrayIndex];
            for (var i = 0; i < overlayIcons.length; i++) {
                var iconId = overlayIcons[i].index;
                DreamX.RandomPrefixSuffix.Window_Base_drawIcon.call(this, iconId, x, y);
            }
            return;
        }
        DreamX.RandomPrefixSuffix.Window_Base_drawIcon.call(this, iconIndex, x, y);
    };
In particular this is the line that brought the crash.
var overlayIcons = $gameSystem.overlayIcons[overlayArrayIndex];

What happens is simple, the drawIcon function tries to draw data from $gameSystem to get the overlay icons... Which, however, is undefined in title screen, because you have no data in title screen.
So there are only two necessary things to do.
1. Overwrite my function that saves display data to save an additional chunk of data
2. Define a special drawIcon function so that everything will work fine.
Since it would make no sense to include them in the main file, I'll make a separate patch plugin.

EDIT: Patch created. Get it here
Correct plugin ordering:
Save core
Patch
DreamX's plugin

Let me know if there are problems or if the DreamX's plugin has to be the one on top.
 
Last edited:

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
You continue to impress, Poryg. With that said..

upload_2018-5-24_14-1-8.png

I tried Save -> Patch -> RPS as an order, RPS -> Patch -> Save as an order, but both resulted in similar issues.

The error above is Save -> Patch -> RPS. Using the other order produced a similar outcome to if there weren't a patch.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,050
Reaction score
10,279
First Language
Czech
Primarily Uses
RMMV
My bad, forgot that info wasn't passed as a parameter. Made an edit to one more function, hopefully there are no problems now. As for the order, it is Save core-patch-DreamX's plugin and none of other orders will currently work because of how function overwriting works. The link should still be valid.
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
upload_2018-5-24_15-38-17.png

I'm sorry to give you such a headache :p
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,050
Reaction score
10,279
First Language
Czech
Primarily Uses
RMMV
It's ok. Another bug defeated xD
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
Perfection. Thanks a ton <3



Unrelated question, do you know if there's any way off the top of your head to make the text for a specific custom text right-justified? If there isn't, it's no big deal. :) You've already done so much for me!
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,050
Reaction score
10,279
First Language
Czech
Primarily Uses
RMMV
If right justified means aligned to the right,...

There are two functions that take care of text in rpg maker mv. One of them is drawText, the other one drawTextEx. drawText allows you to customize width and therefore if you put width of your window as width and set align to right, then you have your text on the right. In fact the default code uses this in playtime.
However, there is one bad thing in drawText. It doesn't support escape tags. So while makong the plugin I decided not to use it.
For escape tags there is drawTextEx, but in order to process escape tags it generates width dynamically per character. As such it is impossible to customize width of the bitmap and therefore you can't really use align right with drawTextEx.

However, it should be possible. The custom texts allow for execution of any code, meaning you should be able to execute this.drawText(text, x, y, width, align), so for example
this.drawText(info.customSaveData[0], 0, 80, SceneManager._scene._listWindow.itemRect().width, "right");
(I'm not sure if the code is correct right now, but that is an illustration) should still yield you a result.

Or even better, you can add that line into the drawItem function in the save core plugin, where it would look like this instead.
this.drawText(info.customSaveData[0], 0, 80, rect.width, "right");
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
Do you have any insights as to why saving would no longer work in a web browser? I'm not sure if it's a plugin issue, or a configuration issue with my browser. Obv. if it's a configuration thing, there's nothing you can do :p
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,050
Reaction score
10,279
First Language
Czech
Primarily Uses
RMMV
There are a couple of options.

1. Saving on local storage doesn't work for that browser. Not sure if it's your case, but if none of the other options apply, then it could be. What browser do you use?
2. For some reason the game thinks it's in local mode. If you want to find out, try
if (Utils.isNwjs()) alert ("it's in local mode");
If it is in local mode, then it won't work in browsers unless you upload ut somewhere.
3. Some plugin redefines how saving is done on StorageManager basis. My plugin calls DataManager to save and doesn't redefine any of the actual saving functions, so it is not the culprit, but maybe for example the autosave plugin could do that. If you want to find out, type StorageManager.save in the dev console (in a browser you launch devtools by f11) with no brackets. You should get the function.
The function should look like this:
Code:
StorageManager.save = function(savefileId, json) {
    if (this.isLocalMode()) {
        this.saveToLocalFile(savefileId, json);
    } else {
        this.saveToWebStorage(savefileId, json);
    }
};
If it looks different, a plugin has tinkered with it. If a plugin has tinkered with it, then search for StorageManager.save in your plugins.
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
Hasn't worked on any browser I've tried, despite working before. That's what made me think it might be a plugin thing, as it won't work on Chrome, Firefox, or their mobile variants. Doesn't think it's in local mode, and no plugin has tinkered with the function. Well, thank you very much! I'll try and figure it out elsewhere :)
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,050
Reaction score
10,279
First Language
Czech
Primarily Uses
RMMV
Alright, after a small conversation with @ZServ I'm unhappy to announce the bug was really on my side, but happy to announce that it was fixed! Now you can save your games online without worry of your saves not being loaded!
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
Since the newest update, changing the title of a project will cause saves to no longer be backwards compatible, and they will no longer show up. Any thoughts on a way around this?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,050
Reaction score
10,279
First Language
Czech
Primarily Uses
RMMV
What does it mean - no longer backwards compatible? Does it mean the savefiles won't work even for local mode?
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
In local mode, they work fine.
Example: game v1.0 is the title. Saves work just fine.
Update comes out. Title is now game v1.1. locally, saves work fine, 1.0 saves work as well. However, on web builds, they no longer do. 1.1 is only compatible with 1.1 saves. Does that make sense?

My concern comes from the fact that APK builds are just wrapped html5 browsers, so that could potentially have repercussions for mobile deployment.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,050
Reaction score
10,279
First Language
Czech
Primarily Uses
RMMV
I see. It's only natural though that it happens.

As I said over the PM, there was the game title missing in saves, which caused the previous bug.
The reason MV games require title is simple. Identification.
The reaso why it works in local mode is simple. Any saves in the save folder simply belong to the game, so no problems there. However, browser uses its dedicated local storage where it saves files into temps. So in order to find the correct files in the local storage and due to the possibility of there being saves from more than one game, MV asks if the title from the save is equal to the game title. Because every game has an unique name, this is enough of an unique identifier.
This of course means that when you change the title even slightly, it's incompatible, because the title you saved is not the same as the title of your game.
There are possible workarounds to it, I could edit the default MV function to search for another unique identifier. Or you can open the dev console, search for title in $gameSystem and rewrite it so that it doesn't contain version number.
 
Last edited:

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
256
Reaction score
70
Primarily Uses
Ah, I see! Thank you very much for the insight. That makes perfect sense!
 

WatermelonPL

Villager
Member
Joined
Apr 13, 2018
Messages
21
Reaction score
6
First Language
Polish
Primarily Uses
RMMV
'Decryptor is not defined' error when saving or loading
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,050
Reaction score
10,279
First Language
Czech
Primarily Uses
RMMV
A print screen from the console (f8) would be more helpful. Because the only thing that pops out on my mind is that you have an old version of MV, which doesn't support encryption yet. What version of MV do you use btw.?
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

What can I sing for my sisters birthday...?

>.<'
Well, I'll have you know that I'm still around, looking for opportunity to resurface with some stuffs.
I like to think of Profile Posts as tiny homes, full of all kinds of unsuspecting suckers "future" friends.... Many of which are of course only going to be excited when a strange man in black suddenly shows up to say hi. :LZSexcite:
Stream will be live shortly with some more Haunting Ground! Today, we encounter a new stalker! Feel free to drop by!
Tried the new Samsung Galaxy S20 Plus today. Very nice device overall, but flagship smartphone prices are getting completely out of control.

Forum statistics

Threads
94,504
Messages
921,491
Members
124,362
Latest member
hogogopfu01
Top