You've seen that Sakan and Mado can be integrated directly into MV's Tools menu and main toolbar, but how would you do that for your own tools? This tutorial will introduce you to the tools system and teach you how to create your own tool entry.
Requirements
A tool (executable) to add, a text editor, and graphics editing program if you want an icon for the tool. Tools are only directly supported on Windows and Mac.
RPG Maker tools are just separate programs that can be launched which works with your project. There's nothing really special about a tool, other than it takes the project file path as a command line argument, and ships with some metadata so it can be added into MV's menus.
How to create a tool
Unfortunately, this is an extremely broad topic, so I can't actually cover this here. However, the basic premise of a tool is it takes the path to the project file as the first command line argument. Using this path, you should be able to determine where the project is (the folder that contains the project file), and be able to read and manipulate the project with a standard layout. What you want to do with your tool is up to you, and you can use any language to program it as long as it compiles into an executable.
Important: the project path passed to your tool is
not quoted. This means if there are spaces in the path, it'll be split up into separate arguments. Make sure you get the entire command line string and process that instead of using the args list provided by your language.
Creating tool metadata
Tool metadata lives in an "Identification" folder inside your tool's installation folder, and consists of two parts: a tool declaration file, and an icon for the toolbar. Note for Mac, the "Identification" folder is
inside the .app.
The "app" file
Directly in the "Identification" folder, you should create a plain text file named "app". Just "app", no file extension or ".txt" at the end. Inside it should be three lines indicating the name of your tool, the version, and a short description. For example:
Code:
Example Tool 1.0.0 Shows argument passed to the tool.
The first line is the name of your tool, and should be at most 27 characters long if you want it to fit in the default column width in the tools manager. The second line is the version. It currently doesn't appear to be used. The third line is a short description of the tool, and should be at most 35 characters long if you want it to fit in the default column width. You may add additional lines to the file, but those won't be referenced anywhere.
The toolbar icon
Inside your "Identification" folder, create another folder named "toolbar". Inside that, create a 28x28px image named "icon.png". This image will serve as the icon for the tool's toolbar icon in the RPG Maker editor after you add the tool. You can omit the file, but then it will just show a red question mark.
The name of your executable
For some reason, tool scanning is not open-ended, and the editor will only detect your tool if it has a specific file name. The following are the names that the editor will detect:
Windows:
- TilesetBuilder.exe
- WindowBuilder.exe
- SceneBuilder.exe
Mac:
- Tileset Builder.app
- タイルセットビルダー.app
- Window Builder.app
- ウィンドウビルダー.app
- Scene Builder.app
- シーンビルダー.app
Make sure you use one of the names listed for your platform.
Adding the tool
Put your tool files and "Identification" folder inside a single folder. Depending on how you've obtained your copy of RPG Maker, you can put this tool folder in the following locations for it to be automatically detected by the editor:
Windows:
- Standalone: %PROGRAMFILES(X86)%\KADOKAWA
- Steam: %PROGRAMFILES(X86)%\Steam\steamapps\common\RPG Maker MV\tool
Note: for the Steam version, it really is hardcoded to the default library location in Program Files. It's probably an oversight that it isn't looking inside where RPG Maker is currently installed, despite it being perfectly tenable within the current framework.
Mac:
- Any version: inside your Applications folder
- Steam: ~/Library/Application Support/Steam/steamapps/common/RPG Maker MV
To add the tool to your menus and toolbars, open a project, then go to "Tools -> RPG Maker MV Tools...". If you've added your tool to the locations the editor searches for, it should show up under Found Tools. If not, click "Select Path...", and browse to the tool's folder (or its parent folder). If it doesn't show up even after browsing, then you have used an unrecognized file name. Select the tool, click "Add", then "OK". The tool should now show up in your Tools menu and at the end of your toolbar. Click on the toolbar button or the Tools menu item to launch the tool with your currently open project. Note you cannot launch tools or manage them if you do not have a project open.
An example tool
This tool shows an example metadata setup, and the program itself just tells you the first command line argument, so you can see what to expect when you're writing your own tool. Follow the instructions under "Adding the tool" to try it out within RPG Maker. Source code for the tool is included.
Download:
https://www.dropbox.com/s/q60m29n63uejxs3/ExampleTool.zip?dl=0
本贴来自国际rpgmaker官方论坛作者:cyanic处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/adding-your-own-tools-to-rpg-maker-mv.86920/