设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 59|回复: 0

[转载发布] Drak Plugin Core

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    4 天前
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4594

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    23195
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28683

    灌水之王

    发表于 前天 10:35 | 显示全部楼层 |阅读模式
    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).


    本贴来自国际rpgmaker官方论坛作者:Drakkonis处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/drak-plugin-core.135588/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-16 14:22 , Processed in 0.119704 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表