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
533
Reaction score
235
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
533
Reaction score
235
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 Posts

Latest Profile Posts

rux
The most words I have ever written in an entire document is in my game's script, jeez i have a lot of characters that ramble on
Yes! I finally did something! This is a picture I drew of what I wish I looked like; I hope that you guys like it!
Finished that egg-sitting mini-game I mentioned here a couple weeks back. Now to fix the weather system so it doesn't rain indoors while you're playing it. >.> A simple fix in itself; leave it to me to take it as an excuse to completely revamp the time/weather/lighting system from scratch.
I'm really tempting to pre order cyberpunk 2077... should I do it or not :/ I really want to play the game but don't want to take a big hit to my saving because of it

Forum statistics

Threads
105,488
Messages
1,014,124
Members
137,142
Latest member
OscarCobblepot
Top