@Hikitsune-Red, you are an amazing human (I'm assuming you're human at least 😛 ), this worked and I'm so happy! Thank you so much! >w<
Jackkel's Persistent Switches
JS Plugin Releases (RMMV)@Hikitsune-Red, you are an amazing human (I'm assuming you're human at least 😛 ), this worked and I'm so happy! Thank you so much! >w<
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!
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!
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.
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.
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).
Wrongful - What do you mean by the following statement?
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.
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 🙂

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.
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.
This is where the issue is when in verbose debug mode:

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:

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.
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.
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?
How do you suggest this problem be solved?
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:
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:
This replaces the function of the same name in my plugin. If this works, I'll probably update the main code with this version.
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);
};
})();
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]);
}
}
}
};
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.
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.
Makes the game crash on Edge.
Results with the plugin enabled

upload pic
Results with the plugin disabled

upload pic
Sample project: https://www.dropbox.com/s/sx2zyu6b3xofod4/WTF.zip?dl=0
(Is RPGMaker's MV HTML5 output supposed to work on Edge?)
Results with the plugin enabled

upload pic
Results with the plugin disabled

upload pic
Sample project: https://www.dropbox.com/s/sx2zyu6b3xofod4/WTF.zip?dl=0
(Is RPGMaker's MV HTML5 output supposed to work on Edge?)
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).
Let me know if that works. If it does, I might need to update the main code with this included.
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.
I'm very sorry, it was a false positive.
Apparently the reason is Edge disallows sending sockets to local file system even if running an HTML5 app from the local file system by default. More on this here https://forums.rpgmakerweb.com/inde...ml5-output-supposed-to-work-on-ms-edge.81484/ .
Sorry for my noobishness giving you trouble.
Apparently the reason is Edge disallows sending sockets to local file system even if running an HTML5 app from the local file system by default. More on this here https://forums.rpgmakerweb.com/inde...ml5-output-supposed-to-work-on-ms-edge.81484/ .
Sorry for my noobishness giving you trouble.
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
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
Hi, so I've just downloaded the plugin and I've encountered a bit of a problem.
Whenever I playtest with the plugin enabled and all the parameters and stuff set, I get a TypeError right after the Made with MV splash screen fades in:
'Cannot read property 'split' of undefined'
I'm not entirely sure where this error is occurring in the script, so I'm clueless :/
(update: I literally just noticed the name requirement, and I fixed the issue-)
Whenever I playtest with the plugin enabled and all the parameters and stuff set, I get a TypeError right after the Made with MV splash screen fades in:
'Cannot read property 'split' of undefined'
I'm not entirely sure where this error is occurring in the script, so I'm clueless :/
(update: I literally just noticed the name requirement, and I fixed the issue-)
so for some reason i am getting TypeError: StorageManager.save is not a function
Hello Jackkel, is it possible I can set up a system to check for a specific value from my persistent variable, then have the game do different things based on its value?
What I'm aiming for is that, on my pre-title event (HIME_PreTitleEvents), I set up a conditional branch that checks for if my persistent variable's value is greater than 0, and if it is, load my save which will automatically run a cutscene because of the value in the save.
What I'm aiming for is that, on my pre-title event (HIME_PreTitleEvents), I set up a conditional branch that checks for if my persistent variable's value is greater than 0, and if it is, load my save which will automatically run a cutscene because of the value in the save.
Original thread: https://forums.rpgmakerweb.com/threads/jackkels-persistent-switches.47640/