How can I simulate a mouse click on an Xy location?

Good evening,

I would like to know how I can simulate a mouse click on an Xy location. Would like it to be in pixels but if it needs to be done via variables I think it would be fine too.

Edit: And how do I remove the white notification that appears every time the mouse is pressed?

Thanks in advance.
that is the wrong way to go about it, because messing with the input buffers is neither easy nor without risks as this can be blocked for virus effect.

What you should do is go to the function you want to trigger with that mouseclick and call it directly.
So you need to tell us what should happen as the result of that click and then we can tell you how to do it.
You want to call the functions that are already called when a mouse is clicked:

When the mouse button is pressed down:
Code:
TouchInput._mousePressed = true;
TouchInput._pressedTime = 0;
TouchInput._onTrigger(x, y);

When the mouse button is released:
Code:
TouchInput._mousePressed = false;
TouchInput._onRelease(x, y);

You'll want to wait some amount of frames between mouse down and mouse up if you want to simulate a real click.

Edit: Replaced "this" with "TouchInput"
To get rid of that awful flashing ...

Code:
var hideDest_Sprite_Destination_createBitmap = Sprite_Destination.prototype.createBitmap;
Sprite_Destination.prototype.createBitmap = function() {
  hideDest_Sprite_Destination_createBitmap.call(this);
  this.bitmap.clear();
}

just save that into a new file with a .js extension (call it whatever you want), put into your project's plugins folder, and add to the plugin manager.
So you need to tell us what should happen as the result of that click and then we can tell you how to do it.
I'm making an F-Zero game with Ultra Mode 7. I have 3 on-screen buttons that control the YAW and pause the game. Bblizzard adjusted Altimit Movement so that walking forward works according to the degree the YAW is on (so not based on the map anymore). The only problem was that Altimit Movement isn't a "real" pixel movement plugin so moving outside of the standard 4 directions would force it to zigzag its way forth. I need moving forward to be automatic when the countdown at the start of the race reaches 0 since keeping a "gas" button pressed on a mobile game while also moving left and right wouldn't really work.

So a solution: Press with the mouse just above the player, in the middle of the screen, so it will tell the plugin the move the player there. It works with the script @Aloe Guvner gave me but I need to disable the mouse because otherwise people would be able to redirect the direction of the player.

TouchInput._mousePressed = true; TouchInput._pressedTime = 0; TouchInput._onTrigger(x, y);
Is it also possible to "mouse-press" on a location without the mouse being enabled? Because the player shouldn't be able to touch anywhere except on the buttons.

@Shaz thank you, it works 🙂
Is it also possible to "mouse-press" on a location without the mouse being enabled?
I think I don't understand this question. How is the mouse being disabled? You have some script or process that is disabling the mouse?

And are you *asking* if those script calls work with the mouse being disabled or *telling* me they don't work with the mouse being disabled?

Because the player shouldn't be able to touch anywhere except on the buttons.

If this is what you want, I don't think the solution is to disable the mouse entirely. The better solution would just be to stop just the part that triggers movement.

Also, you're confusing me talking about a mouse then talking about a mobile game. Is it mouse or touch?
I think I don't understand this question. How is the mouse being disabled? You have some script or process that is disabling the mouse?
The mouse is being disabled via Galv ScreenButtons, the plugin shows images in fixed positions that activate an event or control function when they are pressed. These buttons DO still work when the mouse is disabled.

I was *telling* you the script calls don't work when the mouse is disabled, and I would like them to work with the mouse being disabled so players can't do any other thing except for pressing the Left, Right, and Pause on screen buttons.

The better solution would just be to stop just the part that triggers movement.
And how do we do that? (That sounds like the best solution indeed)

Also, you're confusing me talking about a mouse then talking about a mobile game. Is it mouse or touch?
Basically both: It is a mobile game that uses the touchscreen with on screen buttons. BUT I do need a repeating "mouse click" above to player so it keeps moving fluently forward when the YAW is changed with the left and right buttons. Because if I just have "move forward" on parallel the player would just zigzag over to tiles instead.

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-simulate-a-mouse-click-on-an-xy-location.108146/