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
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
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
348
Reaction score
473
First Language
Italian
Primarily Uses
RMMZ
@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
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
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
348
Reaction score
473
First Language
Italian
Primarily Uses
RMMZ
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 Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top