Some time ago I wrote a plugin that allows me to load text from external text-file, but now I want to improve it a little more by reading specific range of lines, take a look at fragment of scenario file how it looks like, it's written in specific format:
ActorName:
Dialog to show, max 5 lines
So I wanted to ask does node.js in default form - provided as is with MV can handle such request, or do I have to install some extra libraries?
This is code that loads entire text.
Of course I could adjust line breaks within text file to number of rows in message window and use Batch Entry function in MV editor like this
But that will block me possibility to add other actions between line dialouges, making just static text exposition, witch is I want to avoid.
Ok so be more precise I want to load a range of lines from txt file
ActorName:
Dialog to show, max 5 lines
Code:
/*** Interlude ***/
Tallanar:
Where have you been!? I've been calling for you for five
minutes and you not showed up!
Soulrender:
What's it been, five minutes? What'd you expect, you call
and get instant God?
Tallanar:
Well, something like that...
Soulrender:
Me not coming is going to happen a lot. My responsibilities
extend to all of this cursed island... Where is Telthos?
Tallanar:
He got up early and left. I don't know where he went or when
he'll be back. And frankly, I don't care.
Soulrender:
Okay... There's a story in here somewhere.
Tallanar:
He did something stupid...
Soulrender:
Great! I love it. Tell me.
Tallanar:
He was attacked by four men and instead of
calling for help, he almost gets killed.
Soulrender:
Almost? What a pity. Oh, nothing against Telthos, it's just that, um...
stories are always better when someone gets killed.
So I wanted to ask does node.js in default form - provided as is with MV can handle such request, or do I have to install some extra libraries?
This is code that loads entire text.
JavaScript:
Dialog.prototype.readFile = function(filename){
var xhr = new XMLHttpRequest();
xhr.async = false;
try{
xhr.open("GET", filename, false);
xhr.send(null);
var fileContent = xhr.responseText;
return fileContent;
}catch(e){
console.log(e.stack);
}
Dialog.prototype.getDialouge = function(sourceFile, index){
var src = "../data/proto/dialouges/map%1/%2_%3.txt".format($gameMap._mapId.padZero(4), sourceFile, index.padZero(4));
var data = this.readFile(src);
return data;
}
}
Of course I could adjust line breaks within text file to number of rows in message window and use Batch Entry function in MV editor like this
But that will block me possibility to add other actions between line dialouges, making just static text exposition, witch is I want to avoid.
Ok so be more precise I want to load a range of lines from txt file