Zephyrim

Villager
Member
Joined
Dec 23, 2016
Messages
8
Reaction score
0
First Language
English
Primarily Uses
Hey, @Zephyrim, I'm going to point you to Yanfly's Plug-In list first.


I happened to pass this thread and noticed your post here, but before you start investigating what may be wrong with this Plug-In, it would be beneficial for you to first fix your Plug-In order with Yanfly's things.


Yanfly's Plug-Ins do need to be in a specific order in order for them to work, the order in which they show up on this page here is the order all of those YEP Plug-Ins need to be in. You'd be surprised how many issues this can fix.


Then, make sure all Plug-Ins that are not YEP are loaded either before, or after the YEP Plug-Ins, unless there documentation says otherwise.


@Hikitsune-Red, you are an amazing human (I'm assuming you're human at least :p ), this worked and I'm so happy! Thank you so much! >w<
 
Last edited by a moderator:

Wrongful

$ sudo ./help_pls.sh
Veteran
Joined
Jan 31, 2017
Messages
64
Reaction score
7
First Language
English
Primarily Uses
RMMV
Can't really tell if this is necroposting (sorry if it is), but I'm having a problem with this script and I don't think it has to do with the other scripts (But I'm no expert, so I can't say).

TypeError: Cannot read property 'split' of undefined
at Function.XUtil.resolve (/D:/willb/Documents/MVGames/Wrongfultale002/js/plugins/PersistentData.js:173)
at Function.PersistManager.applyData (/D:/willb/Documents/MVGames/Wrongfultale002/js/plugins/PersistentData.js:145)
at Function.PersistManager.load (/D:/willb/Documents/MVGames/Wrongfultale002/js/plugins/PersistentData.js:118)
at Function.DataManager.createGameObjects (/D:/willb/Documents/MVGames/Wrongfultale002/js/plugins/PersistentData.js:78)
at Function.DataManager.setupNewGame (rpg_managers.js:211)
at Scene_Boot.start (rpg_scenes.js:211)
at Function.SceneManager.updateScene (rpg_managers.js:1668)
at Function.SceneManager.updateMain (rpg_managers.js:1641)
at Function.SceneManager.update (rpg_managers.js:1576)

I added a screenshot of all my active plugins, just in case it is necessary.
EDIT: I found out about the file name requirements, and I fixed that, yet the problem persists.
EDIT EDIT: Nevermind. For some strange reason, the plugin suddenly started working perfectly... Not sure why, but now that I can try it out, it's awesome, thank you so much for this!
 

Attachments

  • pluginscreenshot.PNG
    pluginscreenshot.PNG
    62.6 KB · Views: 7
Last edited:

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
40
First Language
English
Primarily Uses
RMMV
Your persistent data plugin worked great until updated my Yanfly plugins. Now I get the "Cannot read property width of null" error regardless of where I put your plugin.

I used to load yours as the very first plugin, but now that error happens on start up regardless of where it is positioned. Any way to fix it? I really need persistent data/variables.
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
Are you certain it's the persistent data plugin that is causing the issue? (Toggling it off and trying to playtest the game without it?) Otherwise, I'll probably need a list/order of plugins in your game and the error log to try to find the issue. I don't think anything in this plugin checks the width of anything (or interacts with displayables of any kind).
 

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
40
First Language
English
Primarily Uses
RMMV
Wrongful - What do you mean by the following statement?

EDIT: I found out about the file name requirements, and I fixed that, yet the problem persists.
 

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
40
First Language
English
Primarily Uses
RMMV
Are you certain it's the persistent data plugin that is causing the issue? (Toggling it off and trying to playtest the game without it?) Otherwise, I'll probably need a list/order of plugins in your game and the error log to try to find the issue. I don't think anything in this plugin checks the width of anything (or interacts with displayables of any kind).

Yes I am certain. If i disable it, the problem disappears. It worked fine for a long time. But I just updated my Yanfly suite to the latest plugin version and BOOM.

Here is the error I get as soon as I launch my game when the JKL_PersistentData plugin is set to ON.

error.png

And here is the order in which my plugins have always been set. **I turned off the JKL_PersistentData plugin to get my game to run, that's why it shows as off in the screen shot below. I even tried changing the order and put it last, but the same problem occurs as long as JKL_PersistentData plugin status = ON. As soon as i turn it off... no issues. But I need it on :)

PLUGIN_01.png

PLUGIN_02.png
PLUGIN_03.png

PLUGIN_04.png

PLUGIN_05.png

PLUGIN_06.png

PLUGIN_07.png
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
Can you take the full log from the console window? I'll need to see the traceback to have an idea of where the problem is.
 

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
40
First Language
English
Primarily Uses
RMMV
Here is a copy of the log. I redacted the file path for security purposes, but it appears that your plugin specifically conflicts with several Yanfly Plugin Javascript files as yours and his tries to "latch on" to the same DataManager.stuff functions. It also seems to conflict with the built in RPGMakerMV js files for version 1.5.0 where DataManager.stuff is.

Code:
width@file:///Users/REDACTED_PATH/js/rpg_objects.js:5663:20
isValid@file:///Users/REDACTED_PATH/js/rpg_objects.js:5908:36
isSlippery@file:///Users/REDACTED_PATH/js/plugins/YEP_SlipperyTiles.js:123:21
onSlipperyFloor@file:///Users/REDACTED_PATH/js/plugins/YEP_SlipperyTiles.js:138:31
isDashing@file:///Users/REDACTED_PATH/js/plugins/YEP_SlipperyTiles.js:168:29
dashAutoSwitch@file:///Users/REDACTED_PATH/js/plugins/YEP_AutoSwitches.js:132:31
value@file:///Users/REDACTED_PATH/js/plugins/YEP_AutoSwitches.js:105:31
makeData@file:///Users/REDACTED_PATH/js/plugins/JKL_PersistentData.js:141:46
save@file:///Users/REDACTED_PATH/js/plugins/JKL_PersistentData.js:128:67
setValue@file:///Users/REDACTED_PATH/js/plugins/JKL_PersistentData.js:64:23
setValue@file:///Users/REDACTED_PATH/js/plugins/YEP_SelfSwVar.js:291:43
applyData@file:///Users/REDACTED_PATH/js/plugins/JKL_PersistentData.js:157:39
load@file:///Users/REDACTED_PATH/js/plugins/JKL_PersistentData.js:124:19
createGameObjects@file:///Users/REDACTED_PATH/js/plugins/JKL_PersistentData.js:84:20
createGameObjects@file:///Users/REDACTED_PATH/js/plugins/YEP_ItemCore.js:565:51
setupNewGame@file:///Users/REDACTED_PATH/js/rpg_managers.js:216:27
start@file:///Users/REDACTED_PATH/js/rpg_scenes.js:214:33
updateScene@file:///Users/REDACTED_PATH/js/rpg_managers.js:1824:30
updateMainNoFpsSynch@file:///Users/REDACTED_PATH/js/plugins/YEP_FpsSynchOption.js:128:21
updateMain@file:///Users/REDACTED_PATH/js/plugins/YEP_FpsSynchOption.js:121:32
update@file:///Users/REDACTED_PATH/js/rpg_managers.js:1714:24
[native code]

This is where the issue is when in verbose debug mode:
Screen Shot 2017-07-11 at 11.37.21 PM.png
 
Last edited:

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
If it's the overwriting of the createGameObjects causing the problem, maybe try the hotfix from page 2 of this thread (which I also added to the front page). Otherwise, I'll need more time to look into this. A lot of these things shouldn't be interconnected, as far as I can tell.

Edit: Looking at the plugins, I have an idea. Which switch do you have set for the Auto-Dash switch? If that is in the range of persistent switches, it might cause odd behavior. No idea why it'd cause the game to fail to get the width of a map, though.

Edit 2: I think I figured it out, maybe. The auto-dash switch must be listed as persistent for this to make sense, though. My theory: the game loads, checks persistent switches as it loads. Through a line of shared code it somehow ends up checking whether a tile is slippery or not. Because no map is loaded, the "current map" is null, and thus can't be checked for width. If this is the case, remove the auto-dash switch from the range of persistent switches.
 
Last edited:

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
40
First Language
English
Primarily Uses
RMMV
Where do I check the auto-dash switch? Currently I believe my auto dash is off cause the character walks slow and does not run or dash.

How do you suggest this problem be solved?

If it's the overwriting of the createGameObjects causing the problem, maybe try the hotfix from page 2 of this thread (which I also added to the front page). Otherwise, I'll need more time to look into this. A lot of these things shouldn't be interconnected, as far as I can tell.

Edit: Looking at the plugins, I have an idea. Which switch do you have set for the Auto-Dash switch? If that is in the range of persistent switches, it might cause odd behavior. No idea why it'd cause the game to fail to get the width of a map, though.

Edit 2: I think I figured it out, maybe. The auto-dash switch must be listed as persistent for this to make sense, though. My theory: the game loads, checks persistent switches as it loads. Through a line of shared code it somehow ends up checking whether a tile is slippery or not. Because no map is loaded, the "current map" is null, and thus can't be checked for width. If this is the case, remove the auto-dash switch from the range of persistent switches.
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
I spent some more time examining the code, and the bad news is there actually isn't anything that can be done to make my implementation of persistent switches work with Yanfly's Auto Switches and Slippery Tiles. The way Yanfly overwrites the switch code, any time a switch value is checked it requires the player to be on a map or in battle to avoid this error. But my code runs as the title screen opens and tries to check/set switches right away.

The potentially good news is that there might be a workaround. I vaguely remember my code breaking if it's below some of Yanfly's other plugins (not sure if the old hotfix helps in all cases), so any attempts to fix the problem in my code would probably fail. But if you catch the trail before it causes the error in a small snippet of code, it might be useful as a workaround. A potential hotfix is in the code below:

(function() {

var _Game_Map_isSlippery = Game_Map.prototype.isSlippery;
Game_Map.prototype.isSlippery = function(mx, my) {
if (Game_Map.mapId == 0) return false; // important line
return _Game_Map_isSlippery.call(this, mx, my);
};

})();

The "important line" is the one that may need to be changed to work; I've yet to test it properly. But the basic idea is that you turn this code into a standalone plugin file and put it at the very bottom of your plugin list. Hopefully it works on the first try...

Alternatively, if you don't need either Slippery Tiles or Auto Switches, removing one or both of them should remove this particular issue.

Edit: Actually, there *might* be a way to make my plugin compatible with Yanfly's set. The problem lies in that we override the same function for setting switches, but I needed an additional argument that wasn't in the base function. Since Yanfly's code doesn't have that argument, it defaults to the code that leads to the error. If I'm right, I might be able to fix my code to work with Yanfly's and also get rid of some redundant lines. But first, here's the hotfix below:

PersistManager.applyData = function(persist) {
var persistswexp = parameters['Persistent Switches'];
var switches = XUtil.resolve(persistswexp);
var persistvarexp = parameters['Persistent Variables'];
var variables = XUtil.resolve(persistvarexp);
if(typeof switches !== 'undefined' && typeof persist.switches !== 'undefined'){
for(var x of switches){
if(typeof x !== 'undefined'){
_Game_Switches_setValue.call(this, x, persist.switches[x]);
}
}
}
if(typeof variables !== 'undefined' && typeof persist.variables !== 'undefined'){
for(var y of variables){
if(typeof y !== 'undefined'){
_Game_Variables_setValue.call(this, y, persist.variables[y]);
}
}
}
};

This replaces the function of the same name in my plugin. If this works, I'll probably update the main code with this version.
 
Last edited:

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
40
First Language
English
Primarily Uses
RMMV
I will try this out as soon as I can. I may not get to it for another few days as I am eyeball deep in some other work unrelated to RPGMakerMV. But when I do, I will post my findings here. If I don't post, it means I have not gotten a chance to test it. It realistically may take me several weeks to get back to that point. Time... gotta love how much of it there isn't.

I spent some more time examining the code, and the bad news is there actually isn't anything that can be done to make my implementation of persistent switches work with Yanfly's Auto Switches and Slippery Tiles. The way Yanfly overwrites the switch code, any time a switch value is checked it requires the player to be on a map or in battle to avoid this error. But my code runs as the title screen opens and tries to check/set switches right away.

The potentially good news is that there might be a workaround. I vaguely remember my code breaking if it's below some of Yanfly's other plugins (not sure if the old hotfix helps in all cases), so any attempts to fix the problem in my code would probably fail. But if you catch the trail before it causes the error in a small snippet of code, it might be useful as a workaround. A potential hotfix is in the code below:

(function() {

var _Game_Map_isSlippery = Game_Map.prototype.isSlippery;
Game_Map.prototype.isSlippery = function(mx, my) {
if (Game_Map.mapId == 0) return false; // important line
return _Game_Map_isSlippery.call(this, mx, my);
};

})();

The "important line" is the one that may need to be changed to work; I've yet to test it properly. But the basic idea is that you turn this code into a standalone plugin file and put it at the very bottom of your plugin list. Hopefully it works on the first try...

Alternatively, if you don't need either Slippery Tiles or Auto Switches, removing one or both of them should remove this particular issue.

Edit: Actually, there *might* be a way to make my plugin compatible with Yanfly's set. The problem lies in that we override the same function for setting switches, but I needed an additional argument that wasn't in the base function. Since Yanfly's code doesn't have that argument, it defaults to the code that leads to the error. If I'm right, I might be able to fix my code to work with Yanfly's and also get rid of some redundant lines. But first, here's the hotfix below:

PersistManager.applyData = function(persist) {
var persistswexp = parameters['Persistent Switches'];
var switches = XUtil.resolve(persistswexp);
var persistvarexp = parameters['Persistent Variables'];
var variables = XUtil.resolve(persistvarexp);
if(typeof switches !== 'undefined' && typeof persist.switches !== 'undefined'){
for(var x of switches){
if(typeof x !== 'undefined'){
_Game_Switches_setValue.call(this, x, persist.switches[x]);
}
}
}
if(typeof variables !== 'undefined' && typeof persist.variables !== 'undefined'){
for(var y of variables){
if(typeof y !== 'undefined'){
_Game_Variables_setValue.call(this, y, persist.variables[y]);
}
}
}
};

This replaces the function of the same name in my plugin. If this works, I'll probably update the main code with this version.
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
I can't speak to running games in a browser... I've not been able to get games to run that way very often. However, that does seem to be the issue here, based on what I can tell from the logs. Basically, I've never needed to know how web storage for RMMV works, so I never wrote a way for this plugin to interact with it.

If we're lucky, adding this code under the function redefinition for StorageManager.localFilePath will fix your problem. This is basically the sister function for web saving (as opposed to local saving to a file).

Code:
var _StorageManager_webStorageKey = StorageManager.webStorageKey;
StorageManager.webStorageKey = function(savefileId) {
    var name;
    if (savefileId === "Persistent")
        name = 'RPG Persistent';
    else
        name = _StorageManager_webStorageKey.call(this,savefileId);

        return name;
};

Let me know if that works. If it does, I might need to update the main code with this included.
 

Sarry123

Villager
Member
Joined
Jun 5, 2020
Messages
12
Reaction score
3
First Language
French
Primarily Uses
RMMV
Hi and thanks for your plugin. But I was wondering if I could use a scriptcall to delete the persistent save in the save folder. Is it possible?
Thanks in advance.

Edit: I used some node.js scripts to erase the file but, I noticed that as soon as the file is touched, the plugin will recreate it with the same vaeiables because of the save when set feature, is it possible to turn off this feature within the game? Thanks
 
Last edited:

Latest Threads

Latest Profile Posts

Ok, Black Jack attempt 2: Time to die via brain hemorrhage.
I'm still looking for some people who have skills on scripts and map design if somebody read this.

My mind is dying with the effort trying to understand how scripts work, and why they are so complicated for a little brain as mine.

I just need a hero :,c

Forum statistics

Threads
108,891
Messages
1,040,351
Members
141,334
Latest member
Sarge_Vince
Top