This is an MV 1.3.0 problem. I know basic programming but I'm fairly new to both RPG Maker and Javascript.
I'm trying to create a script that writes an object's note to a text file. I started by grabbing this sample code from a tutorial by SumRndmDde:
//Write Text File
var path = window.location.pathname.replace(/(\/www|)\/[^\/]*$/, '/data/');
if (path.match(/^\/([A-Z]\

/)) { path = path.slice(1);
}
path = decodeURIComponent(path) + "save.txt";
var fs = require('fs');
fs.writeFile(path, "Game Complete", function(err) { if(err) { return console.log(err); }
});
This works as expected, creating (or overwriting) a "save.txt" file with the words "Game Complete" in it. But step two - getting it to write a note instead - failed. I've tried replacing "Game Complete" with both of the following:
$dataClasses[1].note
String($dataClasses[1].note)
...and all I get is an empty text file. The note for class 1 is NOT empty.
Any idea what I'm doing wrong?