Messages reacting to ANY button input

Baka123

Some handsome dude
Member
Joined
Dec 17, 2018
Messages
5
Reaction score
1
First Language
Polish
Primarily Uses
RMMV
Well, hello there.
I'm making a game where at the beginning the player needs to input a password. I'm using Yanfly's MessageCore plugin to stop the message and wait for a button input but it only works for z, x, Space, Esc, Insert, Enter and mouse click.

Is there any plugin that will allow the message to react to ANY button input?

I'm using rpg maker mv.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,399
Reaction score
880
First Language
EN
Primarily Uses
RMMV
Try importing this as a plugin~
Code:
Window_Message.prototype.isTriggered = function() {
  return Input.isRepeated(Input._latestButton) || TouchInput.isRepeated();
};
 

Attachments

Baka123

Some handsome dude
Member
Joined
Dec 17, 2018
Messages
5
Reaction score
1
First Language
Polish
Primarily Uses
RMMV
Try importing this as a plugin~
Code:
Window_Message.prototype.isTriggered = function() {
  return Input.isRepeated(Input._latestButton) || TouchInput.isRepeated();
};
The message sure reacts now to more button inputs but still not to every single one (numbers, and most of the letters).

EDIT: Also from time to time the message reacts to... nothing. It just behaves as if I'm constantly clicking buttons when I'm not doing anything at all. It stops when I click a button.
 
Last edited:

Gamefall Team

Nebula Games Leader
Veteran
Joined
Jan 10, 2017
Messages
344
Reaction score
434
First Language
Italian
Primarily Uses
RMMV
@Baka123 You can try - importing it as a plugin - this one:

Code:
(function () {

    // keys object for keycodes from codingcarpenter

    var keys={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pausebreak:19,capslock:20,esc:27,space:32,pageup:33,pagedown:34,end:35,home:36,leftarrow:37,uparrow:38,rightarrow:39,downarrow:40,insert:45,delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,leftwindowkey:91,rightwindowkey:92,selectkey:93,numpad0:96,numpad1:97,numpad2:98,numpad3:99,numpad4:100,numpad5:101,numpad6:102,numpad7:103,numpad8:104,numpad9:105,multiply:106,add:107,subtract:109,decimalpoint:110,divide:111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,semicolon:186,equalsign:187,comma:188,dash:189,period:190,forwardslash:191,graveaccent:192,openbracket:219,backslash:220,closebracket:221,singlequote:222};

    for(key in keys) {
        if(!!Input.keyMapper[keys[key]]) {continue;}
        Input.keyMapper[keys[key]] = key;
    }

    Window_Message.prototype.isTriggered = function() {
        var cond = Object.keys(Input.keyMapper).some(function(keycode) {return Input.isRepeated(Input.keyMapper[keycode])})
        return cond || TouchInput.isRepeated();
    };

})()
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,399
Reaction score
880
First Language
EN
Primarily Uses
RMMV
The message sure reacts now to more button inputs but still not to every single one (numbers, and most of the letters).
Oh yes, the default Input stuff ignores any buttons not defined in the keyMapper, whoops. :kaoslp: Looks like @Gamefall Team's solution inserts the missing key codes in there, works nicely for me! :kaojoy:

Note that once the keys are actually in the keyMapper, they should all register normally, so I think that var cond = ... line can be replaced with this:
Code:
var cond = Input.isRepeated(Input._latestButton);
Should produce the same end result, though. :kaothx:

EDIT: Also from time to time the message reacts to... nothing. It just behaves as if I'm constantly clicking buttons when I'm not doing anything at all. It stops when I click a button.
:kaoswt2: Not sure why that would happen, it seems OK for me. Does it still happen with Gamefall Team's plugin?

Edit: from the follow-up post it seems I'm just not seeing the issue in my test project, apparently _latestButton is glitchy but GFT's version will hopefully work for you. :kaoswt:
It might be due to your mouse (and/or touchpad if your system has one), in which case you could try changing this line:
Code:
return cond || TouchInput.isRepeated();
...to this:
Code:
return cond;
That should make it ignore the mouse/touch input. :)

Otherwise, does the same behaviour occur in a new project, with no other plugins enabled? If you have a controller/gamepad connected, maybe that's somehow causing issues? (MV should be OK with gamepads, but perhaps there's a faulty connection or something, idk.)
 
Last edited:

Gamefall Team

Nebula Games Leader
Veteran
Joined
Jan 10, 2017
Messages
344
Reaction score
434
First Language
Italian
Primarily Uses
RMMV
EDIT: Also from time to time the message reacts to... nothing. It just behaves as if I'm constantly clicking buttons when I'm not doing anything at all. It stops when I click a button.

:kaoswt2: Not sure why that would happen, it seems OK for me. Does it still happen with Gamefall Team's plugin?
@caethyril I have experienced the same problem that was reported up there.
I was thinking that the problem was related to the Touch Input, but - on my side at least - It was related on the Input._latestButton when used as argument of the Input.isRepeated.
It's strange, because as you said the variable should only store the last key registered in the mapper. So, I have changed the code in the one you have seen above iterating the keys' array with some. :kaojoy:
 

Baka123

Some handsome dude
Member
Joined
Dec 17, 2018
Messages
5
Reaction score
1
First Language
Polish
Primarily Uses
RMMV
Gamefall Team's plugin works just fine! Everything works perfectly, there are now no problems at all. Thanks for help guys :kaoluv:
 

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

Latest Threads

Latest Profile Posts

It's raining...in winter :")
I was stunned-STUNNED-to find that I have been working on my current project since November. It feels like so much less time than that.
Stream will be live shortly with some art! Going to do a recolor, then start on a new monster! Feel free to drop by!
I've been busy working on other projects this month so I haven't been able to do much towards finishing the prep work for my RPG, but I did brainstorm some interesting ideas for the game.
redrawing one of three my VNM protags

Forum statistics

Threads
93,710
Messages
914,840
Members
123,313
Latest member
lucansan
Top