Adding Notetags specifically in a class?

I have a question regarding adding note tags. I want to specifically add a note tag if we go to a particular setup. In Ace, we have this:

class RPG::Enemy < RPG::BaseItem def invisibility? self.note.include?("invisible") endendclass Game_Enemy < Game_Battler def invisiblity? enemy.invisibility? endendHow do you exactly convert this in js? Specifically also, what's the equivalent of self.note.include?() in RMMV's scripting?
I have a question regarding adding note tags. I want to specifically add a note tag if we go to a particular setup. In Ace, we have this:

class RPG::Enemy < RPG::BaseItem def invisibility? self.note.include?("invisible") endendclass Game_Enemy < Game_Battler def invisiblity? enemy.invisibility? endendHow do you exactly convert this in js? Specifically also, what's the equivalent of self.note.include?() in RMMV's scripting?
I use this ridiculously idiotic setup(DoubleX RMMV Equip Prerequisites):

Spoiler
DataManager.loadDatabase = (function(loadDatabaseEquipPrerequisites) { return function() { loadDatabaseEquipPrerequisites.apply(this, arguments); this.load_all_equip_prerequisites_notes(); // Added };})(DataManager.loadDatabase);DataManager.load_all_equip_prerequisites_notes = function() { // New this._equip_prerequisites = {}; this._equip_prerequisites.weapons = {}; this._equip_prerequisites.armors = {}; for (index = 1; index < lines.length; index++) { if ($dataWeapons[index] !== undefined && $dataWeapons[index] !== null) { this.load_equip_prerequisites_notes($dataWeapons[index], "weapons"); } } for (index = 1; index < lines.length; index++) { if ($dataArmors[index] !== undefined && $dataArmors[index] !== null) { this.load_equip_prerequisites_notes($dataArmors[index], "armors"); } }}; // DataManager.load_all_equip_prerequisites_notes// data: The data to have its notetags read// type: The type of the dataDataManager.load_equip_prerequisites_notes = function(data, type) { // New var id = data.id.toString(); this._equip_prerequisites[type][id] = { armor_req: [], stat_req: [], var_req: [], }; lines = data.note.split(/[\r\n]+/); var armor_note = /<armor req:\s*(\d+)>/; var stat_note = /<stat req:\s*(.+),\s*(\w+),\s*(\w+)>/; var var_note = /<var req:\s*(\d+),\s*(\w+),\s*(\w+)>/; var num, vals; for (index = 0; index < lines.length; index++) { if (lines[index].test(armor_note)) { vals = lines[index].match(armor_note); this._equip_prerequisites[type][id].armor_req.push( parseInt(vals[0])); } else if (lines[index].test(stat_note)) { vals = lines[index].match(stat_note); vals[0] = "this." + vals[0]; num = parseInt(vals[2]); vals[2] = num if num !== NaN; this._equip_prerequisites[type][id].stat_req.push(vals); } else if (lines[index].test(var_note)) { vals = lines[index].match(var_note); vals[0] = parseInt(vals[0]); num = parseInt(vals[2]); vals[2] = num if num !== NaN; this._equip_prerequisites[type][id].var_req.push(vals); } }}; // DataManager.load_equip_prerequisites_notes
In this case, all this plugin's notetags of armor and weapon with id x and y can be accessed respectively via:

DataManager._equip_prerequisites.armors.xDataManager._equip_prerequisites.weapons.yThe general form is this:

DataManager._notetag_name.data_type.data_idOf course such setups will quickly turn DataManager into a complete mess lol
Indeed it made it quite long. But specifically for the game enemy, how would you do it? I only want to check one note tag for the enemy.
I remember Yanfly used code like that in VXAce, and it avoided being a mess due to every script having it's own datamanager. Though it did seem to cause a little slowdown when a game was first loaded (1 - 2 seconds).
Indeed it made it quite long. But specifically for the game enemy, how would you do it? I only want to check one note tag for the enemy.
If that notetag's read using my setup, it can be accessed via:

DataManager._notetag_name.enemies.enemy_idWhere enemy_id is the id of the enemy to have his/her/its notetag accessed 🙂
I see. One last problem, since I am testing the note tag of any enemy, what property should I do? Is it:

DataManager.invisibility.enemies.noteor is there a way to detect each enemy's note? Because enemy_id, lets us be specific which enemy that is, right?
I see. One last problem, since I am testing the note tag of any enemy, what property should I do? Is it:

DataManager.invisibility.enemies.noteor is there a way to detect each enemy's note? Because enemy_id, lets us be specific which enemy that is, right?
Using my setup, it should be this:

var enemies = DataManager.invisibility.enemies;for (enemy_id in enemies) { if (enemies.hasOwnProperty(enemy_id) && typeof enemies[enemy_id] === "object") { enemies[enemy_id]; // Each enemy's notetags can be accessed using this }}Or this:

Code:
var enemies = DataManager.invisibility.enemies;var enemy_ids = ["enemy_id_1", "enemy_id_2", "enemy_id_3", ..., "enemy_id_n"]for (index = 0; index < enemy_ids.length; index++) {    enemies[enemy_ids[index]]; // Each enemy's notetags can be accessed using this}
Here's my try and problems are presented in comment:

DataManager.loadDatabase = (function(loadInvReq) { return function() { loadInvReq.apply(this, arguments); this.load_inv_requirements(); // Added };})(DataManager.loadDatabase);DataManager.load_inv_requirements = function() { // New this.inv_requirements = {}; // no clue how to do it on this part}; // data: The data to have its notetags read// type: The type of the dataDataManager.load_inv_requirements_tags = function(data, type) { // New // note tag check, how to do <invisible> var enemies = DataManager.invisibility.enemies; for (enemy_id in enemies) { if (enemies.hasOwnProperty(enemy_id) && typeof enemies[enemy_id] === "object") { enemies[enemy_id]; } }};basically what I need is for the Data then to check <invisible>, and if that enemy has that tag, then some thing will happen. Any clues?
i usually create a function... and then pass the object to that method...

then call it's note using

[replace object here].note

then do the things i want inside the function...

example:

Game_Interpreter.prototype.getDecorMap = function(item) {    var mastermap = 0;    comment = item.note;    console.log(comment);    if(comment.match(/<decor_map:\s*(\d+)?>/im)) var mastermap = Number(comment.match(/<decor_map:\s*(\d+)?>/im)[1]);    return mastermap;};then when i want to grab item 10 <decor_map: x> notetags

i passed $dataItems[x] to that function and call it... (if you want easier way... don't place the function inside Game_Interpreter. but place it where they have $ variables such as $gameSystem, $gameMap, so it can be called anywhere. the example above just copy pasted from my plugin in development. and i need it inside Game_Interpreter...).
i usually create a function... and then pass the object to that method...

then call it's note using

[replace object here].note

then do the things i want inside the function...

example:

Game_Interpreter.prototype.getDecorMap = function(item) {    var mastermap = 0;    comment = item.note;    console.log(comment);    if(comment.match(/<decor_map:\s*(\d+)?>/im)) var mastermap = Number(comment.match(/<decor_map:\s*(\d+)?>/im)[1]);    return mastermap;};then when i want to grab item 10 <decor_map: x> notetags

i passed $dataItems[x] to that function and call it... (if you want easier way... don't place the function inside Game_Interpreter. but place it where they have $ variables such as $gameSystem, $gameMap, so it can be called anywhere. the example above just copy pasted from my plugin in development. and i need it inside Game_Interpreter...).
Thanks estriole, but I just want to ask if its a single string. For example, instead of <decor_map: x>, how about <decormap>? Do you still use /<decor_map:\s*(\d+)?>/
Thanks estriole, but I just want to ask if its a single string. For example, instead of <decor_map: x>, how about <decormap>? Do you still use /<decor_map:\s*(\d+)?>/
if there's no pattern like that just match it using the actual text.

ex:

Game_System.prototype.check_decor = function(comment) {if (comment.match(/<decor_map>/im)) return true;return false;}to use it pass the string using $gameSystem

Code:
var txt = "this is comment that contain <decor_map>";if ($gameSystem.check_decor(txt)){// do something here}else{// do another thing here}

Original thread: https://forums.rpgmakerweb.com/threads/adding-notetags-specifically-in-a-class.48992/