With MiniMicro
Step 1
Type:
locatePointer = function()
Step 2
Type:
print "Mouse's X position: " + mouse.x
Step 3
Type:
print "Mouse's Y position:" + mouse.y
Step 4
Type:
end function
Step 5
Click "Save and exit", don't forget to type "save", and run. You must to see something like this:
But with different numbers of course
Explaining: "locatePointer = function()"
The "locatePointer" is just the name of the function, so you can change it as you want. "function()" just defines that "locatePointer" is a function and that this function have no parameters.
Explaining: "print "Mouse's X position: " + mouse.x"
You must to know what the "print" do. It just prints something on the screen. In this case, it prints "Mouse's X position: " and the "mouse.x", that is the X position of the mouse pointer."
Explaining: "print "Mouse's Y position: " + mouse.y"
Here is the same thing, but it print the Y position of the mouse pointer.
Explaining: "end function"
It just defines that this is the end of the function.
With Try It!
I'm sorry... i think there's no way to do this with Try It! page. You can just detect the mouse position in Mini Micro.
If you know the position of the mouse pointer, you can do a lot of things. There's also another way to print the mouse position. You could write:
while true
print "Mouse's X position: " + mouse.x
print "Mouse's Y position: " + mouse.y
end while
...and the program will print the mouse's position forever. But you can break the loop with CTRL + C.
This is all for today, but you can do very interesting thing when you know where the mouse are!