Copyright 6 Vista 7 new! Languages 8 Glovepie scripts 9

NEW! FakeMouse.DirectInputX and RealMouse.DirectInputX

Download 489 Kb.
Size489 Kb.
1   ...   6   7   8   9   10   11   12   13   ...   30

NEW! FakeMouse.DirectInputX and RealMouse.DirectInputX

DirectInputX, DirectInputY, DirectInputZ, and DirectInputH now have 3 kinds:



When you read mouse.DirectInputX it is a total of all the fake mouse motions plus all the real mouse motions. When you read RealMouse.DirectInputX it is the total of all the real mouse motions, without any of the fake ones. FakeMouse.DirectInputX is the total fake mouse motions, and doesn't include the real ones.

You can also set Mouse.DirectInputX or FakeMouse.DirectInputX. For example:

Mouse.DirectInputX = MapRange(Wiimote.Roll,-90,90,-800,800)
The above will set the mouse to a position based on the Wiimote's roll. You will not be able to move it by moving, the real mouse.
FakeMouse.DirectInputX = MapRange(Wiimote.Roll,-90,90,-800,800)
The above will move the mouse relative to the real mouse position. The real mouse can also control it.
But if you use += or add to the DirectInputX value each time instead of setting it to an absolute value, then it makes no difference which one you use.


Because GlovePIE also supports vectors, you may want to set and read both the DirectInput values at once. For example:

Mouse.DirectInput2D = [200, -400]
Will set the mouse to half an inch to the left and a whole inch forwards from its starting point. Or you can use real units:
Mouse.DirectInput2D = [0.5, -1] inches
You can also read them both at once. eg.
debug = mouse.DirectInput2D
You can read individual mice this way if you have multiple mice plugged into windows XP, by using Mouse1.DirectInput2D and Mouse2.DirectInput2D. But you can’t set individual mice.

The Scroll Wheel

Most mice these days also have a scroll wheel. This is considered to be the mouse’s Z axis. It has no units. But it normally jumps in increments of 120 per click. Some mice have continuous movement in their scroll wheels, but most click in jumps of 120.

Note that the wheel on my Microsoft mouse is extremely dodgy and often jumps in the wrong direction, and I expect many scroll wheels are like that. Some games go to a lot of trouble to compensate.


You can read or set the scroll wheel position with Mouse.DirectInputZ.

The starting position of the scroll wheel is given the value 0. Negative means scrolled forwards. Positive means scrolled backwards. If you scroll it forwards two clicks it will have a value of -240.
Again this works with multiple mice.


You can set or read the x, y, and z (scroll wheel) positions at once with Mouse.DirectInput3D. It is measured in Mickeys, even though technically z shouldn’t have units. It works with multiple mice.

Mouse.WheelUp and Mouse.WheelDown

This will be true for an instant (well, a single frame, or a 40th of a second) when you scroll the wheel up or down. You can also set it, if you want to simulate the user scrolling the wheel up or down.

It does not work with multiple mice yet.


If the mouse has a horizontal scroll wheel, or a vertical scroll wheel that can tilt from side to side, then in theory you can read or set the horizontal scroll wheel position with Mouse.DirectInputH. I have no idea whether it works, since it is largely based on guess-work and I don’t have a mouse with horizontal scroll wheels.

I don’t know whether this works with multiple mice, or the system mouse, or both. If you do any experiments and find out, please let me know.

Mouse.WheelLeft and Mouse.WheelRight

This is the horizontal equivalent of Mouse.WheelUp and Mouse.WheelDown. It is purely theoretical, and probably doesn’t work.


Mouse.WheelPresent is true if one of your mice has a scroll wheel, or false if none of them do. It doesn’t work for individual mice yet. You can’t set it, you can only read it.


The mouse.WheelScrollLines value is equal to the number of lines of text that will be scrolled in most applications when you move the scroll wheel one click (or 120 units if it doesn’t click).

Mouse.CursorPosX and Mouse.CursorPosY

The other way of thinking about the mouse position is to use the cursor, rather than the physical movement of the mouse on the desk. The Cursor position is measured in pixels. The number of pixels on the screen in each direction is called the resolution. It is usually around about 1024 horizontally and 768 vertically.

Remember that many games ignore the position of the proper cursor, so for these games you need to use the DirectInputX and DirectInputY values above instead.
There is only one real mouse cursor, and it is shared between multiple mice. So you can’t use numbers before the dot to read or set the cursor position for individual mice. If you want more than one cursor you need to use Fake Cursors.
mouse.CursorPosX is the horizontal coordinate of the cursor. 0 is the left edge of the primary monitor. The right edge of the primary monitor is one less than the horizontal resolution of the screen. eg. 1023. You can tell what the resolution of the primary monitor is by reading screen.width.
Note that if the cursor is on a different monitor from the primary monitor then mouse.CursorPosX will be either less than 0 or greater than or equal to the width of the primary monitor. You can tell what the left edge of the left-most monitor is by reading screen.DesktopLeft. You can tell what the right edge of the right-most monitor is by reading screen.DesktopRight. You can also read screen2.left, screen3.left, etc. to find the left edges of individual screens. The same with the right hand sides.
mouse.CursorPosY is the vertical coordinate of the cursor. 0 is the top edge, and the bottom edge is one less than the vertical resolution. It will be outside this range for multiple monitors. Use screen.DesktopTop and screen.DesktopBottom to tell the top and bottom maximum values for all monitors.
You can also write Cursor.PosX and Cursor.PosY instead, to set the cursor position. It works the same as Mouse.CursorPosX and Mouse.CursorPosY. Don’t use a number after the word “cursor” though, or it will set fake cursors rather than the real one.
If you have a Plug & Play monitor, then GlovePIE can tell roughly what the physical size of your screen is. You can therefore set the location of the cursor in real world units. For example, to set the cursor to be 10 cm to the right of the left edge of the primary monitor, you would write this:
mouse.CursorPosX = 10 cm
You can also get the physical width of the screen like this:
debug = screen.width in cm
GlovePIE will automatically convert between pixels and real world units, so watch out! That may not be what you want.
For example:

mouse.CursorPosX = mouse.DirectInputX

will make the cursor on the screen move the same physical distance that you moved the mouse. If you moved the mouse 1 inch, it will move the cursor 1 inch. That is fun to try, but a pain for people that are used to mice.
If you don’t want to convert the units, try this instead:
mouse.CursorPosX = RemoveUnits(mouse.DirectInputX)
Normally you just set the cursor position using pixels, eg.
mouse.CursorPosX = 512

Share with your friends:
1   ...   6   7   8   9   10   11   12   13   ...   30

The database is protected by copyright © 2019
send message

    Main page