This can be used to set the cursor which should always be displayed when the mouse is over the PIE window. It will even stay that way after your program exits, until you restart PIE, or write a script to set it back to 0. It uses the same numbers as above.
This isn’t all that useful, but may be useful for displaying what state your script is currently in. eg.
if joystick1.Button1 then
mouse.PermanentCursor = 11
mouse.PermanentCursor = 0
Swallowing the Mouse
Not as tasty as it sounds. This is actually about stopping windows from receiving real messages from the System mouse (that is from all the real mice), but still receive those messages that are set by GlovePIE.
This only works on Windows 2000 or above. And I don’t think it works with DirectInput games.
It is mainly for use with fake cursors, or with multiple mice. But it can also be used to disable the mouse for any other purpose.
Mouse.Swallow can be set to true to disable the entire mouse, or false to not do that. This prevents the mouse from doing anything in Windows. But you can still set Mouse.LeftButton or Mouse.CursorPosX or whatever to control the mouse cursor. It just won’t be controlled by any of the real mice.
Mouse.SwallowButtons is the same, but it only disables the buttons.
Mouse.SwallowMovement only disables movement.
Mouse.SwallowWheels only disables scroll-wheels.
An unfortunate side-effect of swallowing the mouse is that clicking on GlovePIE’s title bar by controlling the mouse with GlovePIE will temporarily make it hang until you press Alt+Tab, or wait umpteen seconds.
Swallowing the mouse is good for when you want one mouse to control the real cursor, and all the other mice to only control fake cursors. The trick is the swallow the mouse, then set all the mouse values to match mouse1. Then you set the fake cursors to match mouse2.
See the MouseParty.PIE script for an example.
Last, but not least, you can tell if there actually is at least one mouse plugged in by using Mouse.Present. It will be true if there is a mouse (or track-pad, or other mouse-like device), and false if there isn’t.
In addition to the real mouse cursor, GlovePIE can show multiple fake cursors. These fake cursors look and behave just like the real cursor, and can do most of the same things. They are not quite perfected yet though.
Fake cursors will look funny (non-transparent) if you don’t have at least Windows 2000.
Fake cursors are identified by a coloured number in the bottom-right hand corner. Different numbers are different colours, but it repeats eventually.
Fake cursors could be controlled by multiple separate mice, or they could be controlled by other devices, like keyboards, joysticks, VR Gloves, speech, or whatever. They can even be used when you just want to display values graphically in GlovePIE, for debugging or whatever.
You can create fake cursors with a number between 0 and infinity. You don’t have to use them sequentially. You can show only fake cursor 3 and fake cursor 5 if you want. But using big numbers will waste memory.
See the MouseParty.PIE script for an example of using fake cursors.
Fake cursors have much the same properties as the ones for mouse.
Note that the special properties for fake cursors aren’t displayed in the code-completion box for cursor, the box only displays the same properties as for mouse because I was too lazy to fix it.
But some of the new properties are:
Any fake cursors that you mention are visible by default. You don’t need to set a fake cursor to visible if you want to be able to see it. But you can set it if you want to hide it or show it again. Somewhere in your script write:
Cursor2.Visible = false
If you don’t want to see fake cursor number 2 anymore. You don’t have to use number 2, you can use any number. But using both fake cursor 1 and a real cursor is confusing, since people think of the real cursor as being cursor 1, even though it isn’t. You can even use fake cursor 0, which is also not the same as the real cursor.
Making a cursor visible doesn’t make it do anything. Fake cursors don’t respond to mouse movements. They only go where they are told to go, and click when they are told to click.
Fake cursors can rotate like on a Wii:
Cursor1.roll = Wiimote.Roll
Cursor1.x = Wiimote.PointerX
Cursor1.y = Wiimote.PointerY
Roll is measured in degrees, clockwise.
Fake cursors can change colour:
Cursor1.colour = [1, 0.5, 0] // red, green, blue
Cursor1.colour = 0xFF8000 // the same as above
Setting colour will only change the coloured parts of the image. The white and black parts of the cursor will stay the same.
You can also change the colour of the white that is in the image by setting Cursor1.WhiteColour. This doesn't just affect the white and grey parts of the image. It also affects the white that is mixed into other colours to make them paler. So for example you could make the white make colours redder instead of paler.
You can also set the caption. By default the caption is the fake cursor's number. But you can set it to anything you want:
You can also change the cursor image to a cursor loaded from a file:
Cursor1.image = "c:\data\mycursor.cur"
If you use an animated cursor, it will not be animated.
Cursor2.Shift and Cursor2.Ctrl
Sometimes applications respond differently to Shift-clicks or Ctrl-clicks. That is when you hold down shift or control, or both, while you click.
Most non-game applications don’t read the keyboard to check this though. Instead they rely on the information that comes with the mouse message to determine whether shift was held down or not.
The good thing about that is that fake cursors can have their own Shift-Click and Control-Click features without using the real shift or control keys. It also means multiple users can be regular-clicking and shift-clicking at the same time without interfering with each other.
So to shift-click with a fake cursor you need to set Cursor2.Shift to true before the mouse button is set. It isn’t enough to hold down the real shift key.
Cursor2.shift and Cursor2.ctrl can be either true or false.
For example, to control cursor2 with a joystick you might write:
Cursor2.Visible = true
Cursor2.Shift = joystick.Button4
Cursor2.Ctrl = joystick.Button5
Cursor2.LeftButton = joystick.Button1
Cursor2.RightButton = joystick.Button2
Cursor2.MiddleButton = joystick.Button3
Cursor2.x = MapRange(joystick.x, -1, 1, 0, 1)
Cursor2.y = MapRange(joystick.y, -1, 1, 0, 1)
To shift click you would need to hold down button 4 while you click button 1.