Load Notes/Notetags from Text Files

http://forums.rpgmakerweb.com/index.php?/topic/4436-load-notes-from-text-files/

Pretty much a port of the script linked above.

Putting notetags in each skill, state, weapon, and armor is one thing... But needing to make changes to those notetags is another. Especially when those notetags are crucial in maintaining game balance.

I think a plugin like this would save a lot of time for us when it comes to game making. 
It would actually a bit harder to do in MV than in Ace, since file loading happens via Ajax, which is asynchronous. So you have the following options:


- Use synchronous Ajax and get warnings.


- Pre-load the files with asynchronous Ajax. This means either browsing through everything that has a notetag or registering files as a plugin parameter. If the plugin should only consider notetags in data objects (actors, classes, items, ...) this is fine, but events are a completely different thing.
It would actually a bit harder to do in MV than in Ace, since file loading happens via Ajax, which is asynchronous. So you have the following options:

- Use synchronous Ajax and get warnings.

- Pre-load the files with asynchronous Ajax. This means either browsing through everything that has a notetag or registering files as a plugin parameter. If the plugin should only consider notetags in data objects (actors, classes, items, ...) this is fine, but events are a completely different thing.
Interesting. I believe the script only functioned for data objects anyway, and I would totally be fine with that function or anything similar to it. Either way, I think it would be a great utility.
Don't like bumping at all, but here goes.
It would actually a bit harder to do in MV than in Ace, since file loading happens via Ajax, which is asynchronous. So you have the following options:


- Use synchronous Ajax and get warnings.


- Pre-load the files with asynchronous Ajax. This means either browsing through everything that has a notetag or registering files as a plugin parameter. If the plugin should only consider notetags in data objects (actors, classes, items, ...) this is fine, but events are a completely different thing.
Perhaps indicate that the database is not "ready" until all note boxes have been parsed?
Bumparoo. I'm scared to even start notetagging my database without this. 
My problem is how to make this more efficient.


For example, let's say every object in the database has their own "note file", and you have 1500 objects.


You wouldn't necessarily want to make 1500 requests at the same time, each taking up 1-2 KB.


Rather, it would be better to make one request that's like 1-2 MB. This could be done if the note-files are merged together (either using a tool when you're creating the final distribution, or manually), but some specifications would be required for something like that.


Though, that's not something that you would have to worry about. Ideally, optimizations be automatic and not require you to do anything different other than install a plugin.
Except you can't create a zipped or joined text file from inside the game, unless you were to also install a small REST service on the service side.
I don't think it needs to be that complicated does it? All the script was doing was using a notetag to reference text that was in another file.

So it would be

<textnote: equipmentsetup>

And then in the file called equipmentsetup.txt

You would have the actual notetags that you need to use. Just as it would show in the database.

The reason this is so useful is because people may have duplicate notetag setups for different actors, enemies. States, etc. You can make one change to the text file instead of going through each databae object.
Except you can't create a zipped or joined text file from inside the game, unless you were to also install a small REST service on the service side.
You wouldn't being creating them in-game; when you are moving from development to production, you will likely be running additional scripts to process your files: compress your database, encrypt your resources, minify your javascript/concatenate them together into one big file, etc.

This is where I would combine all of the note-files as well.

Except the plugin would need to know where a note begins and ends for a given object.

This isn't an issue if I already wrote logic to support "note sections" within a single file

<note section for weapon 1> data about weapon 1</note section for weapon 1> <note section for weapon 2> data about weapon 2</note section for weapon 2> Because then I could just provide a tool for combining note files as well based on these specifications.
I don't think it needs to be that complicated does it? All the script was doing was using a notetag to reference text that was in another file.

So it would be

<textnote: equipmentsetup>

And then in the file called equipmentsetup.txt

You would have the actual notetags that you need to use. Just as it would show in the database.

The reason this is so useful is because people may have duplicate notetag setups for different actors, enemies. States, etc. You can make one change to the text file instead of going through each databae object.
I understand the use of it. I'm just trying to find a way to allow you to use a single file for multiple objects.
You could store them in a JSON file, like this:

{ "key1" : "notetags etc...", "key2" : ....}and have the textnote reference keys, instead of full files. The file can be configured as a plugin parameter (or multiple files, separated by comma).My take on it can be found here: http://pastebin.com/e465Ucdf
I understand the use of it. I'm just trying to find a way to allow you to use a single file for multiple objects.
Ahh, gotcha. Brainstorming ways to add features to a plugin, huh? 

*Slowly paces back* I'm definitely not equipped for this discussion. 😀

You could store them in a JSON file, like this:

{ "key1" : "notetags etc...", "key2" : ....}and have the textnote reference keys, instead of full files. The file can be configured as a plugin parameter (or multiple files, separated by comma).My take on it can be found here: http://pastebin.com/e465Ucdf

Interesting twist with being able to choose your own notetag prefix.

Is this the finished product?
You can include me in the 'this plugin would be a godsend' camp. 😉
I haven't made changes to the plugin since i posted it on pastebin, so i would say it's finished for now. It's pretty simple and straightforward, but if i missed something just tell me and i'll add it.
I haven't made changes to the plugin since i posted it on pastebin, so i would say it's finished for now. It's pretty simple and straightforward, but if i missed something just tell me and i'll add it.
Thanks for pointing that out, I missed it.

Can the strings be multi-line?
Sure, everything between the quotes ("") will be part of the notebox.
Sure, everything between the quotes ("") will be part of the notebox.

Great!

I will put this to good use. You can count on that.

I especially like the way that its a single file. When I first started using external note tag scripts in VXAce I assumed I'd want seperate files for each item... But actually using it become unbearable after it grew to more than several dozen files. 🙂
Sure, everything between the quotes ("") will be part of the notebox.
It seems that anything more than a single line causes an unexpected token error.

edit:

Also, you allude to using multiple files. Can you explain what you mean? Your instructions only detail a single file with multiple keys.

I doubt I will use multiple files, but I might for the sake of a little organization.
Fantastic! I'm on my way to work, but I'll test it out when I get home. Thank you very much for your help and input guys. I'll mark this solved once I test the plugin. Unless Roguedeus can confirm  that it works before I do.

EDIT: Ninja'd. I'll follow up on the topic throughout the day to see if the bugs get ironed out.
Assuming you have two files, like this:

"data/notes1.json"

{    "key" : "some notetags",    "anotherkey" : "some more notetags"}"data/notes2.json"
Code:
{    "wow more keys" : "..."}
and you set the parameter "File Path" to "data/notes1.json, data/notes2.json", both files will be loaded at game start. Note that all files are loaded asynchronously, so if you're using the same keys in multiple files (which you shouldn't), it can't be predicted which entry will be used.
This can come in handy, if you want to separate your notetags for armors/weapons/etc... in different files.

/edit:

It seems that anything more than a single line causes an unexpected token error.
Seems i was wrong, JSON doesn't allow linebreaks in Strings. I could modify the plugin so you can give an array of Strings and it automatically adds linebreaks between them, though.

//edit: I did.

Original thread: https://forums.rpgmakerweb.com/threads/load-notes-notetags-from-text-files.49035/