• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker display_mouse_set(x,y)

V

Viktor1031

Guest
display_mouse_set(x,y) only works if the program is in focus. Is there any way i can run the program in the background while using the function? I'm trying to make a simple program that moves the mouse and completes simple tasks.

I'm using game maker studio 2
 
I'm assuming that you want the mouse to perform tasks in-game and not on the desktop. You could create a "fake mouse" object which is just a set of coordinates (x,y). You can then move it with your code to anywhere on screen and check for its position instead of checking for the mouse position.
Later when you regain focus, just set the object's position to the mouse position.
 

NightFrost

Member
Yeah, just simulate the mouse on the game window if you want it to act like it is doing something while out of focus. (You can't of course affect the mouse when not in focus. I'm sure Windows (or your OS of choice) works its darnest to block mouse hijacks so it likely would be an impossible feature to add in the first place.)
 
Top