When I first started using RPG Maker MV a couple of years ago, I wanted to put an external array in a variable.
@Lanzy graciously wrote me a plugin that would do that. Essentially there are 2 lines, no parameters.
Code:
var $dataList = null;
DataManager._databaseFiles.push({name: '$dataList', src: 'List.json'});
Then all it needs is a simple assignment to a variable
◆Control Variables:#0001 arrayFromFile = $dataList
and a dialogue box will verify the contents
Contents of variable01 = \v[1]
shows
Contents of variable01 = dog,bird,cat,bird,horse
For reference, here's a link to
Lanzy's Code plugin posted earlier in this same thread.
The plugin works great in MV, but not in MZ. Turning the plugin on in MZ prevents MZ from loading, giving this error (Note, this is a vanilla project, one map, one event, no plugins except Lanzy's.)
View attachment 220810
Console shows
View attachment 220811
Since I'm using the exact same plugin and .json file from MV, I have to assume MZ either doesn't support this or that the MZ terminology is slightly different.
tldr: Can someone translate MV's
Code:
var $dataList = null;
DataManager._databaseFiles.push({name: '$dataList', src: 'List.json'});
to MZ? As always, thank you to any and all who respond.
As an aside, I was loading the external file within the game itself using
Code:
var fs = require('fs');
: :var wordList = fs.readFileSync("./data/wordListAbridged.dat", 'utf-8');
: :$gameVariables.setValue(1, wordList);
but, apparently, if I deploy for web, the browser refuses to load the file and this is for a game I made for my grandchildren who use Chrome tablets, not Windows, so I really want to go the .json route if I can.
Edit-I was able to accomplish loading the word list by copying and pasting the file contents using variable = script, then running that event with autorun when the game starts. Works well enough, seems that the variable had no trouble holding 1700+ words, but I'd still like to know if there's an equivalent of DataManager._databaseFiles for MZ. Thanks again.