Making Filenames in JS

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
In Ruby and the DataManager, there's a function called make_file_name, however I find it not present in MV. What is the JS equivalent of:

File.exist?(DataManager.make_filename(0))

Thank you.
 

Evgenij

Veteran
Veteran
Joined
Aug 28, 2013
Messages
349
Reaction score
100
First Language
German
Primarily Uses
N/A
This will check if savefile with ID exists:

DataManager.isThisGameFile(ID);Look at the DataManager and StorageManager classes in the rpg_managers.js file, to see how it works.
 

ArkDG

Veteran
Veteran
Joined
May 26, 2013
Messages
143
Reaction score
47
First Language
portuguese
Primarily Uses
Hi, I have a similar problem... I used to use "File.exist?" command on the Rmvxa plus other commands to create and check third files that I used to know if the player have done certain thing on the game before even without a save game file. A kind of global save file that gave me information about what and when were the first time the player oppened the game, etc... Without, for it, needing to makr a save game.... Cause if I use a normal save game, I could load it and use switchs...  And I don't want to do this cause I have some plugins that check the normal save files to know if the player normally saved before....

How can I do it in RMMV?
 

ArkDG

Veteran
Veteran
Joined
May 26, 2013
Messages
143
Reaction score
47
First Language
portuguese
Primarily Uses
In Ruby and the DataManager, there's a function called make_file_name, however I find it not present in MV. What is the JS equivalent of:

File.exist?(DataManager.make_filename(0))

Thank you.
Milena, I found a way to do something about this... But It will take to change come lines in "rpg_managers.js"

I don't know if it was exactly what you wanted, but worked for me:

Changed 'rpg_managers.js" lines 663 ... 687

StorageManager.localFilePath = function(savefileId) { var name; if (savefileId < 0) { name = 'config.rpgsave'; } else if (savefileId === 0) { name = 'global.rpgsave'; } else if (savefileId > 0) { name = 'file%1.rpgsave'.format(savefileId); } else { name = '%1'.format(savefileId); } return this.localFileDirectoryPath() + name;};StorageManager.webStorageKey = function(savefileId) { if (savefileId < 0) { return 'RPG Config'; } else if (savefileId === 0) { return 'RPG Global'; } else if (savefileId > 0) { return 'RPG File%1'.format(savefileId); } else { return '%1'.format(savefileId); }};Now to create a save file that isn't named like "fileID.rpgsave" you will just use this script call:

 StorageManager.save('nameofyourfile.whateveryouwant')To check if this file or any other file exists in the save folder (well, the folder can be changed with some more work on the code, but I don't see a reason to do that...)

StorageManager.localFileExists('name of the file that you want to find');If you want to load it as a normal save file or delete it  (cause this file will be just a save file with another name and extension...)

StorageManager.load('nameofyourfile.whateveryouwant')StorageManager.remove('nameofyourfile.whateveryouwant')Why do I use "StoreManager"?

Cause this way the files that I create will not be registered in global.rpgsave, and a lot of bugs will be skipped.

If you want to make a save file that can be found in global.rpgsave registers, you would like to use the DataManager save way. I think the codes I said before will work, but I have not tested it... yet...

I would like to make a snippet with some kind of "alias" that make it needless to change the core scripts ):

But I'm not that good yet, so if someone can do and post it here,  would be nice.

Did I help? haha

Good luck.
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

I usually don't enjoy survival games, but I absolutely love Conan Exiles.
Basically Everyone: Dont make a long game the first time. Me: I guess i'll make a REALLY long game in that case >:p
I've developed a habit of thanking cleaning ladies for their work.
Sorry Aerith... I will abandon your shoes... :guffaw:
Spent a whole bunch of time today reworking the area in the video because someone said it was too illusory. So I reworked it so it changes less, moved the grass up to the same level as the player.... And found enough extra resources to make the grass moves when the player touches it. Also lots more water, because it looks amazing. I'll probably put up a short updated video later today.

Forum statistics

Threads
95,771
Messages
931,773
Members
126,171
Latest member
webbmichael
Top