Iavra Note Files

Description


Allows to store notetags in text files and reference them from database objects and events.


Author


Iavra


Parameters


@param File Path
@desc Path of the file to load. Multiple files can be specified when separated by commas. Default: data/notes.json
@default data/notes.json

@param Notetag
@desc Tag used to load metdata from files. Default: textnote
@default textnote




How to Use


Note: This plugin has to be placed below everything else that deals with DataManager.extractMetadata().


Create one or more files and store their locations inside the "File Path" parameter, separated by comma. The files are formatted like this:


{
"key1" : "some notes",
"key2" : "some more notes",
"key3" : [
"notes with",
"linebreaks"
]
}


JSON itself doesn't allow real linebreaks inside Strings, but you can use an array, instead, which will automatically be converted to a single String with linebreaks.


Inside your database objects and events, you can reference these entries like this:


<textnote key1>


If "textnote" is already in use by another plugin or you want to use a different notetag, you can change it with the "Notetag" plugin parameter".


Terms of Use


Free to use for both commercial and non-commercial games. Please give credit.


Download


http://pastebin.com/e465Ucdf


Notes


The plugin originated from this request: http://forums.rpgmakerweb.com/index.php?/topic/49035-load-notesnotetags-from-text-files/
Works wonderfully. Thanks again for taking on this request.
This is great!
I've noticed a tendency of the game to hang upon initial (test) start after I've altered the JSON files associated with this plugin.

I am only guessing, as it seems totally intermittent, or I would spend time trying to isolate it. And it doesn't help now that I have all my note tags externalized, I can't play test without this plugin!

I was wondering if anyone else has experienced this.
Start-up might take a bit longer, since i'm loading additional files and replace all tags with their content. The only part that could really make the game "hang" (as in, not even showing the "Now Loading" text) would be in DataManager.extractMetadata(), but since this is only ever called inside an Ajax call, it shouldn't really affect the game.


The main problem here is, that i start loading my files the moment DataManager loads its own. extractMetadata is called, when a file has been loaded asynchronously and i need to make sure, that my files have already been loaded, so i pause the thread (in a pretty...rough way, i'll admit). All lags might be solved by adding a small wait to the loop, so it doesn't have the tendency to blow-up memory usage.


/edit: I fixed the issue by properly using callbacks instead of horrible, empty loops (don't do this...ever). I'll add comments and will update the plugin in the next few minutes.


//edit: The plugin has been updated. Please note, that it probably has to be placed below everything other plugin that deals with DataManager.extractMetadata() to work correctly (shouldn't be too many, if any).
Thanks for the quick update!
Fixed a bug that caused the last version of this plugin to not work at all.
Hi there!
I've made an addition to this plugin (originally, I changed this plugin to suit different needs, but then added said functions into this plugin to be a direct addition to the original one).
I managed to add the reverse of the Iavra Note Files: the ability to load "Global Default Notetags", that apply over all the entries (of each specific type), with the option to manually specify, via custom notetag, which entries should ignore said global notetag.

File down below for this, using it has the base Iavra Note Files functionality and the new Global Default Notetags functionality.

Original thread: https://forums.rpgmakerweb.com/threads/iavra-note-files.50442/