Disabling the onclick method..

ougitou1

Invisible Black
Veteran
Joined
Dec 9, 2015
Messages
109
Reaction score
10
First Language
en-
Primarily Uses
N/A
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.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
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.
 

ougitou1

Invisible Black
Veteran
Joined
Dec 9, 2015
Messages
109
Reaction score
10
First Language
en-
Primarily Uses
N/A
Oh cool thanks
 

ougitou1

Invisible Black
Veteran
Joined
Dec 9, 2015
Messages
109
Reaction score
10
First Language
en-
Primarily Uses
N/A
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.
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
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".
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
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.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
@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

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
@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
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top