Using Note Tags in Plugin Creation

So I've seen a few people ask about this in the forums but no one seems to ask the question quite the way I needed.


I know that you have to make some function to read notes. As such I used the following template

Spoiler
alias.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!alias.DataManager_isDatabaseLoaded.call(this)) {
return false
}
if (!alias._loadedDatabase) {
this.loadSkillNoteTags($dataSkills);
alias._loadedDatabase = true;
}
return true;
};

DataManager.loadSkillNoteTags(datatype){
for (var n = 1; n < datatype.length; n++) {
var object = datatype[n];
var dataNotes = object.note.split(/[\r\n]+/);
object.propertyONE = {};
object.propertyTWO = {};
for (var i = 0; i < dataNotes.length; i++) {
var line = dataNotes;
if (line.match(/Command1:[ ](.*)>/i)) {
var Value = String(RegExp.$1).toUpperCase().trim();
obj.propertyONE[Value] = 'Call A';
} else if (line.match(/Command2:[ ](.*)>/i)) {
var Value = parseInt(RegExp.$1, 10);
}
}
};




So as of right now this should do nothing more than load the note tags and search for a specific <Command1: someTexthere> & turn that text into all caps or <Command2: someNumberhere> and turn the numerical String value into a Number value.


So my questions are


1. At what point or how do I call a function to react to the commands?


2. At what point are the note tags read?


I read that map notes are read upon entering the map. If that is so then would skill & item note tags only be read upon using the skill or item? Would armor and weapon ones ONLY be read upon equipping the item? That's the kind of thing I'm wondering.


Also, no I don't have any specific code yet which is why this is all very template like. I'm looking into creating a new plugin and I really want to use note tags to make it cleaner than my last one.
2) the notetags are read at the time you call the function to read them.


You as the plugin writer decide when to access that data, it is never done automatically


1) see above: you decide when you need that data.


Some plugin writers load the data on newgame to transfer it to their own data structure and ignore the notetags after that.


Some plugin writers (especially for battleplugins) load the data on the battlescreen setup, when the enemies and actor battlers are initialized (that is why a summoning during battle might miss data)


Some plugin writers load the data directly before they need it - which can add more lag because reading notetags is slower than accessing preloaded data, but also allows for some dynamic changes


So you didn't find an answer to those questions because you have to decide on those answers for yourself, they don't happen automatically.


And not one can tell you a definite answer, because it always depends on the plugin you're writing.
I see... But i got a pretty good answer from you in battle screen setup so thank you.


So just to be certain. Once loaded i could have the function that checks skills check the note tags for any additional information?


I'm probably going to test that theory shortly.


Thank you Andar

Original thread: https://forums.rpgmakerweb.com/threads/using-note-tags-in-plugin-creation.71263/