Some time ago I wrote procedural plugin to read dialouges from
external txt file and plugin works fine and this is what I wanted to achieve, but
as I said, it's procedural plugin, not object oriented, therefore in order to use it
inside RMMV without any issues I have to use it in this way.
So my question is, inside wich class I should put my functions and methods in order to
place this.setWaitMode(mode) to avoid using it inside "Script..." event?
I'm giving you code to have a better look:
external txt file and plugin works fine and this is what I wanted to achieve, but
as I said, it's procedural plugin, not object oriented, therefore in order to use it
inside RMMV without any issues I have to use it in this way.
So my question is, inside wich class I should put my functions and methods in order to
place this.setWaitMode(mode) to avoid using it inside "Script..." event?
I'm giving you code to have a better look:
Code:
ReadFile = function(filename)
{
var xhr = new XMLHttpRequest();
xhr.async = false;
xhr.open("GET",filename,false)
xhr.send(null);
var fileContent = xhr.responseText;
return fileContent;
}
Explode = function(txt, delim){
var source = txt.split(delim);
if (source){
return source;
}
else return false;
}
DisplayText = function(source, line){
const path = "./dialouges/";
var data = ReadFile(path + source + ".txt");
var handle = Explode(data, "\n");
var line = Explode(handle[line], "|");
$gameMessage.clear();
var speech = "<WordWrap>\\hc[ffbd38]" + line[4] + ": \\hc[ffffff]<br>" + line[5];
if(!$gameMessage.isBusy()){
if (data[0]){
$gameMessage.setFaceImage(line[3], Number(line[2]));
}
$gameMessage.setPositionType(Number(line[0]));
$gameMessage.setBackground(Number(line[1]));
$gameMessage.add(speech);
//this.setWaitMode('message'); //Should be here!
}
}