Storing and Access Text / Data via Plugin

Kuro DCupu

Trust me, I'm a veteran RMer
Veteran
Joined
Jul 6, 2014
Messages
446
Reaction score
1,402
First Language
Indonesia
Primarily Uses
RMMV
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?
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.
  1. Make an object. Name it whatever you want. It's case sensitive.
    1591707077716.png
  2. Store your text inside a key whatever you name it following this format.
    sample_01 for example
    1591707116001.png
  3. 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.
    1591343998425.png
  4. Don't forget to activate it in your plugin manager.
    1591344053802.png
Yes, you may already access it directly through event!
  1. The proper way to access it is by using game variables.
    (It's CASE SENSITIVE, but I posted an outdated screenshot)
    1591344270875.png
  2. Your variable is now containing your stored text! Let's see it in action using show text~
    1591344385451.png
  3. Result :
    1591344412933.png
To write these code, we just have to borrow those that already made.
  1. Let's make a quick example
    1591707885446.png
  2. 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 \
  3. Result :
    text example.gif

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 ~
 
Last edited:

Kuro DCupu

Trust me, I'm a veteran RMer
Veteran
Joined
Jul 6, 2014
Messages
446
Reaction score
1,402
First Language
Indonesia
Primarily Uses
RMMV
Updated the tutorial!

Also would like to inform that what I've done before (putting code inside a self function) is a method called IIFE. Thanks to @TheoAllen who informed me.

CMIIW, IIFE is mainly used to isolate your code so it cannot be modified from outside.
In this case it's not necessary cause we just use it to store and access data.
I guess blindly copy and learn from other plugin are not enough without proper understanding.

Anyway, the tutorial is much easier now that it scares me.
Perhaps I will post using plugin for databasing next if any interested.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How do you cure sleep problem? It has been 7 months and it's 3 AM now..
Darn you, Seals! Why do you gotta be so cute when on land?:kaoluv:
So dragonbones getting laggy xD
I even removed the fingers armatures.

Have to remake this guy after crashing ( corrupted file).
:rtear:

Although limited to only this shop for room decorations, I like this aspect for previewing items.
So yesterday I got a follower (follow my NSFW art account) who dmed me and said to me :
if you continue to be friends with [name of the artists] which make me uncomfortable I will have to unfollow and I am like :
... do it?

Forum statistics

Threads
100,837
Messages
980,117
Members
132,486
Latest member
Quasar_king
Top