How to detect holding right mouse button

I already disabled the right mouse button so it won't go to the menu.
Now I'm doing something like this in a Common Event running on a parallel process:

Condition: TouchInput.isCancelled():
Do action

I wanted that as long as the button is being pressed it does the action. It works with the keyboard but it doesn't work with the right mouse button.
Does anyone know a way to make it work?

Edit: Already got it working. I changed a bunch of stuff in rpg_core.js which is not a great solution but it worked.
How did you disable it so it won't go to the menu?
How did you disable it so it won't go to the menu?
I changed a line rpg_scenes.js. I know I shouldn't but it worked.

Change this:
Code:
Scene_Map.prototype.isMenuCalled = function() {
    return Input.isTriggered('menu') || TouchInput.isCancelled();
};
to this:
Code:
Scene_Map.prototype.isMenuCalled = function() {
    return Input.isTriggered('menu');
};
That code change shouldn't stop it working. Can you please post a pic of your common event? If it's on parallel process, there must be a switch to control it. Can you confirm that the switch is on? If you change the condition to something else (use one of the button conditions that already exists), does it work? The issue might be more with the design of the common event than with the condition.
There's no switch, my common event is not related to the menu, it just changes the graphics of the main character while im holding down the button.

One post had the same question as me and that's how I solved it.
https://forums.rpgmakerweb.com/index.php?threads/disabling-mouse-right-click-to-menu.89946/
A common event set to parallel process must have a switch. That's how you turn them on/off.

Please show a screenshot of your common event, with the whole common event window visible (don't crop it to just the commands).
Well yeah, of course it has a switch so the common event works. Didn't understand what you meant before. I still don't understand why you want to see the common event since the problem was solved and the common event has nothing to do with it.

The common event is just there to check if the right button is pressed.
Here's an example. When the player clicks the mouse's right button it changes the graphics and because that line was changed it won't go to the menu.
well how do you do that can you please send me the photo.
I already disabled the right mouse button so it won't go to the menu.
Now I'm doing something like this in a Common Event running on a parallel process:

Condition: TouchInput.isCancelled():
Do action

I wanted that as long as the button is being pressed it does the action. It works with the keyboard but it doesn't work with the right mouse button.
Does anyone know a way to make it work?

Edit: Already got it working. I changed a bunch of stuff in rpg_core.js which is not a great solution but it worked.
@aryan697954 , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-detect-holding-right-mouse-button.107926/