Comments

Log in with itch.io to leave a comment.

Very interesting. Does it only read or does it copy the data? I mean, can it check if switch X was on, and just tell me if so, then I can decide what to do with switch X in the new game?

Or does it find switch X is on and then automatically sets it as on in the new game?

Thanks

It copies and read, you instruct the plugin what to search and what to do with the results. Like you said, if old save had switch X on you can decide to turn new game switch Y on.


It can do it with switch, self switch, variables, heroes data and general game system informations

https://github.com/BossRpg/MVMZ-Advanced_ChangeSaveLocation/blob/main/Advanced_C...

It is best to use it with this plug-in, so that you can solve the problem of publishing games on Steam, but I have not tested whether your plug-in supports "%USERPROFILE%/Saved Games/" + $dataSystem.gameTitle + "/save/"

It doesn't as the directory is a string, not an eval, so it won't catch + and $dataSystem


But adding a "pro" option to use the evaluation could be something to add in the ToDo list! ☺️

So, without the +$dataSystem part, it should work? I actually mainly want to know if I can read "My Documents"

(1 edit)

If you mean by using environmental variables like %USERPROFILE%, no, not in v1.0
I'll work on adding the possibility!

Right now the plugin can either read a normal string path (ex: "C:\Mygame\") or he can detect his installation directory and from from there (option autodetect + data/ will result in a string heading toward the data folder of the game)

The following reference code is from a website that is not allowed to be linked by itch. You can directly refer to the code

'use strict';

/*

====================================================================================================================

 RoamingSavePath.js

 License: DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

 Usage: add this lines to your plugins.js:

{"name":"RoamingSavePath","status":true,"description":"Save directory to game save dir instead of www","parameters":{}}

====================================================================================================================

*/

(function () {

if (!StorageManager.isLocalMode() || typeof process === 'undefined' || !process.env || !process.platform) return;

const fs = require('fs');

const path = require('path');

var globalSavePath = null;

const initPlugin = function () {

const defaultDir = process.env.APPDATA ?

"%USERPROFILE%/Saved Games/" + $dataSystem.gameTitle + "/save/" :

(process.platform == "darwin" ? "%HOME%/Library/Preferences/" : "%HOME%/.local/share/");

const params = PluginManager.parameters('RoamingSavePath');

var savePath = ((params['Save Directory'] || defaultDir).trim().replace(/^[/\\\.]+|[/\\\.]+$/g, '') + path.sep).replace(/[/\\]/g, path.sep);

for (var e in process.env) {

savePath = savePath.replace('%' + e + '%', process.env[e]);

}

globalSavePath = savePath;

}

const validateDirTree = function (targetDir) {

if (fs.existsSync(targetDir)) return true;

const parts = targetDir.split(path.sep); 

var currentPath = parts[0]; 

for (var i = 1; i < parts.length; i++) { 

if (!parts[i]) continue;

currentPath +=  path.sep + parts[i]; 

if (!fs.existsSync(currentPath)) { 

try {

fs.mkdirSync(currentPath); 

} catch (e) {

return false;

}

}

}

return true;

}

const oldDMOL = DataManager.onLoad;

DataManager.onLoad = function(object) {

oldDMOL.apply(this, arguments);

if (object === $dataSystem)

initPlugin();

}

StorageManager.localFileDirectoryPath = function() {

return globalSavePath;

};

const oldSTLF = StorageManager.saveToLocalFile;

StorageManager.saveToLocalFile = function() {

//if (!fs.existsSync(globalSavePath))

//fs.mkdirSync(globalSavePath, { recursive: true }); // needs newer nwjs sometimes

if (validateDirTree(globalSavePath))

oldSTLF.apply(this, arguments);

}

})();

I like this. I don't think there's ever been a system made that does this, for any other iteration of RM, not even VX Ace.

Yes, searching for this option leads to a lot of questions and a very few answers, guess this will be a useful one 😁