设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
搜索附件  
同能RPG制作大师 › 附件中心 › 同能RM技术讨论区 › RPG Maker MV 讨论区 › Storing and Access Text / Data via Plugin-3.jpg

Storing and Access Text / Data via Plugin-3.jpg

 

Storing and Access Text / Data via Plugin:
This tutorial may change your experience of how you use RPG Maker MV.

I must admit, I found this method long time ago by accident. I only have little knowledge of coding and can't call myself a proper programmer. As I never see anybody else has discovered / publishing it, I thought this would be groundbreaking.

What is this about?
Have you ever thought of how big your story and your dialog is and it will be a pain if you have to edit em or even keep em organized? "Can't we just store the whole text inside text editor?" Certainly that would be convenient. And this tutorial is the simplest form to achieve that.

Feature

  • Keep your story and dialog organized inside text file (js).
  • Might achieve new potential for databasing. Less hard-code inside the editor.
  • Teach you a bit about coding.

Requirement

  • Basic knowledge of how to use plugin.
  • Basic knowledge of using text editor.
  • Difficulty level : Adept

How?
Spoiler: Making the Plugin
Prepare your favorite text editor! We are making the plugin to store your text now! It's WAAAAY too easy that I doubt it could even be called coding.

  • Make an object. Name it whatever you want. It's case sensitive.


  • Store your text inside a key whatever you name it following this format.
    sample_01 for example


  • You are done! Easy peasy, right? Save it as a js file with whatever name you like. Then put it inside yourgame/js/plugins folder.


  • Don't forget to activate it in your plugin manager.


Spoiler: Accessing Your Data
Yes, you may already access it directly through event!

  • The proper way to access it is by using game variables.
    (It's CASE SENSITIVE, but I posted an outdated screenshot)


  • Your variable is now containing your stored text! Let's see it in action using show text~


  • Result :


Spoiler: Control Characters and Escape Code
To write these code, we just have to borrow those that already made.

  • Let's make a quick example


  • Red : Control Characters in show text (\N[ID], \V[ID], etc) shall start with \x1b
    Cyan : To make a new line (enter), write \n
    Purple : To make a new page (window), write \f
    Green : Before writing a single quote ', put a backslash beforehand \
  • Result :


Points to be noted

  • This method open new possibility to access data. With more understanding, you could even organize your own database.
  • It's not just limited to data. You may also create your own function and directly access it.
  • Making an object are not really necessary, but it's RECOMMENDED to avoid polluting the namespace.
  • Since your plugin consist of constants, you may access them using different mean such as local variable, other plugin, etc. Using game variables is the proper way since they are a global variable and saved by the system itself.
  • Escape code are not global. It's only accessable through window message.

What we learn?

  • Making plugin without any knowledge of coding is possible. You just prove it by following this tutorial. To be honest, it's also surprise me.
  • Game variables are flexible since it can store different type of data anytime.
  • \x1b is a code used to read any control characters in window message.

For the last, let me know if there's something you don't understand or what would you like to suggest to improve this tutorial I made.

Thank you ~


本贴来自国际rpgmaker官方论坛作者:Kuro DCupu处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/storing-and-access-text-data-via-plugin.122469/
Storing and Access Text / Data via Plugin-3.jpg
         同一主题附件:
    Storing and Access Text / Data via Plugin-1.jpg
    Storing and Access Text / Data via Plugin-2.jpg
    Storing and Access Text / Data via Plugin-3.jpg
    Storing and Access Text / Data via Plugin-4.jpg
    Storing and Access Text / Data via Plugin-5.jpg
    Storing and Access Text / Data via Plugin-6.jpg
    Storing and Access Text / Data via Plugin-7.jpg
    Storing and Access Text / Data via Plugin-8.jpg
    Storing and Access Text / Data via Plugin-9.jpg
简体中文
繁體中文
English(英语)
日本語(日语)
Deutsch(德语)
Русский язык(俄语)
بالعربية(阿拉伯语)
Türkçe(土耳其语)
Português(葡萄牙语)
ภาษาไทย(泰国语)
한어(朝鲜语/韩语)
Français(法语)
关闭

幸运抽奖

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

立即查看

Loading...

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

GMT+8, 2026-10-3 10:09 , Processed in 0.109394 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部