Loading dialouge lines from text file?

As title of this topic says I want to use external text files to store dialouge lines for my heroes and NPCs instead
using default Show Text... event. And I've already made it working so no technical issues here, but my question is

How much this would cause potential issues with game?

And here it is I've made:

First I made a js file containing following functions:
Code:
/* obtain text from a file */
readTextFile = function(filename)
{
    var xhr = new XMLHttpRequest();
    xhr.open("GET",filename,false);
    xhr.send(null);
    var fileContent = xhr.responseText;
    return fileContent;
}
/* split it into array by new line */
splitMessage = function(txt){
    var source = txt.split("\n");
    return source;
}

/* display that line in game */
SayMessage = function(actorFace, faceIndex, type, pos, dialougeFile, lineNum){
   
    var msg = readTextFile('./data/dialouges/'+dialougeFile);
    var line = splitMessage(msg);
   
    $gameMessage.setFaceImage(actorFace, faceIndex);
    $gameMessage.setBackground(type);
    $gameMessage.setPositionType(pos);
    $gameMessage.add(line[lineNum]);
   
}

And in event editor instead using Show Text event i just call script (function) SayMessage(); Like This

I decided to use that method to use dialouges because everyone who played demo tells the same - Dialouges needs to be improved (grammatic errors / mistakes) since my english is a little bit rusty and twisted by watching anime with fan-made subtitles.
As long as you preload the files properly, it should cause no issues whatsoever. Otherwise it can cause issues that arise from not loaded files, likely a crash.
That's one point, especialy in readTextFile() function - I didn't put exception handler.
put all lines into one file, make sure it loads at the beginning of the game, and pull all lines from that loaded file which would essentially be a hatch or an array.

I do that, except not from an external file, my library is coded into the game's code and each line is tied to an actor, so I only send the actor's name and the dialog manager pulls it's face, name, and color.
These functions do that. Text file contains dialouges with mv tags such as color \c[x] and game renders text in desired colors etc. Also tags from yanflys message plugins are rendered.
Sorry, a bit unrelated to your concerns.
From what I understand the code you've provided is a script call placed inside the game?
Could you provide the dialogue file too? I would really like to test this thing of yours 🙂 Haven't found any decent easy to use plugins, that would do the same thing yet 🙁

@KotoYama, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/loading-dialouge-lines-from-text-file.116107/