Disabling the onclick method..

hello all first here I was wondering, er better yet I have a question, is is possible to disable the onclick method temporarily for a certain method for a window?

See I have a certain menu that I’m making and it needs to have the default cursor but without the clickability. I’d like to disable (for only that menu) the onclick method, I don’t think it’s actually onclick but maybe istouching in window base??? I’m not exactly sure but if anyone knows how to do this, I’d appreciate a few pointers or info. Thanks for yours helps.
You can remove event listener "onpointerdown". Then readd it when you need.
You can edit the function to contain certain conditions via if cases.
Btw. the function you were talking about is probably hidden inside TouchInput class in rpg_core.js.
Oh cool thanks
You can remove event listener "onpointerdown". Then readd it when you need.
You can edit the function to contain certain conditions via if cases.
Btw. the function you were talking about is probably hidden inside TouchInput class in rpg_core.js.

Question, where is this function called from?? I can’t seem to find it, or a way to block it from being called.
Question, where is this function called from?? I can’t seem to find it, or a way to block it from being called.
use ctrl+C for copy your code
And ctrl+V in search bar of your js folder
a tuto available here for windows user only
https://www.opentechguides.com/how-to/article/windows-10/60/windows10-search.html
You will find easley where are the code poryg give you.
I completely forgot to answer that.
The function is called via an event listener, so that means it's called by the program itself. Note that I'm talking about javascript events, not MV events.
So the only way to block the function from being called is to remove the event listener "onpointerdown".
the simplest way for him would be just to replace the basic function
PHP:
disableMouse = false;
TouchInput._onMouseDown = function(event) {
    if(disableMouse){return}
    if (event.button === 0) {
        this._onLeftButtonDown(event);
    } else if (event.button === 1) {
        this._onMiddleButtonDown(event);
    } else if (event.button === 2) {
        this._onRightButtonDown(event);
    }
};

call in script box disableMouse = true; , when need to disable mouse.
And disableMouse = false ; when need to enable again the mouse.
I'm not a big fan of dirty global variable like that, but these are simple and efficient way for someone was not experiment.
@Jonforum Global variables get reset upon restarting the app and don't get changed by loading, which can break some plugin functionality.
Now that we're talking about it, my event listener suggestion fails due to exactly this reason.
So this is the way to go:

Code:
TouchInput._onMouseDown = function(event) {
    if($gamePlayer.disableMouse){return}
    if (event.button === 0) {
        this._onLeftButtonDown(event);
    } else if (event.button === 1) {
        this._onMiddleButtonDown(event);
    } else if (event.button === 2) {
        this._onRightButtonDown(event);
    }
};
This way everything will be alright.
@Jonforum Global variables get reset upon restarting the app and don't get changed by loading, which can break some plugin functionality.
Now that we're talking about it, my event listener suggestion fails due to exactly this reason.
So this is the way to go:

Code:
TouchInput._onMouseDown = function(event) {
    if($gamePlayer.disableMouse){return}
    if (event.button === 0) {
        this._onLeftButtonDown(event);
    } else if (event.button === 1) {
        this._onMiddleButtonDown(event);
    } else if (event.button === 2) {
        this._onRightButtonDown(event);
    }
};
This way everything will be alright.
haha yes i forget its reset at start, stored way it the way.
maybe will be more readable and logic to store in $gameTemp || $gameSystem instead of
$gamePlayer:beard

Original thread: https://forums.rpgmakerweb.com/threads/disabling-the-onclick-method.90605/