Text Plugin Doubt

What font do you want to use?

Here is a list of web safe fonts that don't typically need a web font.
https://www.w3schools.com/cssref/css_websafe_fonts.asp


It has to be on a web safe font, or else I can also make you a web font. The latter will need a special conversion/css-declaration, and you'll need to keep the font in the game folder somewhere.

This can convert regular fonts into web-fonts.
https://www.fontsquirrel.com/tools/webfont-generator
What font do you want to use?

Here is a list of web safe fonts that don't typically need a web font.
https://www.w3schools.com/cssref/css_websafe_fonts.asp


It has to be on a web safe font, or else I can also make you a web font. The latter will need a special conversion/css-declaration, and you'll need to keep the font in the game folder somewhere.

This can convert regular fonts into web-fonts.
https://www.fontsquirrel.com/tools/webfont-generator

I'd like to use a literary font, something like "Lucida Console", or any that you could recommend me for that purpose (Book font).

Can you please do it for me? I didn´t understand very well what I have to do.
Lucida Console is web safe. You can back it up with monospace fonts just in case according to this. I don't think I was using font correctly. It's kind of a broad and it takes more things than font name like size and color, so I changed it to fontFamily. I also added fontSize that you can change if you want it bigger.
PHP:
var css = {
   fontFamily:'"Lucida Console", Monaco, monospace',
   fontSize:"18px",
   width:"420px",
   maxHeight:"420px",
   overflow:"auto",
   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
   color:"#000",
   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
};
Font names with spaces go in double quotes and I wrap the css line in single quotes because it's also in a javascript object.
This is Lucida Console, correct?
Screen%20Shot%202017-03-22%20at%202.43.58%20PM.png
Lucida Console is web safe. You can back it up with monospace fonts just in case according to this. I don't think I was using font correctly. It's kind of a broad and it takes more things than font name like size and color, so I changed it to fontFamily. I also added fontSize that you can change if you want it bigger.
PHP:
var css = {
   fontFamily:'"Lucida Console", Monaco, monospace',
   fontSize:"18px",
   width:"420px",
   maxHeight:"420px",
   overflow:"auto",
   background:'url("img/pictures/paper.png") 0 0 scroll #fff',
   color:"#000",
   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
};
Font names with spaces go in double quotes and I wrap the css line in single quotes because it's also in a javascript object.
This is Lucida Console, correct?
Screen%20Shot%202017-03-22%20at%202.43.58%20PM.png

Wow it`s perfect! Dude I really appreciate your patience hehe.

Ok last last last question, but I don´t think to have many possibilities to this... is there a way to make the plugin compatible will mobile phones? I can click the event to read the text, but to continue I need to press Z or X... I can´t continue with a click (like on a phone). So I'm stuck there 🙁
I don't have a tablet or mobile device to test on so you're going to have to be my eyes and ears for this.
PHP:
window.addEventListener('touchstart', function(e){
   if(document.getElementById("DOMElementWithText") !== null && e.target.nodeName === "CANVAS")
       removeTXTelement({keyCode:13});
});
I'm guessing this will remove the element if you tap outside the element. When I tried this with mouseup, I had to doubleclick for some reason, so you may have to double tap outside the element, but I just want to see if it works first before I fix that.
I don't have a tablet or mobile device to test on so you're going to have to be my eyes and ears for this.
PHP:
window.addEventListener('touchstart', function(e){
   if(document.getElementById("DOMElementWithText") !== null && e.target.nodeName === "CANVAS")
       removeTXTelement({keyCode:13});
});
I'm guessing this will remove the element if you tap outside the element. When I tried this with mouseup, I had to doubleclick for some reason, so you may have to double tap outside the element, but I just want to see if it works first before I fix that.

Sorry but where exactly should I add the code? Can´t make it work... even on a computer 🙁
Put it at the bottom of the plugin. Is your computer touchscreen?

This should do tap and mouse both,
PHP:
window.addEventListener('touchstart', function(e){
   if(document.getElementById("DOMElementWithText") !== null && e.target.nodeName === "CANVAS")
       removeTXTelement({keyCode:13});
});
window.addEventListener('mouseup', function(e){
   if(document.getElementById("DOMElementWithText") !== null && e.target.nodeName === "CANVAS")
       removeTXTelement({keyCode:13});
});
though I've got to figure out why MV is preventing the first click. I currently can only get it to work with two clicks. I'll get on this right away.
Put it at the bottom of the plugin. Is your computer touchscreen?

This should do tap and mouse both,
PHP:
window.addEventListener('touchstart', function(e){
   if(document.getElementById("DOMElementWithText") !== null && e.target.nodeName === "CANVAS")
       removeTXTelement({keyCode:13});
});
window.addEventListener('mouseup', function(e){
   if(document.getElementById("DOMElementWithText") !== null && e.target.nodeName === "CANVAS")
       removeTXTelement({keyCode:13});
});
though I've got to figure out why MV is preventing the first click. I currently can only get it to work with two clicks. I'll get on this right away.

Yep! and I confirm it`s working perfectly! 🙂 (with double tap)
Cool. Double tap is a little unintuitive though.
I just fixed it, so it only has to be one tap/click outside the element to close it.
I learned that MV was cancelling the click/touch event for all inside canvas clicks.
Replace those two functions with this thing.
PHP:
var cancelElementOnClick = function(e){
   var target = e.target;
   while(target.parentNode !== null && target.id !== "DOMElementWithText")
       target = target.parentNode;
   if(document.getElementById("DOMElementWithText") !== null && target.id !== "DOMElementWithText"){
       txtOpenInAction = true;
       removeTXTelement({keyCode:13});
   }
};
window.addEventListener('touchstart', cancelElementOnClick);
window.addEventListener('mouseup', cancelElementOnClick);
Graphics.isInsideCanvas = function(x, y) {
    return document.getElementById("DOMElementWithText") === null &&
          (x >= 0 && x < this._width && y >= 0 && y < this._height);
};
EDIT: oops. I forgot to take out a debugging console.log message... I hope you see this version instead...

Addition:
I also should have explained this from post 1, but the thing uses innerHTML so you can also use html formatting tags with your txt file.
Code:
 <h1>Lorem ipsum</h1> <strong>dolor sit</strong> amet, <em>leo dapibus</em> eu in. <del>Magna morbi</del>, <i>tortor</i> in <u>suscipit</u> nisl aenean in in. Auctor nullam
will become
Screen%20Shot%202017-03-22%20at%207.36.28%20PM.png
and so forth.
Cool. Double tap is a little unintuitive though.
I just fixed it, so it only has to be one tap/click outside the element to close it.
I learned that MV was cancelling the click/touch event for all inside canvas clicks.
Replace those two functions with this thing.
PHP:
var cancelElementOnClick = function(e){
   var target = e.target;
   while(target.parentNode !== null && target.id !== "DOMElementWithText")
       target = target.parentNode;
   if(document.getElementById("DOMElementWithText") !== null && target.id !== "DOMElementWithText"){
       txtOpenInAction = true;
       removeTXTelement({keyCode:13});
   }
};
window.addEventListener('touchstart', cancelElementOnClick);
window.addEventListener('mouseup', cancelElementOnClick);
Graphics.isInsideCanvas = function(x, y) {
    return document.getElementById("DOMElementWithText") === null &&
          (x >= 0 && x < this._width && y >= 0 && y < this._height);
};
EDIT: oops. I forgot to take out a debugging console.log message... I hope you see this version instead...

Addition:
I also should have explained this from post 1, but the thing uses innerHTML so you can also use html formatting tags with your txt file.
Code:
 <h1>Lorem ipsum</h1> <strong>dolor sit</strong> amet, <em>leo dapibus</em> eu in. <del>Magna morbi</del>, <i>tortor</i> in <u>suscipit</u> nisl aenean in in. Auctor nullam
will become
Screen%20Shot%202017-03-22%20at%207.36.28%20PM.png
and so forth.

Now it´s absolutely perfect! You`re AMAZING dude! 🙂 Thank you sooo much again! 😀
Awesome!
This has turned out to be a well-rounded plugin with all your help debugging it.
seen this, great work👍
love how its essentially a web page 😀
made a js for any1 else who stumbles here
can anybody tell me how to change folder destination for the txt files?
keeping a bunch of txt files in the main project folder is just, well, icky
🤘
Necro-post notice: Xium
The last post was over 2 years ago!

I suggest you start a new thread setting out the full details of your problem. You can link back to this thread if that helps your explanation.

Moderator note: Closing this.

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