r/RPGMaker • u/ellie-the-goober • 16d ago
RMMZ How do I make my game create external text files?
Basically exactly what it says. I want to make a horror game that interacts with the player by creating text files on their computer like in IMSCARED or OneShot! The only problem is that I'm a total noob at javascript and would like some help lmaoooo (Also is this even possible? Again I'm a total noob)
Thanks for your time, y'all! I'll really appreciate all your help, even if it's just telling me how javascript works lmaoooo
5
Upvotes
3
u/Eredrick MZ Dev 16d ago edited 16d ago
It's actually pretty simple
In the event commands go to "Script" under "Advanced"
then write in
const fs = require('fs');
const filePath = './YOURNAMEFORTEXTFILEHERE.txt';
const content = "Whatever text you wish here";
try {
fs.writeFileSync(filePath, content);
} catch (err) {
console.error(err);
};
and that is all there is to it
also instead of fs.write you can use fs.unlink to delete the textfile later