Text Plugin Doubt

Ok. I've improved on this since last night. I notice MV was cancelling keyboard and wheel events preventing scrolling on the element, so I've commented out one line in the core. I've also added Trihan's command thing, so now you call either call this script by event...
PHP:
loadTXTfile("loremipsum.txt");
or by command
PHP:
loadTXTfile loremipsum.txt
PHP:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === "loadtxtfile") {
            loadTXTfile(args);
        }
    };
var loadTXTfile = function(file){
   if($gamePlayer.canMoveAfterTxt === undefined){
       $gamePlayer.canMoveAfterTxt = $gamePlayer.canMove;
       Input._shouldPreventDefaultAfterTxt = Input._shouldPreventDefault;
   }
   var xhr = new XMLHttpRequest();
   xhr.open("GET", file, true);
   xhr.onreadystatechange = function () {
           if(xhr.readyState === 4 && xhr.responseText.length > 0) {
               removeTXTelement();
               $gamePlayer.canMove = function(){
                   return false;
               };
               Input._shouldPreventDefault = function(){
                   return false;
               };
               // create element
               var div = document.createElement("div");
               // style element
               var css = {
                   width:"420px",
                   maxHeight:"420px",
                   overflow:"auto",
                   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
                   color:"#000",
                   font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
                   position:"fixed",
                   left:"50%",
                   borderRadius:"5px",
                   padding:"15px",
                   border:"3px solid #000",
                   boxShadow:"-3px 3px 50px #000",
                   top:"50%",
                   marginLeft:"-210px",
                   marginTop:"-210px",
                   zIndex:99999
               };
               for(sty in css){
                   div.style[sty] = css[sty];
               }
               div.id = "DOMElementWithText";
               // give the element the text of the text file
               div.innerHTML = xhr.responseText.replace(/\n/g, "<br>");
               document.body.appendChild(div);
               document.getElementById("DOMElementWithText").focus();
               window.addEventListener("keyup", removeTXTelement);
           }
       };
   xhr.send();
};
var txtOpenInAction = false;
var removeTXTelement = function(e){
   var ok = e !== undefined && Input.keyMapper[e.keyCode] === "ok";
   if(ok && !txtOpenInAction){
       txtOpenInAction = true; // prevents from closing right when open 
   } else if(ok && txtOpenInAction){
       txtOpenInAction = false;
       window.removeEventListener("keyup", removeTXTelement);
       $gamePlayer.canMove = $gamePlayer.canMoveAfterTxt;
       Input._shouldPreventDefault = Input._shouldPreventDefaultAfterTxt;
       if(document.getElementById("DOMElementWithText") !== null)
           document.getElementById("DOMElementWithText").parentNode.removeChild(
               document.getElementById("DOMElementWithText")
           );
   }
};
TouchInput._setupEventHandlers = function() {
    document.addEventListener('mousedown', this._onMouseDown.bind(this));
    document.addEventListener('mousemove', this._onMouseMove.bind(this));
    document.addEventListener('mouseup', this._onMouseUp.bind(this));
//  document.addEventListener('wheel', this._onWheel.bind(this));
    document.addEventListener('touchstart', this._onTouchStart.bind(this));
    document.addEventListener('touchmove', this._onTouchMove.bind(this));
    document.addEventListener('touchend', this._onTouchEnd.bind(this));
    document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
    document.addEventListener('pointerdown', this._onPointerDown.bind(this));
};

Wow! I really appreciate what you did! But please tell me exactly how can I use it on my project... I only know how to use .js files... I tried pasting this code in a .js file but nothing... I understand how to call the plugin or "code"... but I don´t understand how to use it! If you could help me with that too I would be very thankful, dude!
It goes in /js/plugins/ then turn on the plugin in MV plugin thing. I think you may have probably already did that part.

Do you have a txt or html file in the game directory named loremipsum.txt? It doesn't have to be named loremipsum, you can name it other thing. That's the name of the text file.

Maybe you could post a screenshot of how you are implementing it?
Ok this is what I did:

1) I pasted the code into a .js file in /js/plugins.
2) I made a .txt file named loremipsum.txt in the root folder of the project.

3L8SakS.png


3) I turned on the plugin and I tried a command call ("loadTXTfile loremipsum.txt")
4) And.... Now it works! haha

623l4LJ.png


Thank you so much for this dude!

Just a final question: How can I have a bigger windows or a bigger font? (Like the one in your .gif)

And is there a way to have color?

Thank you very much in advance!
In the part that says css = {}, you can edit the width and height, and add like
Code:
fontSize: "36px",
or something to make it bigger. You can change the font if you don't like it. The fontFamily goes by web css rules, if 'first font' isn't found, use 'next font' and so on.
In the part that says css = {}, you can edit the width and height, and add like
Code:
fontSize: "36px",
or something to make it bigger. You can change the font if you don't like it. The fontFamily goes by web css rules, if 'first font' isn't found, use 'next font' and so on.

Got it! Thank you sooo much, dude!
Hey it's pretty cool you're translating Case Closed. I used to watch the English dubs on Toonami and Colours.
Hey it's pretty cool you're translating Case Closed. I used to watch the English dubs on Toonami and Colours.

Yeah I watched the English dub and it's really good, but the names sucks! Here we ignored the japan orders and we retained the original japanese names of the characters (in the second dub).

Dude, sorry but I have another question. Is there a way to block the menu access while reading the text? I tried using that command before the "loadTXTfile loremipsum.txt" but afterthat I can´t access the menu, even if I enable the access to the menu. Can I do something to fix that?

394093f1-5a20-429a-9c88-12f011f0c349
jjMsuYm.png
Sorry, if you change the var ok to
PHP:
var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );

or also here is the whole redid plugin with that line added.
Spoiler: this should do the trick
PHP:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === "loadtxtfile") {
            loadTXTfile(args);
        }
    };
var loadTXTfile = function(file){
   if($gamePlayer.canMoveAfterTxt === undefined){
       $gamePlayer.canMoveAfterTxt = $gamePlayer.canMove;
       Input._shouldPreventDefaultAfterTxt = Input._shouldPreventDefault;
   }
   var xhr = new XMLHttpRequest();
   xhr.open("GET", file, true);
   xhr.onreadystatechange = function () {
           if(xhr.readyState === 4 && xhr.responseText.length > 0) {
               removeTXTelement();
               $gamePlayer.canMove = function(){
                   return false;
               };
               Input._shouldPreventDefault = function(){
                   return false;
               };
               // create element
               var div = document.createElement("div");
               // style element
               var css = {
                   width:"420px",
                   maxHeight:"420px",
                   overflow:"auto",
                   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
                   color:"#000",
                   font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
                   position:"fixed",
                   left:"50%",
                   borderRadius:"5px",
                   padding:"15px",
                   border:"3px solid #000",
                   boxShadow:"-3px 3px 50px #000",
                   top:"50%",
                   marginLeft:"-210px",
                   marginTop:"-210px",
                   zIndex:99999
               };
               for(sty in css){
                   div.style[sty] = css[sty];
               }
               div.id = "DOMElementWithText";
               // give the element the text of the text file
               div.innerHTML = xhr.responseText.replace(/\n/g, "<br>");
               document.body.appendChild(div);
               document.getElementById("DOMElementWithText").focus();
               window.addEventListener("keyup", removeTXTelement);
           }
       };
   xhr.send();
};
var txtOpenInAction = false;
var removeTXTelement = function(e){
   var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );
   if(ok && !txtOpenInAction){
       txtOpenInAction = true; // prevents from closing right when open  
   } else if(ok && txtOpenInAction){
       txtOpenInAction = false;
       window.removeEventListener("keyup", removeTXTelement);
       $gamePlayer.canMove = $gamePlayer.canMoveAfterTxt;
       Input._shouldPreventDefault = Input._shouldPreventDefaultAfterTxt;
       if(document.getElementById("DOMElementWithText") !== null)
           document.getElementById("DOMElementWithText").parentNode.removeChild(
               document.getElementById("DOMElementWithText")
           );
   }
};
TouchInput._setupEventHandlers = function() {
    document.addEventListener('mousedown', this._onMouseDown.bind(this));
    document.addEventListener('mousemove', this._onMouseMove.bind(this));
    document.addEventListener('mouseup', this._onMouseUp.bind(this));
//  document.addEventListener('wheel', this._onWheel.bind(this));
    document.addEventListener('touchstart', this._onTouchStart.bind(this));
    document.addEventListener('touchmove', this._onTouchMove.bind(this));
    document.addEventListener('touchend', this._onTouchEnd.bind(this));
    document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
    document.addEventListener('pointerdown', this._onPointerDown.bind(this));
};
Sorry, if you change the var ok to
PHP:
var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );

or also here is the whole redid plugin with that line added.
Spoiler: this should do the trick
PHP:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === "loadtxtfile") {
            loadTXTfile(args);
        }
    };
var loadTXTfile = function(file){
   if($gamePlayer.canMoveAfterTxt === undefined){
       $gamePlayer.canMoveAfterTxt = $gamePlayer.canMove;
       Input._shouldPreventDefaultAfterTxt = Input._shouldPreventDefault;
   }
   var xhr = new XMLHttpRequest();
   xhr.open("GET", file, true);
   xhr.onreadystatechange = function () {
           if(xhr.readyState === 4 && xhr.responseText.length > 0) {
               removeTXTelement();
               $gamePlayer.canMove = function(){
                   return false;
               };
               Input._shouldPreventDefault = function(){
                   return false;
               };
               // create element
               var div = document.createElement("div");
               // style element
               var css = {
                   width:"420px",
                   maxHeight:"420px",
                   overflow:"auto",
                   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
                   color:"#000",
                   font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
                   position:"fixed",
                   left:"50%",
                   borderRadius:"5px",
                   padding:"15px",
                   border:"3px solid #000",
                   boxShadow:"-3px 3px 50px #000",
                   top:"50%",
                   marginLeft:"-210px",
                   marginTop:"-210px",
                   zIndex:99999
               };
               for(sty in css){
                   div.style[sty] = css[sty];
               }
               div.id = "DOMElementWithText";
               // give the element the text of the text file
               div.innerHTML = xhr.responseText.replace(/\n/g, "<br>");
               document.body.appendChild(div);
               document.getElementById("DOMElementWithText").focus();
               window.addEventListener("keyup", removeTXTelement);
           }
       };
   xhr.send();
};
var txtOpenInAction = false;
var removeTXTelement = function(e){
   var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );
   if(ok && !txtOpenInAction){
       txtOpenInAction = true; // prevents from closing right when open 
   } else if(ok && txtOpenInAction){
       txtOpenInAction = false;
       window.removeEventListener("keyup", removeTXTelement);
       $gamePlayer.canMove = $gamePlayer.canMoveAfterTxt;
       Input._shouldPreventDefault = Input._shouldPreventDefaultAfterTxt;
       if(document.getElementById("DOMElementWithText") !== null)
           document.getElementById("DOMElementWithText").parentNode.removeChild(
               document.getElementById("DOMElementWithText")
           );
   }
};
TouchInput._setupEventHandlers = function() {
    document.addEventListener('mousedown', this._onMouseDown.bind(this));
    document.addEventListener('mousemove', this._onMouseMove.bind(this));
    document.addEventListener('mouseup', this._onMouseUp.bind(this));
//  document.addEventListener('wheel', this._onWheel.bind(this));
    document.addEventListener('touchstart', this._onTouchStart.bind(this));
    document.addEventListener('touchmove', this._onTouchMove.bind(this));
    document.addEventListener('touchend', this._onTouchEnd.bind(this));
    document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
    document.addEventListener('pointerdown', this._onPointerDown.bind(this));
};

Mmmm I changed the var in the way you told me, but I still can access the menu.

vPKQYhT.png


Can you check it, please?
Oh. I thought the problem was that the html element was overlapping the menu.

This will temporarily disable the menu.
Spoiler
PHP:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === "loadtxtfile") {
            loadTXTfile(args);
        }
    };
var loadTXTfile = function(file){
   if($gamePlayer.canMoveAfterTxt === undefined){
       $gamePlayer.canMoveAfterTxt = $gamePlayer.canMove;
       Input._shouldPreventDefaultAfterTxt = Input._shouldPreventDefault;
   }
   var xhr = new XMLHttpRequest();
   xhr.open("GET", file, true);
   xhr.onreadystatechange = function () {
           if(xhr.readyState === 4 && xhr.responseText.length > 0) {
               removeTXTelement();
               $gamePlayer.canMove = function(){
                   return false;
               };
               Input._shouldPreventDefault = function(){
                   return false;
               };
               // create element
               var div = document.createElement("div");
               // style element
               var css = {
                   width:"420px",
                   maxHeight:"420px",
                   overflow:"auto",
                   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
                   color:"#000",
                   font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
                   position:"fixed",
                   left:"50%",
                   borderRadius:"5px",
                   padding:"15px",
                   border:"3px solid #000",
                   boxShadow:"-3px 3px 50px #000",
                   top:"50%",
                   marginLeft:"-210px",
                   marginTop:"-210px",
                   zIndex:99999
               };
               for(sty in css){
                   div.style[sty] = css[sty];
               }
               div.id = "DOMElementWithText";
               // give the element the text of the text file
               div.innerHTML = xhr.responseText.replace(/\n/g, "<br>");
               document.body.appendChild(div);
               document.getElementById("DOMElementWithText").focus();
               window.addEventListener("keyup", removeTXTelement);
               Input._isEscapeCompatible = function(){
                   return false;
               }
           }
       };
   xhr.send();
};
Input._isEscapeCompatibleOnAgain = Input._isEscapeCompatible;
var txtOpenInAction = false;
var removeTXTelement = function(e){
   var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );
   if(ok && !txtOpenInAction){
       txtOpenInAction = true; // prevents from closing right when open 
   } else if(ok && txtOpenInAction){
       txtOpenInAction = false;
       window.removeEventListener("keyup", removeTXTelement);
       $gamePlayer.canMove = $gamePlayer.canMoveAfterTxt;
       Input._isEscapeCompatible = Input._isEscapeCompatibleOnAgain;
       Input._shouldPreventDefault = Input._shouldPreventDefaultAfterTxt;
       if(document.getElementById("DOMElementWithText") !== null)
           document.getElementById("DOMElementWithText").parentNode.removeChild(
               document.getElementById("DOMElementWithText")
           );
   }
};
TouchInput._setupEventHandlers = function() {
    document.addEventListener('mousedown', this._onMouseDown.bind(this));
    document.addEventListener('mousemove', this._onMouseMove.bind(this));
    document.addEventListener('mouseup', this._onMouseUp.bind(this));
//  document.addEventListener('wheel', this._onWheel.bind(this));
    document.addEventListener('touchstart', this._onTouchStart.bind(this));
    document.addEventListener('touchmove', this._onTouchMove.bind(this));
    document.addEventListener('touchend', this._onTouchEnd.bind(this));
    document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
    document.addEventListener('pointerdown', this._onPointerDown.bind(this));
};
Oh. I thought the problem was that the html element was overlapping the menu.

This will temporarily disable the menu.
PHP:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === "loadtxtfile") {
            loadTXTfile(args);
        }
    };
var loadTXTfile = function(file){
   if($gamePlayer.canMoveAfterTxt === undefined){
       $gamePlayer.canMoveAfterTxt = $gamePlayer.canMove;
       Input._shouldPreventDefaultAfterTxt = Input._shouldPreventDefault;
   }
   var xhr = new XMLHttpRequest();
   xhr.open("GET", file, true);
   xhr.onreadystatechange = function () {
           if(xhr.readyState === 4 && xhr.responseText.length > 0) {
               removeTXTelement();
               $gamePlayer.canMove = function(){
                   return false;
               };
               Input._shouldPreventDefault = function(){
                   return false;
               };
               // create element
               var div = document.createElement("div");
               // style element
               var css = {
                   width:"420px",
                   maxHeight:"420px",
                   overflow:"auto",
                   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
                   color:"#000",
                   font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
                   position:"fixed",
                   left:"50%",
                   borderRadius:"5px",
                   padding:"15px",
                   border:"3px solid #000",
                   boxShadow:"-3px 3px 50px #000",
                   top:"50%",
                   marginLeft:"-210px",
                   marginTop:"-210px",
                   zIndex:99999
               };
               for(sty in css){
                   div.style[sty] = css[sty];
               }
               div.id = "DOMElementWithText";
               // give the element the text of the text file
               div.innerHTML = xhr.responseText.replace(/\n/g, "<br>");
               document.body.appendChild(div);
               document.getElementById("DOMElementWithText").focus();
               window.addEventListener("keyup", removeTXTelement);
               Input._isEscapeCompatible = function(){
                   return false;
               }
           }
       };
   xhr.send();
};
Input._isEscapeCompatibleOnAgain = Input._isEscapeCompatible;
var txtOpenInAction = false;
var removeTXTelement = function(e){
   var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );
   if(ok && !txtOpenInAction){
       txtOpenInAction = true; // prevents from closing right when open 
   } else if(ok && txtOpenInAction){
       txtOpenInAction = false;
       window.removeEventListener("keyup", removeTXTelement);
       $gamePlayer.canMove = $gamePlayer.canMoveAfterTxt;
       Input._isEscapeCompatible = Input._isEscapeCompatibleOnAgain;
       Input._shouldPreventDefault = Input._shouldPreventDefaultAfterTxt;
       if(document.getElementById("DOMElementWithText") !== null)
           document.getElementById("DOMElementWithText").parentNode.removeChild(
               document.getElementById("DOMElementWithText")
           );
   }
};
TouchInput._setupEventHandlers = function() {
    document.addEventListener('mousedown', this._onMouseDown.bind(this));
    document.addEventListener('mousemove', this._onMouseMove.bind(this));
    document.addEventListener('mouseup', this._onMouseUp.bind(this));
//  document.addEventListener('wheel', this._onWheel.bind(this));
    document.addEventListener('touchstart', this._onTouchStart.bind(this));
    document.addEventListener('touchmove', this._onTouchMove.bind(this));
    document.addEventListener('touchend', this._onTouchEnd.bind(this));
    document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
    document.addEventListener('pointerdown', this._onPointerDown.bind(this));
};

Dude, sorry to bother you but I still can access the menu (LOL)

9cf5b091-5c79-4882-82b9-867a148977ba
jyPWUCh.png


Another idea?
why don't you simply use the event command to temporarily disable menu access before the display, and reenable it later?
No need for a script solution on something like that.
@Andar
No this is my mistake. He could Change Menu Access, but there is no way to intuitively reactivate it when closing the book because it's not a game message.

My fault.

@shinichi999 That's a good looking background too.

Replace the entire plugin with this. I will tweak this until it works.
Spoiler
PHP:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === "loadtxtfile") {
            loadTXTfile(args);
        }
    };
var loadTXTfile = function(file){
   if($gamePlayer.canMoveAfterTxt === undefined){
       $gamePlayer.canMoveAfterTxt = $gamePlayer.canMove;
       Input._shouldPreventDefaultAfterTxt = Input._shouldPreventDefault;
   }
   var xhr = new XMLHttpRequest();
   xhr.open("GET", file, true);
   xhr.onreadystatechange = function () {
           if(xhr.readyState === 4 && xhr.responseText.length > 0) {
               removeTXTelement();
               $gamePlayer.canMove = function(){
                   return false;
               };
               Input._shouldPreventDefault = function(){
                   return false;
               };
               // create element
               var div = document.createElement("div");
               // style element
               var css = {
                   width:"420px",
                   maxHeight:"420px",
                   overflow:"auto",
                   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
                   color:"#000",
                   font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
                   position:"fixed",
                   left:"50%",
                   borderRadius:"5px",
                   padding:"15px",
                   border:"3px solid #000",
                   boxShadow:"-3px 3px 50px #000",
                   top:"50%",
                   marginLeft:"-210px",
                   marginTop:"-210px",
                   zIndex:99999
               };
               for(sty in css){
                   div.style[sty] = css[sty];
               }
               div.id = "DOMElementWithText";
               // give the element the text of the text file
               div.innerHTML = xhr.responseText.replace(/\n/g, "<br>");
               document.body.appendChild(div);
               document.getElementById("DOMElementWithText").focus();
               window.addEventListener("keyup", removeTXTelement);
               Input._isEscapeCompatible = function(){
                   return false;
               }
           }
       };
   xhr.send();
};
Input._isEscapeCompatibleOnAgain = Input._isEscapeCompatible;
var txtOpenInAction = false;
var removeTXTelement = function(e){
   var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );
   if(ok && !txtOpenInAction){
       txtOpenInAction = true; // prevents from closing right when open
   } else if(ok && txtOpenInAction){
       txtOpenInAction = false;
       window.removeEventListener("keyup", removeTXTelement);
       $gamePlayer.canMove = $gamePlayer.canMoveAfterTxt;
       Input._isEscapeCompatible = Input._isEscapeCompatibleOnAgain;
       Input._shouldPreventDefault = Input._shouldPreventDefaultAfterTxt;
       if(document.getElementById("DOMElementWithText") !== null)
           document.getElementById("DOMElementWithText").parentNode.removeChild(
               document.getElementById("DOMElementWithText")
           );
   }
};
Scene_Map.prototype.callMenu = function() {
   if(document.getElementById("DOMElementWithText") !== null)
       return;
    SoundManager.playOk();
    SceneManager.push(Scene_Menu);
    Window_MenuCommand.initCommandPosition();
    $gameTemp.clearDestination();
    this._mapNameWindow.hide();
    this._waitCount = 2;
};
TouchInput._setupEventHandlers = function() {
    document.addEventListener('mousedown', this._onMouseDown.bind(this));
    document.addEventListener('mousemove', this._onMouseMove.bind(this));
    document.addEventListener('mouseup', this._onMouseUp.bind(this));
//  document.addEventListener('wheel', this._onWheel.bind(this));
    document.addEventListener('touchstart', this._onTouchStart.bind(this));
    document.addEventListener('touchmove', this._onTouchMove.bind(this));
    document.addEventListener('touchend', this._onTouchEnd.bind(this));
    document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
    document.addEventListener('pointerdown', this._onPointerDown.bind(this));
};

I should also add that it doesn't have to be named loremipsum.txt, you can have like another_book.txt and call the command
PHP:
loadTXTfile another_book.txt
for more than one book.
@Andar
No this is my mistake. He could Change Menu Access, but there is no way to intuitively reactivate it when closing the book because it's not a game message.

My fault.

@shinichi999 That's a good looking background too.

Replace the entire plugin with this. I will tweak this until it works.
PHP:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === "loadtxtfile") {
            loadTXTfile(args);
        }
    };
var loadTXTfile = function(file){
   if($gamePlayer.canMoveAfterTxt === undefined){
       $gamePlayer.canMoveAfterTxt = $gamePlayer.canMove;
       Input._shouldPreventDefaultAfterTxt = Input._shouldPreventDefault;
   }
   var xhr = new XMLHttpRequest();
   xhr.open("GET", file, true);
   xhr.onreadystatechange = function () {
           if(xhr.readyState === 4 && xhr.responseText.length > 0) {
               removeTXTelement();
               $gamePlayer.canMove = function(){
                   return false;
               };
               Input._shouldPreventDefault = function(){
                   return false;
               };
               // create element
               var div = document.createElement("div");
               // style element
               var css = {
                   width:"420px",
                   maxHeight:"420px",
                   overflow:"auto",
                   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
                   color:"#000",
                   font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
                   position:"fixed",
                   left:"50%",
                   borderRadius:"5px",
                   padding:"15px",
                   border:"3px solid #000",
                   boxShadow:"-3px 3px 50px #000",
                   top:"50%",
                   marginLeft:"-210px",
                   marginTop:"-210px",
                   zIndex:99999
               };
               for(sty in css){
                   div.style[sty] = css[sty];
               }
               div.id = "DOMElementWithText";
               // give the element the text of the text file
               div.innerHTML = xhr.responseText.replace(/\n/g, "<br>");
               document.body.appendChild(div);
               document.getElementById("DOMElementWithText").focus();
               window.addEventListener("keyup", removeTXTelement);
               Input._isEscapeCompatible = function(){
                   return false;
               }
           }
       };
   xhr.send();
};
Input._isEscapeCompatibleOnAgain = Input._isEscapeCompatible;
var txtOpenInAction = false;
var removeTXTelement = function(e){
   var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );
   if(ok && !txtOpenInAction){
       txtOpenInAction = true; // prevents from closing right when open
   } else if(ok && txtOpenInAction){
       txtOpenInAction = false;
       window.removeEventListener("keyup", removeTXTelement);
       $gamePlayer.canMove = $gamePlayer.canMoveAfterTxt;
       Input._isEscapeCompatible = Input._isEscapeCompatibleOnAgain;
       Input._shouldPreventDefault = Input._shouldPreventDefaultAfterTxt;
       if(document.getElementById("DOMElementWithText") !== null)
           document.getElementById("DOMElementWithText").parentNode.removeChild(
               document.getElementById("DOMElementWithText")
           );
   }
};
Scene_Map.prototype.callMenu = function() {
   if(document.getElementById("DOMElementWithText") !== null)
       return;
    SoundManager.playOk();
    SceneManager.push(Scene_Menu);
    Window_MenuCommand.initCommandPosition();
    $gameTemp.clearDestination();
    this._mapNameWindow.hide();
    this._waitCount = 2;
};
TouchInput._setupEventHandlers = function() {
    document.addEventListener('mousedown', this._onMouseDown.bind(this));
    document.addEventListener('mousemove', this._onMouseMove.bind(this));
    document.addEventListener('mouseup', this._onMouseUp.bind(this));
//  document.addEventListener('wheel', this._onWheel.bind(this));
    document.addEventListener('touchstart', this._onTouchStart.bind(this));
    document.addEventListener('touchmove', this._onTouchMove.bind(this));
    document.addEventListener('touchend', this._onTouchEnd.bind(this));
    document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
    document.addEventListener('pointerdown', this._onPointerDown.bind(this));
};

I should also add that it doesn't have to be named loremipsum.txt, you can have like another_book.txt and call the command
PHP:
loadTXTfile another_book.txt
for more than one book.

Thanks for your patience, dude! I tried with many backgrounds until I found a good one. And yes, then I'll change the name of the .txt.

Now if I press the menu button, the book just closes and then show me the menu, instead of being on top of everything. Not bad... but is there a way to block it and activate it again when you close the book?
Oh. I'm sorry. I just needed to rethink my tactics. This should block the updateCallMenu instead of the actual callMenu. It appears the latter will keep trying until its conditions are met. This one should work this time.
PHP:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === "loadtxtfile") {
            loadTXTfile(args);
        }
    };
var loadTXTfile = function(file){
   if($gamePlayer.canMoveAfterTxt === undefined){
       $gamePlayer.canMoveAfterTxt = $gamePlayer.canMove;
       Input._shouldPreventDefaultAfterTxt = Input._shouldPreventDefault;
   }
   var xhr = new XMLHttpRequest();
   xhr.open("GET", file, true);
   xhr.onreadystatechange = function () {
           if(xhr.readyState === 4 && xhr.responseText.length > 0) {
               removeTXTelement();
               $gamePlayer.canMove = function(){
                   return false;
               };
               Input._shouldPreventDefault = function(){
                   return false;
               };
               // create element
               var div = document.createElement("div");
               // style element
               var css = {
                   width:"420px",
                   maxHeight:"420px",
                   overflow:"auto",
                   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
                   color:"#000",
                   font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
                   position:"fixed",
                   left:"50%",
                   borderRadius:"5px",
                   padding:"15px",
                   border:"3px solid #000",
                   boxShadow:"-3px 3px 50px #000",
                   top:"50%",
                   marginLeft:"-210px",
                   marginTop:"-210px",
                   zIndex:99999
               };
               for(sty in css){
                   div.style[sty] = css[sty];
               }
               div.id = "DOMElementWithText";
               // give the element the text of the text file
               div.innerHTML = xhr.responseText.replace(/\n/g, "<br>");
               document.body.appendChild(div);
               document.getElementById("DOMElementWithText").focus();
               window.addEventListener("keyup", removeTXTelement);
               Input._isEscapeCompatible = function(){
                   return false;
               }
           }
       };
   xhr.send();
};
Input._isEscapeCompatibleOnAgain = Input._isEscapeCompatible;
var txtOpenInAction = false;
var removeTXTelement = function(e){
   var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );
   if(ok && !txtOpenInAction){
       txtOpenInAction = true; // prevents from closing right when open 
   } else if(ok && txtOpenInAction){
       txtOpenInAction = false;
       window.removeEventListener("keyup", removeTXTelement);
       $gamePlayer.canMove = $gamePlayer.canMoveAfterTxt;
       Input._isEscapeCompatible = Input._isEscapeCompatibleOnAgain;
       Input._shouldPreventDefault = Input._shouldPreventDefaultAfterTxt;
       if(document.getElementById("DOMElementWithText") !== null)
           document.getElementById("DOMElementWithText").parentNode.removeChild(
               document.getElementById("DOMElementWithText")
           );
   }
};
Scene_Map.prototype.updateCallMenu = function() {
    if (this.isMenuEnabled() && (document.getElementById("DOMElementWithText") === null)) {
        if (this.isMenuCalled()) {
            this.menuCalling = true;
        }
        if (this.menuCalling && !$gamePlayer.isMoving()) {
            this.callMenu();
        }
    } else {
        this.menuCalling = false;
    }
};
TouchInput._setupEventHandlers = function() {
    document.addEventListener('mousedown', this._onMouseDown.bind(this));
    document.addEventListener('mousemove', this._onMouseMove.bind(this));
    document.addEventListener('mouseup', this._onMouseUp.bind(this));
//  document.addEventListener('wheel', this._onWheel.bind(this));
    document.addEventListener('touchstart', this._onTouchStart.bind(this));
    document.addEventListener('touchmove', this._onTouchMove.bind(this));
    document.addEventListener('touchend', this._onTouchEnd.bind(this));
    document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
    document.addEventListener('pointerdown', this._onPointerDown.bind(this));
};
Oh. I'm sorry. I just needed to rethink my tactics. This should block the updateCallMenu instead of the actual callMenu. It appears the latter will keep trying until its conditions are met. This one should work this time.
PHP:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === "loadtxtfile") {
            loadTXTfile(args);
        }
    };
var loadTXTfile = function(file){
   if($gamePlayer.canMoveAfterTxt === undefined){
       $gamePlayer.canMoveAfterTxt = $gamePlayer.canMove;
       Input._shouldPreventDefaultAfterTxt = Input._shouldPreventDefault;
   }
   var xhr = new XMLHttpRequest();
   xhr.open("GET", file, true);
   xhr.onreadystatechange = function () {
           if(xhr.readyState === 4 && xhr.responseText.length > 0) {
               removeTXTelement();
               $gamePlayer.canMove = function(){
                   return false;
               };
               Input._shouldPreventDefault = function(){
                   return false;
               };
               // create element
               var div = document.createElement("div");
               // style element
               var css = {
                   width:"420px",
                   maxHeight:"420px",
                   overflow:"auto",
                   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
                   color:"#000",
                   font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
                   position:"fixed",
                   left:"50%",
                   borderRadius:"5px",
                   padding:"15px",
                   border:"3px solid #000",
                   boxShadow:"-3px 3px 50px #000",
                   top:"50%",
                   marginLeft:"-210px",
                   marginTop:"-210px",
                   zIndex:99999
               };
               for(sty in css){
                   div.style[sty] = css[sty];
               }
               div.id = "DOMElementWithText";
               // give the element the text of the text file
               div.innerHTML = xhr.responseText.replace(/\n/g, "<br>");
               document.body.appendChild(div);
               document.getElementById("DOMElementWithText").focus();
               window.addEventListener("keyup", removeTXTelement);
               Input._isEscapeCompatible = function(){
                   return false;
               }
           }
       };
   xhr.send();
};
Input._isEscapeCompatibleOnAgain = Input._isEscapeCompatible;
var txtOpenInAction = false;
var removeTXTelement = function(e){
   var ok = e !== undefined &&
   (
       Input.keyMapper[e.keyCode] === "ok"     ||
       Input.keyMapper[e.keyCode] === "escape"
   );
   if(ok && !txtOpenInAction){
       txtOpenInAction = true; // prevents from closing right when open
   } else if(ok && txtOpenInAction){
       txtOpenInAction = false;
       window.removeEventListener("keyup", removeTXTelement);
       $gamePlayer.canMove = $gamePlayer.canMoveAfterTxt;
       Input._isEscapeCompatible = Input._isEscapeCompatibleOnAgain;
       Input._shouldPreventDefault = Input._shouldPreventDefaultAfterTxt;
       if(document.getElementById("DOMElementWithText") !== null)
           document.getElementById("DOMElementWithText").parentNode.removeChild(
               document.getElementById("DOMElementWithText")
           );
   }
};
Scene_Map.prototype.updateCallMenu = function() {
    if (this.isMenuEnabled() && (document.getElementById("DOMElementWithText") === null)) {
        if (this.isMenuCalled()) {
            this.menuCalling = true;
        }
        if (this.menuCalling && !$gamePlayer.isMoving()) {
            this.callMenu();
        }
    } else {
        this.menuCalling = false;
    }
};
TouchInput._setupEventHandlers = function() {
    document.addEventListener('mousedown', this._onMouseDown.bind(this));
    document.addEventListener('mousemove', this._onMouseMove.bind(this));
    document.addEventListener('mouseup', this._onMouseUp.bind(this));
//  document.addEventListener('wheel', this._onWheel.bind(this));
    document.addEventListener('touchstart', this._onTouchStart.bind(this));
    document.addEventListener('touchmove', this._onTouchMove.bind(this));
    document.addEventListener('touchend', this._onTouchEnd.bind(this));
    document.addEventListener('touchcancel', this._onTouchCancel.bind(this));
    document.addEventListener('pointerdown', this._onPointerDown.bind(this));
};

No changes, dude. It's still happening the same; if I press the menu button, the book just closes and then show me the menu.

But at least the menu it's not now on top of everything.

Do you have another idea? If not, I cant just let it that way, I don`t want to keep bothering you jeje
Odd. This version works for me.

Are you using any other plugins? Please tell me which, if any. I might need to look at conflicts.

I know for one, I posted about 4 or 5 versions of the same plugin with slight changes, so you should only have one of this plugin. Is there a second old version still activated?

I notice your editor is in Espanol. I wonder if there is a different translation for the cancel button?

Can you open rpg_core.js and search for Input.keyMapper. Does it look like this?
PHP:
Input.keyMapper = {
    9: 'tab',       // tab
    13: 'ok',       // enter
    16: 'shift',    // shift
    17: 'control',  // control
    18: 'control',  // alt
    27: 'escape',   // escape
    32: 'ok',       // space
    33: 'pageup',   // pageup
    34: 'pagedown', // pagedown
    37: 'left',     // left arrow
    38: 'up',       // up arrow
    39: 'right',    // right arrow
    40: 'down',     // down arrow
    45: 'escape',   // insert
    81: 'pageup',   // Q
    87: 'pagedown', // W
    88: 'escape',   // X
    90: 'ok',       // Z
    96: 'escape',   // numpad 0
    98: 'down',     // numpad 2
    100: 'left',    // numpad 4
    102: 'right',   // numpad 6
    104: 'up',      // numpad 8
    120: 'debug'    // F9
};
Odd. This version works for me.

Are you using any other plugins? Please tell me which, if any. I might need to look at conflicts.

I know for one, I posted about 4 or 5 versions of the same plugin with slight changes, so you should only have one of this plugin. Is there a second old version still activated?

I notice your editor is in Espanol. I wonder if there is a different translation for the cancel button?

Can you open rpg_core.js and search for Input.keyMapper. Does it look like this?
PHP:
Input.keyMapper = {
    9: 'tab',       // tab
    13: 'ok',       // enter
    16: 'shift',    // shift
    17: 'control',  // control
    18: 'control',  // alt
    27: 'escape',   // escape
    32: 'ok',       // space
    33: 'pageup',   // pageup
    34: 'pagedown', // pagedown
    37: 'left',     // left arrow
    38: 'up',       // up arrow
    39: 'right',    // right arrow
    40: 'down',     // down arrow
    45: 'escape',   // insert
    81: 'pageup',   // Q
    87: 'pagedown', // W
    88: 'escape',   // X
    90: 'ok',       // Z
    96: 'escape',   // numpad 0
    98: 'down',     // numpad 2
    100: 'left',    // numpad 4
    102: 'right',   // numpad 6
    104: 'up',      // numpad 8
    120: 'debug'    // F9
};

Yep my native language is spanish, so I have the program in spanish, but the internal code is still in english. Take a look:

kei3rVJ.png


Dude, I reset the program and it`s working now! haha

Thank you soooo much! You really saved my life!
Awesome!

I have to reset the program too sometimes; I don't know why.

And I think I just learned something about computers and English just now. As I only speak English, I take for granted that I can web design without having to learn two languages.
Awesome!

I have to reset the program too sometimes; I don't know why.

And I think I just learned something about computers and English just now. As I only speak English, I take for granted that I can web design without having to learn two languages.

Haha yeah... on this side of the world we need to know English, besides our native language.

Dude, sorry I have another question haha... how can I change the font?

I tried changing the name of the font in this line: "font:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',"

But nothing happend. What should I do?

Original thread: https://forums.rpgmakerweb.com/threads/text-plugin-doubt.75590/