Is this a good way to handle external text?

I know there's already a nice plugin for external text reading, but it didn't click with me for a variety of reasons. I'm currently using a different method for handling external text, and while it works, at the same time it feels kinda iffy.


For my dialogues, I just made a JS plugin with an array for every cutscene, like this:


Cutscene1 = ["This is the first message", "This is the second!", "And this is the third"]


I then show the dialogues by cycling through the array with a for loop, assigning each value of the array to a variable and then displaying it with \v[x].


I know JS plugins aren't really supposed to be used like this. Do you think handling text this way instead of using a .JSON file will cause me troubles on the long run? I already made stress tests, loading my JS plugin with a book's worth of text, and loading times were fine.


It works too well to be true. What's the catch?
It's funny - when I read your topic title, I immediately thought of a game I looked into translating, and it's pretty close to how it handles it (except the game in question also has a pile of handlers for displaying images, changing maps, etc.). Seems to me like it's a pretty good way to do things.


As for the catch - no catch! JSON (JavaScript Object Notation - kind of similar to an array, but can be a lot more complex) is an amazing way to move data. The software I use at work uses it to send data between a server and client application. The only kind of slowdown for yours I could see is if it loads all the text data on initial load, it may delay the startup of the game. But, that's the only time it should be expected to be slow. It may chew into RAM a little, but plain text is generally quite small.
May I ask what about the plugin didn't work for you? I'm sure there's a way I could simplify the setup, it is rather tedious. 
@Zalerinian You may have misread - they're asking if it's a good way to handle external text.
@Zalerinian You may have misread - they're asking if it's a good way to handle external text.



So I have.

What's the catch?



Well as far as I know, there are a couple. First, it can be a little tedious to set up each text key honestly. There's options for setting up all the types of windows that could come with a message, like choices, number input, item input, etc. Technically it would allow you to have more than 6 choices that the engine imposes, however checking the selected choice therefore involves using variables to check a number, so it gets a little more complicated than with the default engine. If I recall correctly, with item selection it'd store the item ID instead of a choice number that you'd then need to check, so it's a bit less obvious what you're branching at when you do it this way.


Additionally, if I recall, the version available doesn't wrap text that exceeds the length of the window. I guess I never released an update for the plugin, because I have code on my computer that does that, but according to some people I've talked to, it's not in the version available.


Finally, though less of an issue and more of a detail, people would be able to open the file and see all the text, as it is, in essence, just a text file.


I'm sure there are many improvements I could do with the plugin at this point, it's quite close to a year old now I believe. Let me know if you have ideas for improvements, or any way to make using it simpler. I'm considering removing most of the options with the windows and just having people use the \t[key] text code for the message, because doing it the way it's working now leaves more room for error for a feature I'm not exactly sure anyone uses: being able to use a script call to bring up the text message. The only real benefit to that is it would be theoretically possible to change the text code used, but conditional branches could also be used to achieve similar results, so... It just seems unnecessary.
It's funny - when I read your topic title, I immediately thought of a game I looked into translating, and it's pretty close to how it handles it (except the game in question also has a pile of handlers for displaying images, changing maps, etc.). Seems to me like it's a pretty good way to do things.

Nice to know, thanks!

May I ask what about the plugin didn't work for you? I'm sure there's a way I could simplify the setup, it is rather tedious. 

Oh, don't worry! Your plugin is very nice, it's just not really suited for my project. See, my game is basically a visual novel, and I'm using Twine for writing the dialogues - by using a plugin instead of a .JSON file, I can easily copy/paste the text from Twine without worring about whitespacing. There are downsides like the lack of word wrapping, as you said, but I'm finding this way more comfortable to work with.

I'm sure there are many improvements I could do with the plugin at this point, it's quite close to a year old now I believe. Let me know if you have ideas for improvements, or any way to make using it simpler.

One big improvement could be adding a way to store text into arrays, instead of calling each block of text individually. I know you can write a very long text and use /f to spit it into different windows - but with using this method, it's impossible to change faces, adding pictures between dialogues etc. By using an array, I can simply cycle through its content and easily add pictures/sounds/etc whenever a certain point is reached.


(I hope I have explained myself properly, English is not my native language >< sorry)
I think there is either a plugin or part of a plugin that will handle word wrapping... but I don't know which it is!
Yanfly Message Core adds in word-wrapping.

Original thread: https://forums.rpgmakerweb.com/threads/is-this-a-good-way-to-handle-external-text.68940/