Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
135
Reaction score
97
First Language
English
Primarily Uses
RMMZ
Drak Plugin Core v1.01
Drakkonis

Introduction
This plugin was developed to aid plugin creation, as I found myself having to rewrite the same general functions in nearly each plugin I made. So I stuck them all in here. As such, my more "robust" plugins will all require this plugin. Coincidentally, it can be used as a standalone tool to aid in the creation of your own plugins.

Features
There are currently 3 primary functions for this core plugin.
Function 1 - Color Conversion
Function 2 - Getting Notetag Block Data
Function 3 - Plugin Parameter Conversion

How to Use
Just save the script to a file called "Drak_Core.js". If you use any of my plugins that require this plugin (none released at this time), just put this plugin above them in the plugin list. If you're using it to develop your own plugins, make sure this is above those plugins as well.

Plugin Commands / Script Calls
Function 1 - Color Conversion
Calling ColorManager.getColor(color) is used to accomodate having a single parameter for a color setting and not needing to restrict it to system or hex colors. Pass either to this function, and the output is hex.

Function 2 - Getting Notetag Block Data
DataManager.assignNoteBlockData takes a $data object, such as $dataActors, and as many notetag keywords as you like, and runs through each object in the data, pulling every line between <note key> and </note key> lines, and sticking that data on the object in question for easy data access. The data is stored as an array directly on the $data object, with the name equal to the keyword. If there are spaces in that keyword, you'll need to either rename/manually reassign the array later, or simply use $dataObject["note key"] format to access the data.

Function 3 - Plugin Parameter Conversion
One of the first things a plugin with parameters does is pull all the parameters from PluginManager, and usually convert them for easy use. PluginManager.convertParams(pluginName) will automatically convert all parameters associated with that plugin, including automatically parsing any JSON-escaped objects and strings(even nested JSON objects!). It returns the entire collection as a single object, so instead of assigning a variable to PluginManager.parameters(pluginName), assign it to PluginManager.convertParams(pluginName) instead.

A note for function 3: It automatically assumes what the data is supposed to be, since parameter values are all initially strings. This means that, for example, if you want a value with a number to be a string type instead of a number type, this function will actually provide extra work by requiring you to manually convert it back to a string. The assumptions are made by the content of the string, with no way to specify any exceptions. Also, any blank values are set to null. If you don't want that to happen at all, feel free to delete the line in question (line 90).

Download
Drak Plugin Core

Terms and Credits
Free for use in any project, commercial or otherwise. Credit Drakkonis.

Miscellaneous
I'll most likely be adding features to this plugin as I find myself writing other functions over and over again. I'm also open to adding other features for plugin developing ease, these are just what I figured some of the most common "necessities" for plugin development were. I'm certainly open to suggestions!

For anyone using this plugin to make your own, I recommend learning how to do some of this stuff yourself, if you don't already know how. Yes, this plugin automates a lot of the heavy lifting, but I feel it is important to develop your own style as a programmer, as well as learning how to do what you need done. If you're learning how to deal with nested JSON parameters, for example, this plugin will make sure your plugin works(on that aspect, anyway), but I HIGHLY recommend learning to do it WITHOUT this plugin, just so you know how to do it, if nothing else. That's not to say I don't want you to use this plugin, I wouldn't release it otherwise. I just feel that there's something special about knowing how to do it on your own, that it makes you a better programmer in the end. On the other hand, you really can't beat efficient automation of an annoying task(and nested JSON parameters, for me, was a MAJOR PITA to figure out, as well as work with. It was a major inspiration for developing the 3rd function).
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Gameboy Tiles, Cure Writer's Block, Animations on Menu, Generate Tasks | RPG Maker News #40

How would you judge a game you played? Art/Graphics? Story? Gameplay?
Learn MV sales goal = 2%
NSFW game sales goal = 2500% (no jokes) :guffaw:
After gathering, sorting out & reconsidering hundreds of enemy battlers over the last two das, finally my favorite part begins: Inventing names and lore for them all :D

Forum statistics

Threads
111,377
Messages
1,060,581
Members
144,706
Latest member
DonTonyPepperoni
Top