Lyra's ExNote (load notetags from external files)

This plugin lets you load notetags from external JSON files. Useful for re-using the same tags over and over, or for long-winded ones that are hard to edit in tiny noteboxes.
index.php

How to Use
Add the .js file to your project's js/plugin folder, then open up the plugin manager in the editor and add the plugin.
There's an explanation on the left side.
The only setting is if you want to see debug messages (default off, for debugging use only).
Once you've added the plugin, simply add this tag to ANY note box:
  • <ExNote: filename> Replace filename with the name of the file you want to load (no file extension needed, it assumes .json). I recommend not using spaces in your filenames, use underscores or dashes instead.
The data from the file will be added onto any data already in the notebox. This is done before the game parses the metadata, so it will act as though you had written out the (parsed) contents of the file in the box -- so text codes, tags, and the like should all work!

The contents of your JSON files should look something like this:
[ "Stuff", "More stuff", "This one.\nHas a new line!" ]

The square brackets start and end the file. Each line needs to be enclosed in double quotes, and if it is not the last line then it needs a comma afterwards. If you need a new line in the middle of a string, use \n. If your text includes a lone \ anywhere, you will need to use \\.

Performance Notes
This adds extra files to load when you first boot up the game. I encountered no noticeable performance impact on my end, but with a big enough project loading a lot of extra files, this could add up.
Terms of Use
You can view the license here. In short, it is free for commercial or non-commercial use. Credit is optional as long as you don't claim it as your own work.
Downloads
You can download just the plugin here. Press the 'Raw' button then Ctrl+S to save it.
I just tried testing this with a map's note box, but it doesn't look like anything was loaded (I turned the debug setting on in the plugin parameters, and nothing was printed either). My json file contains this:

JavaScript:
[
"LAYER_S 1 !TrinityCH1 0 0 192 2 0 0 0 0 0",
"<Overlay: Night>",
"<Overlay Opacity: 60%>",
"<Scroll Lock X: 0.15625>",
"<Map Load Common Event: 243>",
"<Fog 1 Settings>\nName: !Fog2\nHorz Scroll: 1\nVert Scroll: 1\nOpacity: 50\n</Fog 1 Settings>",
"<Fog 2 Settings>\nName: Dark\nOpacity: 150\n</Fog 2 Settings>"
]

It's in the data folder like instructed, and the name of the file + the name in the ExNote note tag match.
Tried moving the plugin above/below others too, but nothing changed. Did I miss anything?
😴
Good catch! Maps seem to get a slightly different process than other things. I've updated it so it works properly with Maps now. (github link)
Seems to work from what I can tell. Thank you for the quick fix! I'll let you know if I encounter anything else, but for now it does exactly what I need. 😂
I hope I'm not double posting (has it already been 72 hours?) but I did find another issue, this time with the note box of a state. The debug setting shows that the associated json file is being loaded, but the contents of this file don't seem to take any effect. These are its contents:

JavaScript:
[
"<Help Description>\nThis unit is enveloped in the energy of a defeated \c[21]\v[120]\c[0].\n</Help Description>",
"<Positive State>"
]

What could be the issue here? I made sure the file name matches what I wrote in the exnote note tag 😅
What could be the issue here? I made sure the file name matches what I wrote in the exnote note tag 😅
Ah, as noted in my release post for the plugin, any instance of the "\" character needs to be 'escaped' -- it has a special meaning to RPG Maker and gets eaten by it when we're trying to change the description to literally just have a "\" in it (then later, other plugins or RPG Maker itself can interpret \c[21] to change the colour etc).

So if you change your file to:
[ "<Help Description>This unit is enveloped in the energy of a defeated \\c[21]\\v[120]\\c[0].</Help Description>", "<Positive State>" ]
it should work fine. notice the double backslashes, they become just a single \ when the file is loaded. The newline characters at the start and end are unnecessary too, I think? But if you add those back in, don't forget they need double backslashes too!

Original thread: https://forums.rpgmakerweb.com/threads/lyras-exnote-load-notetags-from-external-files.160796/