How to check if mouse has been clicked

To clarify the question: I am not looking to check if the left mouse button is currently clicked. I specifically need this check to require the mouse be released AND pressed again to register again. If there is no command to do this, does anyone know a workaround to simulate this effect?
use
PHP:
document.addEventListener('mousemove', yourFunctionCallBack); // basic store mouse XY
    document.addEventListener('mousedown', yourFunctionCallBack); // basic store mouse XY
    document.addEventListener('mouseup', yourFunctionCallBack );
use
PHP:
document.addEventListener('mousemove', yourFunctionCallBack); // basic store mouse XY
    document.addEventListener('mousedown', yourFunctionCallBack); // basic store mouse XY
    document.addEventListener('mouseup', yourFunctionCallBack );
Thanks for the quick response!

I'm not 100% sure what I'm looking at though. How would I use this in an if statement? I've tried a bunch of variations and none are working.

edit: I've also found this stuff in the rpg_core.js file and have tried variates of what I've found there.
These parts are found in rpg_core.js
They control what happens when you click(mousedown), move(mousemove), and letting go of the mouse button( mouseup). You need to find these functions and manipulate them as you see fit.
I do not advise you to manipulate them.
Create instead a new listener that will do what you want.

example


PHP:
function mousemove_Button(event) {
var mX = Graphics.pageToCanvasX(event.pageX); var mY = Graphics.pageToCanvasY(event.pageY);
if (!Graphics.isInsideCanvas(mX, mY)) {return}; // if mouse are in canvas

// your stuf

};

document.addEventListener('mousemove', mousemove_Button); // basic store mouse XY

you can also bin your plugin scope function

document.addEventListener('mousemove', mousemove_Button.bind(this));
Alright, I searched a while and found what I needed. Thanks for the help y'all!
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-if-mouse-has-been-clicked.91615/