MV Input Spam when Holding a Button (Octobattle)

I think something is wrong with your system/project.

When I start a new project, press Escape to open the menu, then hold down Z or Enter, it will select Items then automatically the first item, however:
- It will not automatically select the actor and use the item; there's nothing infinite
- It is not at all difficult timing to lift my finger in the transition between selecting Items and the list popping up

Do you, by chance, have a high-refresh monitor? I'm not sure if the bugs with refresh rate might also affect a too-high polling rate for input; you could try adding this plugin to your project (even if it doesn't affect you, it fixes the bug for any players you might have):
Got some free time so started a completely new project, no plugins or anything.
Went straight into playtest immediately after generating the project, and the issue was occurring straight away.
I could hold down the escape button to open and close the menu without even lifting my finger, and go through menus super fast just by holding Z.
Then I think it's probably what I suggested on the first page, and caethyril suggested recently - that your controller is not interacting as intended with the browser interface or your operating system or something.

Do you have a friend with a more standard gamepad you can try? I suspect anything you do to "fix" this for yourself might interfere with many of your players. I've never heard of this problem or your brand of gamepad before.
It looks like the gamepad button is repeating by itself.
Can you try this code? Save it as a plugin. Do a long press with the gamepad and see what the console says.
JavaScript:
Input._updateGamepadState = function(gamepad) {
    const lastState = this._gamepadStates[gamepad.index] || [];
    const newState = [];
    const buttons = gamepad.buttons;
    const axes = gamepad.axes;
    const threshold = 0.5;
    newState[12] = false;
    newState[13] = false;
    newState[14] = false;
    newState[15] = false;
    for (let i = 0; i < buttons.length; i++) {
        newState[i] = buttons[i].pressed||buttons[i].value||buttons[i].touched;
        if(lastState[i]&&!newState[i]){
          console.log('button'+i+' is released',buttons[i].pressed,buttons[i].value,buttons[i].touched);
        }
        if(!lastState[i]&&newState[i]){
          console.log('button'+i+' is pressed',buttons[i].pressed,buttons[i].value,buttons[i].touched);
        }
    }
    if (axes[1] < -threshold) {
        newState[12] = true; // up
    } else if (axes[1] > threshold) {
        newState[13] = true; // down
    }
    if (axes[0] < -threshold) {
        newState[14] = true; // left
    } else if (axes[0] > threshold) {
        newState[15] = true; // right
    }
    for (let j = 0; j < newState.length; j++) {
        if (newState[j] !== lastState[j]) {
            const buttonName = this.gamepadMapper[j];
            if (buttonName) {
                this._currentState[buttonName] = newState[j];
            }
        }
    }
    this._gamepadStates[gamepad.index] = newState;
};
Then I think it's probably what I suggested on the first page, and caethyril suggested recently - that your controller is not interacting as intended with the browser interface or your operating system or something.

Do you have a friend with a more standard gamepad you can try? I suspect anything you do to "fix" this for yourself might interfere with many of your players. I've never heard of this problem or your brand of gamepad before.
I've tried it with a PS4 and Switch Pro Controller as well and they've both had the issue.
I don't have access to an xbox controller sadly. I can try getting my hands on one at some point but for now I'm going to attempt utunnels plugin with caution.

It looks like the gamepad button is repeating by itself.
Can you try this code? Save it as a plugin. Do a long press with the gamepad and see what the console says.
JavaScript:
Input._updateGamepadState = function(gamepad) {
    const lastState = this._gamepadStates[gamepad.index] || [];
    const newState = [];
    const buttons = gamepad.buttons;
    const axes = gamepad.axes;
    const threshold = 0.5;
    newState[12] = false;
    newState[13] = false;
    newState[14] = false;
    newState[15] = false;
    for (let i = 0; i < buttons.length; i++) {
        newState[i] = buttons[i].pressed||buttons[i].value||buttons[i].touched;
        if(lastState[i]&&!newState[i]){
          console.log('button'+i+' is released',buttons[i].pressed,buttons[i].value,buttons[i].touched);
        }
        if(!lastState[i]&&newState[i]){
          console.log('button'+i+' is pressed',buttons[i].pressed,buttons[i].value,buttons[i].touched);
        }
    }
    if (axes[1] < -threshold) {
        newState[12] = true; // up
    } else if (axes[1] > threshold) {
        newState[13] = true; // down
    }
    if (axes[0] < -threshold) {
        newState[14] = true; // left
    } else if (axes[0] > threshold) {
        newState[15] = true; // right
    }
    for (let j = 0; j < newState.length; j++) {
        if (newState[j] !== lastState[j]) {
            const buttonName = this.gamepadMapper[j];
            if (buttonName) {
                this._currentState[buttonName] = newState[j];
            }
        }
    }
    this._gamepadStates[gamepad.index] = newState;
};
So I just tried this, and it didn't fix the issue unfortunately.
Well it probably won't fix anything, I mean what does the console shows if you press a gamepad button?
I'm trying to find if press and release function correctly with the output.
Well it probably won't fix anything, I mean what does the console shows if you press a gamepad button?
I'm trying to find if press and release function correctly with the output.

My apologies, I misunderstood.
1723961225033.png

The console shows this when I press a button, and also shows this same thing when I hold it.
So even though holding the button is allowing me to zoom through menus and increase my boost points, its only registering in the console as one button press.
OK, it just added another mystery!
Can you try this version. I hope it is the last time.
JavaScript:
Input._updateGamepadState = function(gamepad) {
    var lastState = this._gamepadStates[gamepad.index] || [];
    var newState = [];
    var buttons = gamepad.buttons;
    var axes = gamepad.axes;
    var threshold = 0.5;
    newState[12] = false;
    newState[13] = false;
    newState[14] = false;
    newState[15] = false;
    for (var i = 0; i < buttons.length; i++) {
        newState[i] = !!(buttons[i].pressed||buttons[i].value);
    }
    if (axes[1] < -threshold) {
        newState[12] = true;    // up
    } else if (axes[1] > threshold) {
        newState[13] = true;    // down
    }
    if (axes[0] < -threshold) {
        newState[14] = true;    // left
    } else if (axes[0] > threshold) {
        newState[15] = true;    // right
    }
    for (var j = 0; j < newState.length; j++) {
        if (!!newState[j] !== !!lastState[j]) {
            var buttonName = this.gamepadMapper[j];
            if (buttonName) {
                this._currentState[buttonName] = !!newState[j];
            }
        }
    }
    this._gamepadStates[gamepad.index] = newState;
};
OK, it just added another mystery!
Can you try this version. I hope it is the last time.
JavaScript:
Input._updateGamepadState = function(gamepad) {
    var lastState = this._gamepadStates[gamepad.index] || [];
    var newState = [];
    var buttons = gamepad.buttons;
    var axes = gamepad.axes;
    var threshold = 0.5;
    newState[12] = false;
    newState[13] = false;
    newState[14] = false;
    newState[15] = false;
    for (var i = 0; i < buttons.length; i++) {
        newState[i] = !!(buttons[i].pressed||buttons[i].value);
    }
    if (axes[1] < -threshold) {
        newState[12] = true;    // up
    } else if (axes[1] > threshold) {
        newState[13] = true;    // down
    }
    if (axes[0] < -threshold) {
        newState[14] = true;    // left
    } else if (axes[0] > threshold) {
        newState[15] = true;    // right
    }
    for (var j = 0; j < newState.length; j++) {
        if (!!newState[j] !== !!lastState[j]) {
            var buttonName = this.gamepadMapper[j];
            if (buttonName) {
                this._currentState[buttonName] = !!newState[j];
            }
        }
    }
    this._gamepadStates[gamepad.index] = newState;
};

The problem is still occurring after installing this plugin.
Ah, then I have run out of ideas. Sorry.😢
It was added as a branch option in MZ. In MV, you can use Branch -> Script: Input.isRepeated("ok").

Alternatively you could use a variable to manually count the frames. This kind of idea:
  • If [OK] is pressed:
    • If Variable > 0:
      • Variable -= 1.
    • Else If Variable < 0:
      • Variable += 1
    • Else If Variable = 0:
      • (Your stuff goes here.)
      • Variable = 6.
  • Else:
    • Variable = -24.
ty for your help, it surely works better now.
The real issue remain tho, it should be a "button mashing" event but it can be solved just by keeping "ok" pressed. I fear I might have to change it into some kind of qte to make it work like a challenge
The console shows this when I press a button, and also shows this same thing when I hold it.
So even though holding the button is allowing me to zoom through menus and increase my boost points, its only registering in the console as one button press.
I ask just because those screenshots are so cropped - there aren't any blue numbers to the left, indicating the same message repeatedly?
I could hold down the escape button to open and close the menu without even lifting my finger, and go through menus super fast just by holding Z.
So it happens with keyboard or gamepad input, even with no plugins enabled? If so, that's very important information~

As stated earlier, plugins are responsible for handling their own input, so it may also be a problem with Olivia's Octobattle plugin. Since that plugin is paid, though (and probably obfuscated) you're unlikely to find anyone to help with it, other than its author.

Like others have mentioned, the problem sounds like core behaviour: isRepeated is false until the button is long-pressed (24 frames), then is true every "repeat interval" (6 frames) after that. MZ implements a _canRepeat flag on selectable windows to control stuff like this, toggling between isRepeated and isTriggered for relevant checks, but MV doesn't. Your game appears to be running at 60 fps according to the F2 widget, so 24 frames should last 24/60 = 0.4 seconds. It's possible you are holding the button slightly longer than that, per press.

Did you try the code @utunnels provided in earlier posts (#14, #16) to change the repeat times? I.e. as a plugin:
JavaScript:
// A button is long-pressed after being held for 10000 frames.
Input.keyRepeatWait = 10000;   // default 24
// The button repeat check will be true every 60 frames after that.
Input.keyRepeatInterval = 60;  // default 6
As before, test first in a new project, else other plugins may interfere. Alternatively:
JavaScript:
// Override!
Input.isRepeated = function() {
  this.isTriggered.apply(this, arguments);
};
This basically makes all isRepeated checks act as isTriggered: true iff the button was not pressed on the previous frame, but is pressed right now. Either solution will be sub-optimal in various cases, but if they solve your primary problem of "zooming through menus etc" then that's a promising start!

You could also try typing this into the console window, then press Enter:

process.versions.nw
This reports the version of NWJS (runtime app) your game is running on. E.g. I see this:

console.png

If you're using a different version, e.g. because you manually upgraded it at some point, that may be noteworthy.

If you have, at any point, modified your project's core scripts (or, worse, the core scripts in your RMMV install folder, under NewData) you could restore them to defaults (e.g. by reinstalling your editor, or using Steam's "verify file integrity" feature) then make a new project and retry the tests in that clean project.

At the end of the day, it's not feasible for us to suggest a fix if we can't understand or even replicate the problem on our end.


The real issue remain tho, it should be a "button mashing" event but it can be solved just by keeping "ok" pressed.
That logic would actually be simpler: you'd only need a switch to track whether the button was pressed last frame. Or you could use Branch -> Script: Input.isTriggered("ok") instead. You may find this thread helpful:
Also, your question is clearly not the same as the OP of this thread, so if you want further help with your question, please start a new thread of your own rather than hijacking this one. 👋
So it happens with keyboard or gamepad input, even with no plugins enabled? If so, that's very important information~

As stated earlier, plugins are responsible for handling their own input, so it may also be a problem with Olivia's Octobattle plugin. Since that plugin is paid, though (and probably obfuscated) you're unlikely to find anyone to help with it, other than its author.

Like others have mentioned, the problem sounds like core behaviour: isRepeated is false until the button is long-pressed (24 frames), then is true every "repeat interval" (6 frames) after that. MZ implements a _canRepeat flag on selectable windows to control stuff like this, toggling between isRepeated and isTriggered for relevant checks, but MV doesn't. Your game appears to be running at 60 fps according to the F2 widget, so 24 frames should last 24/60 = 0.4 seconds. It's possible you are holding the button slightly longer than that, per press.

Did you try the code @utunnels provided in earlier posts (#14, #16) to change the repeat times? I.e. as a plugin:
JavaScript:
// A button is long-pressed after being held for 10000 frames.
Input.keyRepeatWait = 10000;   // default 24
// The button repeat check will be true every 60 frames after that.
Input.keyRepeatInterval = 60;  // default 6
As before, test first in a new project, else other plugins may interfere. Alternatively:
JavaScript:
// Override!
Input.isRepeated = function() {
  this.isTriggered.apply(this, arguments);
};
This basically makes all isRepeated checks act as isTriggered: true iff the button was not pressed on the previous frame, but is pressed right now. Either solution will be sub-optimal in various cases, but if they solve your primary problem of "zooming through menus etc" then that's a promising start!

You could also try typing this into the console window, then press Enter:

process.versions.nw

This reports the version of NWJS (runtime app) your game is running on. E.g. I see this:

View attachment 315018

If you're using a different version, e.g. because you manually upgraded it at some point, that may be noteworthy.

If you have, at any point, modified your project's core scripts (or, worse, the core scripts in your RMMV install folder, under NewData) you could restore them to defaults (e.g. by reinstalling your editor, or using Steam's "verify file integrity" feature) then make a new project and retry the tests in that clean project.

At the end of the day, it's not feasible for us to suggest a fix if we can't understand or even replicate the problem on our end.



That logic would actually be simpler: you'd only need a switch to track whether the button was pressed last frame. Or you could use Branch -> Script: Input.isTriggered("ok") instead. You may find this thread helpful:
Also, your question is clearly not the same as the OP of this thread, so if you want further help with your question, please start a new thread of your own rather than hijacking this one. 👋

Had another chance to look at it, and I tried adding this first bit of code that you sent as a plugin.
(this one)

JavaScript:
// A button is long-pressed after being held for 10000 frames.
Input.keyRepeatWait = 10000;   // default 24
// The button repeat check will be true every 60 frames after that.
Input.keyRepeatInterval = 60;  // default 6

And it fixed the menu issues straight away, which is a fantastic start.
However this does not seem to have fixed or even had an effect on the Octobattle Boost System, so that tells me this particular issue is a problem with the Octobattle Plugin specifically...
Which sucks because I have no idea how I would even begin to get help with that unless I somehow got in contact with the author 🙁
And it fixed the menu issues straight away, which is a fantastic start.
Great, so the menu thing was just about the repeat input timing after all. 😮‍💨

However this does not seem to have fixed or even had an effect on the Octobattle Boost System
Oh. Have you tried to reproduce that behaviour with a minimal setup, i.e. only Octobattle plugins in their recommended load order? I advise testing in a new project, to be sure nothing else is interfering.

You could double-check that all plugins you're using are up-to-date. Also, Yanfly's stuff has a recommended load order, and e.g. Olivia's Boost Point System states that it is compatible with a number of Yanfly's plugins if loaded after them (i.e. Boost Point System should appear somewhere below the Yanfly stuff in your Plugin Manager list). If you're not sure about load order, you could post screenshot(s) of your Plugin Manager for someone here to check.

Based on screenshots, it looks like the Boost Point System plugin has a plugin parameter to toggle that feature: "Use L and R buttons". So I think you could avoid the problem if you're willing to force players to use the actor commands to (de)allocate boost points. 👋

Since Olivia's terms of use explicitly allow editing the code (but, obviously, not sharing it) you could try Ctrl+F -> Input.isPressed. If you find it, you could make a copy of the plugin (as a backup), then try replacing Input.isPressed with either Input.isTriggered or Input.isRepeated, to see if that helps.
Great, so the menu thing was just about the repeat input timing after all. 😮‍💨


Oh. Have you tried to reproduce that behaviour with a minimal setup, i.e. only Octobattle plugins in their recommended load order? I advise testing in a new project, to be sure nothing else is interfering.

You could double-check that all plugins you're using are up-to-date. Also, Yanfly's stuff has a recommended load order, and e.g. Olivia's Boost Point System states that it is compatible with a number of Yanfly's plugins if loaded after them (i.e. Boost Point System should appear somewhere below the Yanfly stuff in your Plugin Manager list). If you're not sure about load order, you could post screenshot(s) of your Plugin Manager for someone here to check.

Based on screenshots, it looks like the Boost Point System plugin has a plugin parameter to toggle that feature: "Use L and R buttons". So I think you could avoid the problem if you're willing to force players to use the actor commands to (de)allocate boost points. 👋

Since Olivia's terms of use explicitly allow editing the code (but, obviously, not sharing it) you could try Ctrl+F -> Input.isPressed. If you find it, you could make a copy of the plugin (as a backup), then try replacing Input.isPressed with either Input.isTriggered or Input.isRepeated, to see if that helps.
So I just tried testing it in the Sample Project provided by Olivia when you purchase the plugin, and the issue literally occurs even in the Sample Project.
It's definitely a problem with the plugin itself...

I tried your suggestion of Ctrl+F but it returns nothing.
The plugin code is all muddled and doesn't make any sense to me, I assume on purpose to protect it because its a paid plugin.
Maybe you can contact the author of the plugin if they can still be reached?
Would anyone have any idea how to contact Olivia to ask for help with this?
I've tried looking around but haven't been able to find a way to reach her...

It's becoming very disheartening.

Or if not, is there any way I could commission some sort of fix? I really don't know what to do here, I can't remove the plugin cause my game's entire combat system is built around this.
Maybe you can contact the author of the plugin if they can still be reached?
Fallen Angel Olivia is notoriously impossible to contact, and provides no support for her MV plugins.

Or if not, is there any way I could commission some sort of fix?
It's possible, there is a commissions section of the forum. You would have to work with someone who owns the plugin, or buy them a copy in addition to their working fee, in order to respect legal licensing.

Or you could ask about how to reproduce the parts of the battle system you want without using this specific plugin.
It's possible, there is a commissions section of the forum.
Assuming that she didn't also obfuscate the plugin because most of her commercial plugins are.
Assuming that she didn't also obfuscate the plugin because most of her commercial plugins are.
That's true - I rather presume she did, it just slipped my mind to mention.

Original thread: https://forums.rpgmakerweb.com/threads/input-spam-when-holding-a-button-octobattle.171083/