Ryu's Meta Data Handler

MetaData Handler - v1.04b
Ryuuji

Introduction

A plugin meant to handle metadata from game objectd.
All metadata are supported. (See list below)
Metakeys are known as notetags

Features
Spoiler: versions log
V1.0
Reading, writing and deleting metadata from map events.
Allow a user to set multiple notetags (meta keys) and have values attached to them.
V1.01
Allow a user to use the meta keys in the conditionnal branch part.
This enables the user to make the event act differently based on its notetag.
V1.02
Allow a user to apply actions on an eventId based on a variable value.
Can be usefull if you spawn new events and want to edit their metadata before proceeding.
V1.03
Enables the user to use an array of words for metaKey and metaValue, defaults them at true and parses both true and false as such instead of strings.
V1.04
Huge update
Enables the user to use this tool across all game objects
Fixed some parsing issues
Increased the global scope possibilities
V1.04b
Fixed the missing map data, thanks to AquaEcho for pointing it out.




Screenshots
Spoiler: Conditionnal branch add-on
1.PNG


How to Use
- Copy the "Ryu_metaDataHandler.js" file into your project's /js/plugins/ folder
- Activate plugin using the 'Plugin Manager'
- Read the 'HELP' documentation (also found in plugin manager).
​
Spoiler: Info
JavaScript:
 /* v1.04b
 *   Fixed the missing map metadata. Thanks to AquaEcho for pointing that out.
 *
 * v1.04
 * This new version enables the user to edit meta data from any game object.
 * This is a major update and renders errors with v1.0
 * Make sure to upgdate the syntaxes in your game
 *
 * How to use:
 *   Open the command module and use following settings
 *   - MDataId or MDataVar (case sensitive)
 *     MDataId should be used it you know the exact ID you are trying to affect.
 *     MDataVar will use a the value of the variable ID provided.
 *  
 *   - read, write, delete and readall
 *     read will read the value of the provided key from the provided object id.
 *     write will write both the key and the value to the provided object id.
 *     delete will delete both the key and the value to the provided object id.
 *     readall will read all keys and their values from the provided object it.
 *  
 *   - Gameobject (Weapon, armor, item, enemy, state, skill, class, actor, event, map)
 *     Each of those object have their own notetag which can be edited in the
 *     game builder and edited through this plugin.
 *  
 *   - ID (either raw ID or the variable ID containing the id)
 *     This will allow the plugin to know what you want to edit
 *     Each object has their own id, make sure to use to appropriate id.
 *  
 *   - MetaKey
 *     This is the key attached to a notetag.
 *     It should be put between <> to take effect.
 *     There is no limit to the amount of keys a user can attach to an object,
 *     but try and be reasonnable. :D
 *  
 *   - MetaValue
 *     This is the value attached to a metaKey
 *     By default it will be read as a boolean and set to true. (If no values
 *     are applied)
 *     Meaning : <berrybush> will be turned into <berrybush:true>
 *     Rpgmaker MV handles any value as a string, but this plugin will overwrite
 *     that and parse both "true" and "false" as a bool.
 *     Meaning : <berrybush:true> is handled as <berrybush:"true"> by the software
 *     but this plugin overwrites that as a bool upon being used.
 *     NOTE : if the plugin is not called, it should not affect anything
 *  
 *   Examples of use :
 *   - MDataId read event 1 berrybush
 *   - MDataId write actor 1 surname Ryuuji
 *   - MDataVar readall class 99 type
 *   - MDataVar delete ennemy 100 healing
 *
 *   NOTE :
 *   MetaKey strings are supported and are to be put between ""
 *   MetaValue strings are supported and are to be put between "" (But only possible
 *   if the metaKey is a string of words)
 *   Needs to be fixed asap ^.^
 *
 *   Updated checkMeta function allows for even more custimisation
 *   You can now use this tool in conditionnal branch and check for values as well
 *   This can be done through eventing or scripting
 *
 *   - Eventing:
 *     Select conditionnal branch => Scripting
 *     Add the script line :
 *     checkMeta('actor', 1, 'surname') === "Ryuuji"
 *     - checkMeta is the method
 *     - 'actor' is the type of object
 *     - 1 is the ID
 *     - 'surname' is the key
 *     - "Ryuuji" is the value
 *     Make sure the watch for spaces :
 *     <surname:Ryuuji> is not the same as <surname: Ryuuji>
 *   - Scripting
 *     Select script...
 *     You can script as you usually would here
 *     An example would be :
 */     // Example conditional branch to check for a specific string value
        if (checkMeta('event', 1, 'berrybush') === 'active') {
            // Actions to perform if the meta key 'type' is 'active'
            $gameMessage.add('This berrybush is active.');
        } else if (checkMeta('event', 1, 'berrybush') === 'inactive') {
            // Actions to perform if the meta key 'type' is 'inactive'
            $gameMessage.add('This berrybush is inactive...');
        } else {
            // Actions to perform if the meta key 'type' has a different value or does not exist
            $gameMessage.add('This berrybush is neither active or inactive...');
        }
​




Plugin Commands / Script Calls
Everything you need to know is in the help section of the plugin


Download plugin
Right click and save as (current version 1.04b)
Download

Terms and Credits

Free to use
Feel free to credit Ryuuji, or not. ^^

Feedback
I have a few ideas to increase the scale of this tool, but unless someone specifically needs it, I think I'll pass for now.
Let me know if you have any ideas or suggestion.
Bug detected? Let me know! 😀

​
Added new versions to widen the scale of the tool.
V1.01 adds a global scope to use data for conditionnal branching
V1.02 adds a variable handler (second command option) to act on eventId based on variable value
V1.03 adds the possibility to use an array of words as metaKey and metaValue and is more optimised.
V1.04 adds a objectType to be able to use any game object as a reference and increased the global scope to all data, not just bools
Oh my! This is so cool!!! Definitely will come in handy. I'll comment again if I find any bugs!

As for suggestions maybe see if you can change meta for the game actors, armors, ect but have it refresh when it happens? I read somewhere that it only loads meta once when the game starts so I'm not too sure but it would be cool!
Oh my! This is so cool!!! Definitely will come in handy. I'll comment again if I find any bugs!

As for suggestions maybe see if you can change meta for the game actors, armors, ect but have it refresh when it happens? I read somewhere that it only loads meta once when the game starts so I'm not too sure but it would be cool!
Extending this plugin to all metadata is definitely possible. ^^
Shouldn't be too hard either.

As for meta loading at game start, that's true, however this plugin allows the user to edit it wherever fit with immediat effect.


An extension of this can make it a very dynamic tool.

Say I would use this on an actor's notetag, with this plugin you could add a metaKey "Special Ability" and set the value to "disabled", then change this to "enable" anytime, anywhere (even in battle), to allow the actor to use a specific ability.
Or I could use this on an item's notetag and edit its effect based on the time of the day (ingame), using a key "effect" and a value "heals_50HP" and if it's night change that value to "heals_100HP".
Or even have a quest item (key item) that has its description evolve as the player moves on in his quest.
with a key "item description" and a value "this is an unknown object", then if a switch or variable has a certain value, edit the value to "this seem to be a key", etc...

Since I already added the keys and their values to a global scope, you could easily use the keys and their values in conditionnal branching, allowing you to do whatever you please with the data.

Basically granting unlimited variables as well as structuring them so that they are tied to their specific game object.
Lots of possibilites.

I'll work on it and update in my day off. ^^
Definitely interested. There are a lot of plugins that use meta data so being able to edit them on the fly would open a lot of dynamic gameplay possibilities
Extending this plugin to all metadata is definitely possible. ^^
Shouldn't be too hard either.

As for meta loading at game start, that's true, however this plugin allows the user to edit it wherever fit with immediat effect.
That would amazing!!! I'll definitely keep an eye out for the update!
I updated the plugin and it's now capable of handling all game objects (unless I forgot one? 😊)

This include
Map events, actors, armor, item, weapon, enemy, state, skill and class.

It should be bug free, but if you encounter one do let me know.


IMPORTANT :
If you used a previous version, the plugin call structure has been changed to now be able to add the object type you want to edit, make sure to update your plugin calls appropriately
Wow! This looks really useful! Great job!
I updated the plugin and it's now capable of handling all game objects (unless I forgot one? 😊)

This include
Map events, actors, armor, item, weapon, enemy, state, skill and class.
Does it work on the map metadata?
I'm so glad I kept an eye out! Fantastic job! I'll give it a go after I get off of work!
Does it work on the map metadata?
Actually it didn't, my bad forgot about that one.
Just updated it so it does now. (You will need to redownload it though)



I'm so glad I kept an eye out! Fantastic job! I'll give it a go after I get off of work!
Thanks! Glad you like it. 😊

Original thread: https://forums.rpgmakerweb.com/threads/ryus-meta-data-handler.169745/