Text Input Dialogue + Player Notepad Compatibility Issue

VTDraws

Filthy Point-&-Click casual
Veteran
Joined
Apr 17, 2017
Messages
56
Reaction score
9
First Language
English
Primarily Uses
RMMV
Simply put: Even when popped into a fresh project, these two scripts:

and
don't play well together.
The problem seems to lie within Text Input Window [or CmdInp.js]. When the Player Notepad plugin is active, the Text Input Window doesn't allow use of the player's keyboard.

I have tried EVERY other plugin out there for inputting text to a variable with the keyboard. The only other one that worked was qInput, but unfortunately that one completely breaks Player Notepad and doesn't let IT use the keyboard. So, I'm stuck with these two.

Could anyone figure out a compatibility fix between these two plugins?

----------------
Side-problem, would anyone be able to fix the 'default header' text parameter in Text Input Window? It still requires you to put_underscores_between_your_words_in_the_plugin_command and the dev has stated they won't fix this.
I want to say there's just some sloppy scripting that could be cleaned up, but I'm not sure. :p That seems very fixable to just have a user-provided string in " " that could give the player a hint above their input window.

Thanks in advance for any help!

If I can't get these solved, I'll probably just request my own Text Input Window script, lmao.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
493
Reaction score
216
First Language
English
Primarily Uses
RMMV
Side-problem, would anyone be able to fix the 'default header' text parameter in Text Input Window? It still requires you to put_underscores_between_your_words_in_the_plugin_command and the dev has stated they won't fix this.
I want to say there's just some sloppy scripting that could be cleaned up, but I'm not sure. :p
There's a pretty good reason for this, I'd say. If it's sloppy scripting, it's in the core RMMV engine itself. The engine automatically splits plugin commands into arguments based on spaces, so if you wanted to split it some other way you would have to recombine the arguments and re-parse it. Broadly speaking, parsing is hard.

Now, this is a relatively simple case of parsing though, so it's definitely possible to do. This code is untested, but I think it should work correctly if you put it in a plugin that loads right after Text Input Window. There could be some syntax errors, mind you.
JavaScript:
(function() {
    var old_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(cmd, args) {
        if(cmd === 'enter_text' && (args[2] === 'false' || args[2] === 'true')) {
            // Note: Here I'm accounting for the "use image" option even though based on the source code it looks like it will never work
            var i = JSON.parse(args[2]) ? 4 : 3;
            var prompt, input;
            if(args[i].startsWith('"')) {
                prompt = args[i].slice(1);
                for(var j = i + 1; j < args.length; j++) {
                    prompt += ' ';
                    if(args[j].endsWith('"')) {
                        prompt += args[j].slice(0, -1);
                        break;
                    } else prompt += args[j];
                }
                args.splice(i, i - j + 1, prompt + ' ');
            }
            i++;
            if(args[i].startsWith('"')) {
                input = args[i].slice(1);
                for(var j = i + 1; j < args.length; j++) {
                    input += ' ';
                    if(args[j].endsWith('"')) {
                        input += args[j].slice(0, -1);
                        break;
                    } else input += args[j];
                }
                args.splice(i, i - j + 1, input + ' ');
            }
        }
        old_pluginCommand.call(this, cmd, args);
    };
})();
What this does is reparse the arguments before Text Input Window even sees it, so although it'll still replace underscores with spaces, you can instead enclose the string in double quotes. Note that it with the quick-and-dirty way I've coded this, you do need at least a space before the opening quote and either a space or nothing at all after the closing quote.

(I glanced through the code of both plugins and couldn't see any clue as to why they don't play well together. When you have both enabled, do you get any errors in the F8 console?)
 
Last edited:

VTDraws

Filthy Point-&-Click casual
Veteran
Joined
Apr 17, 2017
Messages
56
Reaction score
9
First Language
English
Primarily Uses
RMMV
There's a pretty good reason for this, I'd say. If it's sloppy scripting, it's in the core RMMV engine itself. The engine automatically splits plugin commands into arguments based on spaces, so if you wanted to split it some other way you would have to recombine the arguments and re-parse it. Broadly speaking, parsing is hard.

Now, this is a relatively simple case of parsing though, so it's definitely possible to do. This code is untested, but I think it should work correctly if you put it in a plugin that loads right after Text Input Window. There could be some syntax errors, mind you.
JavaScript:
(function() {
    var old_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(cmd, args) {
        if(cmd === 'enter_text' && (args[2] === 'false' || args[2] === 'true')) {
            // Note: Here I'm accounting for the "use image" option even though based on the source code it looks like it will never work
            var i = JSON.parse(args[2]) ? 4 : 3;
            var prompt, input;
            if(args[i].startsWith('"')) {
                prompt = args[i].slice(1);
                for(var j = i + 1; j < args.length; j++) {
                    prompt += ' ';
                    if(args[j].endsWith('"')) {
                        prompt += args[j].slice(0, -1);
                        break;
                    } else prompt += args[j];
                }
                args.splice(i, i - j + 1, prompt + ' ');
            }
            i++;
            if(args[i].startsWith('"')) {
                input = args[i].slice(1);
                for(var j = i + 1; j < args.length; j++) {
                    input += ' ';
                    if(args[j].endsWith('"')) {
                        input += args[j].slice(0, -1);
                        break;
                    } else input += args[j];
                }
                args.splice(i, i - j + 1, input + ' ');
            }
        }
        old_pluginCommand.call(this, cmd, args);
    };
})();
What this does is reparse the arguments before Text Input Window even sees it, so although it'll still replace underscores with spaces, you can instead enclose the string in double quotes. Note that it with the quick-and-dirty way I've coded this, you do need at least a space before the opening quote and either a space or nothing at all after the closing quote.

(I glanced through the code of both plugins and couldn't see any clue as to why they don't play well together. When you have both enabled, do you get any errors in the F8 console?)
Stars, I tried to implement this and follow along, but it still doesn't seem to be fixing anything. That or I'm just a wee bit dumb. I saw that you took a look at my plugin request related to this- do you think it'd be easier to get a new plugin, or to fix this one?
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
493
Reaction score
216
First Language
English
Primarily Uses
RMMV
Honestly, I'm not sure. I think it's reasonable to leave both possibilities open.

Note that the code I posted was only supposed to address the underscores_in_the_command, so you'd have to disable ALOE's notepad if testing that it actually works. In other words, it's only useful if the incompatibility can be found and addressed.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

And back. Trying to work online with no internet for 1.5 days was...interesting. I felt like a character in a old Sierra game trying to find internet due to all the hoops I had to jump through just to get online for work.
grief... if MV didn't have certain plugins already, I think I'd upgrade to MZ. seeing like 10 MV plugins in 1 MZ one is hilariously convenient lol.
Have you already checkes out my mapping tutorial on the blog? I would love to hear your feedback and things you'd like to see in the future!

one of character for my upcoming game idk how to design o_O

Designing patches that can 'augmented' to clothing based armor. Such good fun. A bit time consuming due to the need to create image displays, but the patches are limited so it's not too tiring.
Note: lol, posting this made me find a couple mistakes.

Forum statistics

Threads
100,736
Messages
978,936
Members
132,357
Latest member
Versitax
Top