Mouse Lock and Mouse Hide

Hello all.

I was wondering if there was a way to lock the mouse to the game window and hide the windows mouse cursor so that you only see your custom mouse cursor in the game.

So with some extra digging through the microScript documentation, I found the code for hiding the mouse cursor.


I still have yet to find something that locks the mouse to the game window.


I made this code for you because it's hard to explain without an example.

First, you need to use code written in Javascript. Because MicroStudio does not have the function you are asking about. Fortunately, you can combine MicroStudio code and JavaScript - it's the most fun.

This code is based on information from this article.


After clicking on the area where the MicroScript (Screen) result is displayed, an event is added.

You add an Event that listens for the mouse.

Now the mouse disappears and Firefox shows a message that the page you are on controls the browser/website.

You link with MicroScript code.

In MicroScript you check the value of global variables x and y.

You can also call the MicroScript code directly from the JavaScript function that receives information about the event (but it's a bit complicated).

I will also add, for the sake of clarity, that the MicroStudio website also created a lot of listening events and that such deep interference may cause glitches in the operation of the mouse because, for example, you will cover an event that was previously set by MicroStudio.

This is exactly what I was looking for. Thank you Loginus!

While reading the MicroScript documentation, I didn't realize you can just write a script in JavaScript when the project coding language is set to MicroScript. My brain is going crazy with the possibilities.

While I know some JavaScript(taught myself the basics on a codecademy free trial), I still have a lot to learn. I am excited to see what I can do and share with others here!

Thanks again!

Post a reply



Validate your e-mail address to participate in the community