Ir a contenido


No te pierdas nada a la vez que nos apoyas desde las redes sociales.

Últimos comentarios

Información del archivo

  • Añadido el: Jan 04 2008 04:04
  • Actualizado el: Jan 04 2008 04:04
  • Tamaño: 2.29MB
  • Visitas: 9983
  • Descargas: 582

Descargar GlovePIE v0.30

[quote name='Carl Kenner']=================================
Programmable Input Emulator (PIE)
Version 0.30 (31 December 2007)
Copyright © Carl Kenner 2004-2007

Control games and applications any way you want.
Send fake keyboard keys, jostick actions, mouse moves, midi input or speech input to any program.
Use a VR Glove, Wiimote, SIXAXIS, a keyboard, joysticks, mice, touchpad or a microphone to control any program.

GlovePIE is Copyright 2007 by Carl Kenner, except for the scripts by other authors. By using this software you agree to obey the following license conditions:

* Playball Technology, Inc has exclusive rights to use this software for making money from commercial baseball simulations. However other people are free to make money from this program for non-baseball related things.

* You may not use this software directly or indirectly for any military purpose. This includes, but is not limited to, training, research and development, controlling military hardware, directing military personnel, or troop entertainment. You may not use this software anywhere on a military base or vessel. This applies to all versions of PIE. You may also not use it for playing ìgamesî produced by the military to recruit players as real soldiers, including Americaís Army. Sorry.

* You may not export this software to Israel, or use it in Israel (including the occupied territories), until Israel has ended its occupation of the West Bank, Gaza Strip, Lebanon, Syria, and anywhere else it may occupy, or until Israel abolishes apartheid (granting all Jews and non-Jews in its territories equal rights). If you try to run it in Israel before then, it will give you an error.

* You may not use this software to cheat at online or multiplayer games. What constitutes cheating depends on the game and the server. Just using a different input device shouldn't be considered cheating, but complex scripted actions to make things easier may be considered cheating. Don't get GlovePIE banned, or you will hurt everyone who wants to play with a VR glove. But feel free to cheat at single player!


Files you MUST have:

DirectX 8 or above (DX8 is included in Windows XP and most games)

Files you SHOULD have to get the most benefit:

The latest version of GlovePIE:

PPJoy (for emulating the joystick)

MIDI Yoke (for emulating MIDI input devices)

LibUsb-Win32 (for the Playstation 3 SIXAXIS, either Filter or Device version)

A Bluetooth Stack, such as Bluesoleil (which doesn't work on vista), if you use Bluetooth

SAPI 5.1 or above (for speech and voice commands)
If you want speech recognition (recommended):
  You need the version of SAPI which includes the Microsoft Recogniser.
  Longhorn will contain Recogniser version 7.0, but its not really ready yet.
  If you have Microsoft Office 2003 then you have the latest real version (Recogniser 6.1).
  If you have Microsoft Office XP (2002) then you have version 5 which you may be happy with.

  Otherwise if you have a professional or server version of Windows 2000 or above
  then you can get the latest version (6.1) with the Internet Explorer Speech Add-In here (65Mb):

  The rest of you can try SAPI 5.1 with recogniser here (50Mb):

  Or the SAPI 5.1 SDK is here (68Mb):

If you only want speech synthesis:
  If you have Office XP (2002) or above or Windows XP then you should have speech synthesis already.
  If you have the Internet Explorer Speech Add-In or SAPI 5.1 then you have it too.
  Otherwise you only need to download this (6Mb)
  (If you can't run MSI files download microsoft installer)

Extra speech synthesis voices:
  If you don't have Mary and Mike (because you have Windows XP) then you can get them here:
  (If you can't run MSI files download microsoft installer)

  If you want Michael and Michelle then you need to install Microsoft e-book Reader,
  then install Microsoft Reader Speech pack then (optionally) uninstall Microsoft Reader.

  If you want high quality realistic speech, then you need to download the trial version
  of one of the Cepstral voices. You can try the demos and download them here:
  The voices that are only 20Mb aren't as good, but 100Mb or 60Mb seems extravagant.
  The demos sometimes add a nag message to the spoken text. Please don't use a keygen
  to crack them because these voices are good and you can buy them for only $30.

  If you want languages other than English then you can find them somewhere. But PIE only
  displays the western european font currently.

Windows 2000 or above (if you want keyboard emulation to work in games)
  You have to buy this if you want keyboard emulation to work in DirectX games. Sorry.

P5 Dual Mode Driver (included)
  PIE comes with the latest version, but I may someday make a later version. You can get it here:
  If you don't want to sign up then use username:p5glovefiles password:blahblah

What's new in Version 0.30
See documentation.rtf and whatsnew.txt
* SIXAXIS support (USB only, everything working except bluetooth)
* Wii Guitar Hero 3 controller support
* Wii Fit Balance Board support
* Novint Falcon support
* VR920 Virtual Reality HMD support
* XBox 360 controller support (untested)
* Touchpad support
* 3DConnexion SpaceBall support
* TrackIR emulation
* Improved TrackIR support (untested)
* PS3 BD Remote support
* GlovePIE Can display 3D graphics for visualisation
* Swallow function for swallowing keyboard keys
* "Any" object, for any kind of wiimote/gamepad/sixaxis to seem the samne. eg. Any.Joy1x, Any.RightTrigger, etc.
* Translation support, edit the INI files to add your language
* Vista support (mostly)
* Fake Cursor roll (fake cursors can rotate like on a Wii)
* Wii-like hand cursor available
* Fake cursors can be set to custom colours or images
* Fake keys now repeat like normal keys, or can be set to repeat multiple keys at once (unlike a real keyboard)
* Smooth function doesn't crash so much
* Code completion doesn't pop up when empty (eg var.)
* Wiimote is no longer counted in the joystick.count
* PPJoy digital goes up to 40 instead of 32 (needed for POV hat switches)
* "/tray" command line option to minimize to system tray
* Euro and Dollar keys on Acer Laptops added (but need to close LaunchManager for GlovePIE to see them)
* Units of weight and force added, unit multiplication fixed
* Matrix array elements now work
* Midi pitch wheel bug fixed
* Joystick.AnyButton
* Starting() function instead of "if not var.initialised"
* Other things that I forgot

What's new in version 0.29
* Minimize to System Tray button
* Recent Files menu
* OutputToFile( ) function to write values to output.txt
* Division by zero no longer crashes compiler
* Automatically connect Wiimotes when you press 1+2
  (bluesoleil only, you need to do it manually with other stacks)
  Hold Power button to disconnect Wiimote.
* Wiimote speaker supported (single notes only, no wave files)
* Classic Controller support fixed and tested
* Wiimote.SmoothPitch and Wiimote.SmoothRoll now calculate angles
  without seperating out the acceleration, for smooth (but
  inaccurate) angles when your hand wobbles.
* "Press X" now works without brackets
* "100Hz" now works without space
* Numbers allowed after dot, "Wiimote.1" works like "Wiimote.One"
* Infinity and NaN are now valid numbers.
* Other compiler improvements
* Improved documentation
* More scripts! Play old Zelda, Mario, or Metroid games with the
  exact same controls as the modern Wii game.

What's new in version 0.28
* Running scripts from command line works again
* New function: DeadZone(wiimote.nunchuk.joyX, 10%)
* Wii Classic Controller support (theoretical)
* Can now tell the difference between classic and nunchuk
* Nunchuk built-in calibration supported
* Nunchuk no longer reduces performance of other reports
* Note, when IR and Nunchuk are used together dot size is no longer available

What's new in version 0.27
* Nunchuk support
* Setting channel to 0x3E or 0x3F no longer prevents Wiimote forces from working.

What's new in version 0.26
* TroubleShooter > BlueTooth Fix menu, for other bluetooth stacks.

What's new in version 0.25
* WiimoteScripts folder
* Wiimote battery level
* Wiimote normalized gx, gy, gz force values (0=none, 1=gravity)
* Wiimote pitch, roll, and rotation matrix, seperate from movement
* Wiimote raw accelerations in m/s/s with gravity
* Wiimote relative accelerations without gravity
* Calibrate Wiimote manually, or use Wiimote's own built in settings
* Access BlueSoleil window from CP-Settings > BlueTooth menu
* Extract Miis from Wiimote (From File menu)
* MIDI no longer gives error if no input device
* Various other bugs fixed, and new bugs introduced

What's new in version 0.24
* GlovePIE now runs in Europe without crashing on every decimal point!
* Wiimote bugs fixed, and tested. It should work now.
* Wiimote.Expansion is a number representing which expansion is plugged in.
* WiimoteDumpBytes(wiimotenumber, address, count) reads count bytes from the
  Wiimote's memory and displays it in the debug window.
* TestWiimote.PIE now shows IR cursors.

What's new in version 0.23
* Multiple Wiimote support
* Wiimote not working the second time bug fixed
* Support for Wiimote Sensor Bar (aka candles, christmas tree lights, IR remote controls, etc)
* Nunchuk no longer stops Wiimote buttons from working
* Other Wiimote features

What's new in version 0.22
* Included correct version of this file this time :-)
  (Read the section below which wasn't included last time, oops)
* Wiimote support (partial)
* Wiimote works with "detect input" button in GUI
* Concept 2 PM3 Rowing Machine Support
* TrackIR, OptiTrack and SmartNav support.
* FakeSpace Pinch Gloves support (9600 baud default)
   to use FakeSpace Pinch gloves at a different baud rate,
   set pinch.baud115200 to anything anywhere in your script,
   or whatever baud rate you have your dip switches set to.
* WorldViz PPT added to GUI.
* Flock of Birds fixed in GUI.
* Fixed > being displayed as >= in GUI.

What's new in version 0.21
* eMagin Z800 3D Visor HMD support (partially tested)
* 5DT DataGlove support (untested)
* Intersense tracker and wand support (untested)
* Ascension Flock Of Birds and other trackers support (untested)
* Polhemus Fastrak and IsoTrak II trackers and others (untested)
* WorldViz PPT tracker support (untested)
* Even more improved GUI!
** Auto-detect buttons! Just do the action you want to emulate, then the action you want to trigger it.
** Hides parts of GUI until you need them.
** Only lists most common values in drop-down box unless you click "More..." button.
** Better selects most appropriate ranges and mappings.
* Shortcut keys (when program isn't running).
* Help menu links to GlovePIE website and Yahoo group
* New command line parameters /p:  eg. "/r:notepad" "/p:whatever.txt", will open whatever.txt in notepad
* Apps specified on command line are now run after your script is started, so they are foreground.
* More low level P5 support (p5.TopSensorHAngle, p5.HeadSeparation, p5.Led0err, etc.)
* Running script from command line bug fixed. GlovePIE -script.pie  no longer gives an error.
* Multiple keyboards without multiple mice bug fixed (the lazy way).
* Half-running, half-stopped bug fixed.
* Can now import e-Speaking files (look in My Documents for the xml file).
* Window.BeforeDash, Window.AfterDash, Window.AppName, Window.FileName
* License now prohibits cheating online

What's new in version 0.20
* PIE SOMETIMES MINIMIZES DIFFERENTLY!!! With scripts involving multiple cursors, it will minimize to the desktop, not the taskbar.
  And you have to restore it from the desktop, not the taskbar. Sorry.
* OSC Support
* Improved MIDI GUI
* More accurate and responsive frame rate, may use more CPU though, set PIE.FrameRate to change it.
* Force Feedback Gamepad support
* Speech recognition bugs which stopped it recognising half the time have been fixed
* New AskedFor(" ") speech recognition function (only partially implemented)
* Multiple mouse support (windows XP and above)
* Multiple mouse cursors (windows 2000 and above)
* Swallow mouse input (windows 2000 and above)
* Horizontal mouse wheel support (in theory)
* Mouse.WheelUp, Mouse.WheelDown, etc. now work (but not for multiple mice)
* Delta function, tells you how much a variable has changed since last frame
* partial OSC support
* Fixed bug which required space before units
* Fixed bug with negative powers
* e^2 now works like you would expect
* Pie.Frame tells you what Frame PIE is up to
* Pie.Epsilon is now set to 1, meaning ~= only requires them to be within 1 unit
* Windows 95 is temporarily not supported (due to a bug in Delphi 6),
  although it may still work if you have updated some windows components.
* Imports lots of different file formats
* Doesn't import the latest version of P5Midi yet. Sorry.

To get the multiple mouse cursors to work I had to change the way PIE minimizes. This only happens with scripts that use multiple cursors.
Now when you minimize the main PIE window it appears as a bar in the bottom
left corner of the desktop. You have to click PIE's taskbar icon then restore
the main window from the bar in the bottom left corner of the screen. Sorry
about the inconvenience.

Mouse stuff
You can read individual mice. But you can't set individual mice (you can set
individual cursors though).

To read multiple mice, just put a number after the word mouse and before the dot.
eg. to have the mouse 2 buttons control the keys A S and D use this code:

key.Q = mouse1.LeftButton
key.W = mouse1.MiddleButton
key.E = mouse1.RightButton
key.A = mouse2.LeftButton
key.S = mouse2.MiddleButton
key.D = mouse2.RightButton

If you want to read the movement of multiple mice you need to use
mouse1.DirectInputX etc. because the other items (like mouse1.x) refer to
the CURSOR and multiple mice don't have their own cursors.

Without a number, mouse.LeftButton will register ANY mouse's left button.

There is also mouse0 which is a virtual mouse used for Windows Remote Desktop
(Windows XP Professional only).

You can also use multiple mouse pointers (which can be controlled by anything,
not just mice).

eg. to add a second cursor controlled by the keyboard:

Cursor2.Visible = true
Cursor2.LeftButton = Key.LeftCtrl
Cursor2.RightButton = Key.RightCtrl
Cursor2.CursorPosX = var.x2
Cursor2.CursorPosY = var.y2
if Key.RightArrow then var.x2++
if Key.LeftArrow then var.x2--
if Key.UpArrow then var.y2--
if Key.DownArrow then var.y2++

You can have as many cursors as you want.

"cursor" by itself controls the real mouse cursor. You can also use additional
cursors called "cursor0", "cursor1", "cursor2", etc. They will have a little
coloured number next to them.

The extra fake mouse pointers will not work perfectly, and they use up lots of
CPU. They require Windows 2000 or later or they will have a solid rectangular
box behind them.

You can swallow all mouse input from the system mouse like this:

mouse.swallow = true

(be very careful doing this, since you can no longer press the stop button with
the mouse)

Or you can swallow only certain kinds of mouse input like this:

mouse.SwallowMovement = true
mouse.SwallowButtons = true
mouse.SwallowWheels = true

That will not affect DirectInput applications. If you don't swallow mouse input
then mouse1 and mouse2 will both move the real system cursor, which is probably
not what you want in a multiple mouse pointer situation.

Swallowing the mouse input will not affect movement or button presses you set
in PIE.

To have only mouse1 control the real system mouse pointer you need to do this:

mouse.Swallow = true
mouse.LeftButton = mouse1.LeftButton
mouse.MiddleButton = mouse1.MiddleButton
mouse.RightButton = mouse1.RightButton
mouse.DirectInputX = mouse.DirectInputX + Delta(mouse1.DirectInputX)
mouse.DirectInputY = mouse.DirectInputY + Delta(mouse1.DirectInputY)

Warning! Do not click on PIE's title bar in this mode or it will freeze for a
few seconds. Alt+Tab will unfreeze it if you are impatient.

To read the mouse wheels' positions, use this:

mouse.DirectInputZ  // vertical wheel
mouse.DirectInputH  // horizontal wheel

You can now read and set WheelUp, WheelDown, WheelLeft and WheelRight:

Mouse.WheelUp = key.UpArrow

Key.z = Mouse.WheelDown

But reading mouse1.WheelUp etc. is not enabled for multiple mice.
(You need to read their mouse1.DirectInputZ instead).

Delta Function
Are you sick of setting "var.Oldx = whatever" at the end of your script just
so you can tell how much x has changed?

Well now you don't have to. You can use the Delta function on anything to find
how much it has changed since last frame.

For example, "debug = delta(mouse.CursorPosX)" will tell you how much the cursor
has moved horizontally since last frame.

OSC Stuff

PIE supports Open Sound Control over UDP. That is kind of like MIDI.

You can only pass single variables.

First you need to set the port, the destination IP address, and whether you
want the message broadcast to everything connected to the network.

OSC.Port = 47110
OSC.IP = ""
OSC.Broadcast = false

Actually if you don't specify the IP address it defaults to "localhost". If you
set Broadcast to true then the IP address is ignored, so you don't need to
specify it. If you don't specify the port it defaults to 47110. If you don't
specify broadcast then it defaults to false.

Then you can send OSC messages like this: = 42.6

That will set the OSC address /blah/foo/bar to the single precision floating point value 42.6

You can also use the SendOsc(ip, port, address, param1, param2, param3, ...)
and the BroadcastOsc(port, address, param1, param2, param3, ...)

Version 0.19
This version is still buggy, but my copy of Delphi won't run anymore so I can't fix it for a while.
So I'm releasing what I've done so far. The next version will have to wait until I can get Delphi
running again.

* Doom 3 script demonstrating real walking, jumping, crouching and turning!!!!!
  This took a lot of effort, and I highly recommend trying it out, even if you don't have Doom 3,
  it can be tested on its own, or with some other first-person shooters (that use END to center the view).
  It's really cool once you get the hang of it, but practice on level 1 first!
* Vector support eg. var.v = [1,-3,2] cm
* Other vector sytax eg. var.v = 1i -3j +2k  (Note! you need the 1 in front of the i)
* Vector element support eg. var.x = var.v[1]
  or like this eg. [var.x, var.y, var.z] = var.v
* 3x3 Matrix support. eg. var.m = p5.RotMat
* Dot product operator eg.   var.w = var.v . var.u
* Factorial and DoubleFactorial operators eg. var.x = 3!
* Approximately-equal operators eg. if var.x ~= 1.05 then beep
  You can set PIE.Epsilon to the maxium difference tolerated, usually 0.01
  There are also the folllowing operators:  ~=  ~!= ~> ~< ~>= ~<=
  When used with strings they do case-insensitive comparison.
* useless tetration operator eg.  var.a ^^ var.b
* Can call any function in any dll eg. User32.dll.MessageBox(NULL,'hello','PIE',0)
* Variables tab to view values of all variables while running
* Read angles of finger joints... eg. P5.IndexProximal, P5.IndexMiddle, P5.IndexProximal
* standard string functions
* Added pi constant
* Tell why the glove isn't visible:
p5.TooFarLeft, p5.TooFarUp, p5.BehindSomething, p5.SwitchedOff, p5.UntrackableAngle, etc.
* Fixed lots of hand orientation bugs
* Fixed p5.LedsVisible bug
* Fixed bug preventing variables from being boolean
* Fixed trig functions with no units specified
  (defaults to degrees unless expressed in terms of pi)
* Boycott of Israel is enforced by code
* Importing shoot, game commander and P5midi works from Command Line
* New troubleshooter options, eg. Contrasting Colours if you can't see clearly
* New bugs: units now require a space between them and the number, eg "5 cm" instead of "5cm"
* New bugs: P5.IndexPos doesn't work because I disabled it just before Delphi crashed :-(
* New bugs: It seems to hang sometimes, but pressing Ctrl+Alt+Delete may fix it (don't terminate it,
            just use Ctrl+Alt+Delete and then Switch-To or Cancel)

Version 0.18:
* Windows 95/98 keyboard emulation
* Search and replace
* String comparisons now work
* miles, miles per hour, and megahertz now work
* units for musical intervals: semitones, cents, octaves, majorseconds, minorthirds...
* MIDI RPNs: MasterTuning and PitchBendRange
* said() now works better, and has optional extra confidence-required parameter
  eg. said("Hello",3)
  0 = no confidence (false recognition)
  1 = low confidence guess, 2 = medium conf guess (default), 3 = high conf guess
  4 = low conf full recognition, 5 = medium conf full recog, 6 = high conf recog
* Lots of microphone properties
* Push To Talk microphone properties
  (set enabled to true/false, then override with PushToTalk and PushToNotTalk)
* speech input EMULATION (eg. microphone.CompletePhrase := "hello")
* Speech synthesis in multiple voices (eg. speech.sam.text = "hello")
* Speech synthesis properties (eg. debug = speech.visime)
* window properties
* Sequence gap and duration settings (eg. Pie.SeqGap = 50ms)
* Open p5midi *.p5m files  (P5midi emulates midi with p5)
* Open Game Commander *.gcc (Game Commander emulates keys with speech)
* Open Shoot *.xml profiles (Shoot emulates keys with speech)
* => and assignment successfully compile more often
* Key.Apostrophe now works, plus some other keys have more names
* Wait command can now be used in sequences
* StopScript crash fixed
* Syntax highlighter doesn't crash so easily
* Midi.ChannelPressure (aka Midi.ChannelAftertouch) now compiles
* Clicking on an error in the error box now stops the program so you can fix it
* Tooltips (yellow hints) now pop up over controls to help you
* Improved screen layout for people running at other resolutions
* Log file for debugging PIE



Version 0.17:

* Saving and exiting now works like any other application. Including File|Save menu, and confirmation to save if new, exiting, or loading and the file has been modified.
* Voice commands! Speech recognition with the said("whatever") command
* Support for some brands of remote controls used with Pinnacle/Miro PCTV receptor (must set in menu each time)
* Recognition and emulation of sequences of actions... eg. var.GodMode = I,D,D,Q,D
* New implies syntax: a => b  now does the same thing as b = a
* New commands/procedures: Say, PlaySound, Display, StopScript, ExitPIE, Execute, Chain, Beep, ControlPanel, MinimizePie, AddCodeLine, etc.
* Commands can be set like variables, eg.  ExitPIE = Alt+X
* Key combinations can be set in one go, eg. Ctrl+C = p5.ButtonA
* Alternative ^ syntax for control+key combinations, eg. ^C = p5.ButtonA
* Control, Shift, Alt and Windows now recognise either key, rather than mapping to LControl, LShift, LAlt and LWindows.
* for loops and while loops
* if (something) and (something) now works properly
* Screen object (currently read only) for getting information about the screen (eg Screen.Width).
Supports multiple monitors (eg. screen1.Width, screen2.Width)
* Plug & Play monitor support! Read the physical size of your plug and play monitor (eg. screen.PhysicalWidth)
* New Units! Pixels (size varies depending on resolution), PieFrames (currently 24ms), and Mickeys (400 per inch)
eg. Debug = mouse.CursorPosX in cm
* More natural language features... eg. if alt but neither shift nor control then
* Variables now store their type and units and can store strings
* Fixed bug causing C and Java style integer division (5/2 should be 2.5 NOT 2!!!)
* Improved syntax highlighter
* Improved performance of long sequences of OR or AND operators
* Text area greyed out and has keyboard focus when running, so generated keys do nothing harmful
* More key aliases, such as NumPadDot for Decimal
* Reserved words and unit names are no longer reserved or misrecognised when used after "."
* Assigning to object properties now converts units correctly
* Code completion bug fixed
* key.Minus and "debug = p5.x minus 100" now both work, but "debug = minus 1" doesn't work.
* Setting mouse.x, mouse.VirtualDesktopX, etc. now works. Reading mouse.VirtualDesktopX now works.
* Preliminary documentation


Version 0.16:

* MIDI note velocity bug is fixed so you can now set the velocity of notes.

* You can now turn the P5's mouse-mode on and off like this:
p5.MouseMode = true

* You can check whether a glove is lefthanded like this:
if glove1.LeftHanded then ...

* There is a Smooth function which lets you smooth out any value:

// will go smoothly from 0 to 1 when you press it
debug = smooth(key.LeftShift)

// will average the previous 12 frames + the current one, and round the
// answer to the nearest cm
debug = smooth(p5.RelativeX, 12, 1 cm)

* The Pressed function and others like it now work properly.

* The HeldDown and KeepDown functions now allow you to specify the
units for the time.

* Glove orientation is now easier to work with. You can now check it like this:

// The palm is closer to facing down, back and to the left than to any
other direction
if p5.PalmLeftDownBackStrict then ...

// The thumb is facing vaguely in the direction of up forwards and to the left
if p5.ThumbLeftUpForwardVague then ...

// The fingers are within 30 degrees of facing diagonally forwards and
// to the right
// (at least they would be if they were straight, this is hand orientation only)
if p5.FingersAngleFromRightForward <= 30 degrees then ...

The glove orientation now checks whether it is a left or right-hand. So this:
debug = p5.ThumbUp
will now work correctly for either hand (previously you would have to
point your thumb down if it was your left hand).

* There is now a generic p5.speed variable so you don't have to
manually square, add and squareroot the xvelocity, yvelocity and

Version 0.15:

Sings Christmas carols (see Christmas.PIE)
Getting Started documentation
IF statements are more flexible (eg. ELSE is allowed now)
Speech synthesis support
Joystick read bug now fails silently (no million popups)
MapRange function
Wait command (for Macros)
press and release commands
a couple more example scripts
key.Minus now works (but "debug = p5.x minus 100" doesn't anymore)
No divide by zero error if run without a P5 Glove plugged in.
Can access raw P5 LED data
Some other bug fixes
New Dual Mode driver version included
Improved user interface
Added extra license condition (sorry, blame my employer!)
BASIC style hexadecimal notation allowed (&hF3 means 0xF3)

Version 0.14:

What's new in 0.14:

You can use and convert units (eg. Metres)
Command line parameters
Support for multiple joysticks
Easy P5 finger gestures (eg. p5.xlnnn)
Easy P5 orientations (eg. p5.PalmDown and p5.FingersRight)
P5 filter modes can be set
New in set operator (eg. if var.value in {1, 3, 7, 2} then )
Support for MIDI percussion
Can specify the default MIDI device and channel
You can now move the mouse in DirectX games
Midi device numbering bugs fixed
Midi instruments are now numbered from 1 to 128
Syntax highlighter now recognises "}" style end if
Debug box expanded and improved
Save confirmation
General bug fixes and tidy ups

Values and functions now have units. (But variables do not).
You can view the units along with the value in the debug box.
eg. debug = p5.xvelocity

You can specify the units for an expression like this:

debug = 10 metres per second per second

You can use different units together like this:

debug = 5 metres + 31 cm   // this will give 5.31 metres

You can convert things to other units like this:

debug = (5 metres + 31 cm) in feet

The following units are supported:

Distance:  Kilometres (km), Metres (m), Centimetres (cm), Millimetres (mm),
           P5Units, Feet, Inches
Time:      Years (yr), Days, Hours, Minutes (min), Seconds (s),
           Milliseconds (ms), Microseconds
Frequency: Hertz (Hz), Kilohertz (KHz), Megahertz (MHz)
Angles:    Degrees (deg), Radians (rad), Revolutions
shorthand: kph = kilometres per hour, mps = metres per second,
           rpm = revolutions per minute

Units support is not perfect yet. Multiplying, dividing and exponents don't
change the units correctly. Plus there are other bugs and weird things.

Command Line

The following command line options are supported:

-FileName = load and run FileName.PIE
/r:ExeName = execute external program ExeName (eg. your game)
FileName = load, but don''t run FileName.PIE

NOTE! You must put "" around the whole option if it contains a space!
eg. PIE "/r:c:program filesgamerunme.exe" -runme.PIE

PIE will not automatically shut down when your external program ends. Sorry.

Multiple Joysticks

You can use multiple joysticks like this:
keyboard.Space = joystick2.x > 50%

Or you can chose joysticks by type like this: = joystick.ppjoy1.x > 50% = joystick.real1.x > 50% = joystick.gamepad1.x > 50% = joystick.joystick1.x > 50% = joystick.wheel1.x > 50% = joystick.flight1.x > 50% = joystick.firstperson1.x > 50%

Note that you still need to use ppjoy to set joystick values,
and joystick to read them. For example to increment a joystick's x axis:

ppjoy2.analog0 = joystick.ppjoy2.x + 0.1

Even though I just added the ability to specify a default MIDI device,
that isn't implemented for joysticks.

New P5 Stuff

You can check the orientation of the glove with these new true/false values:

p5.FingersUp p5.FingersDown p5.FingersLeft p5.FingersRight, p5.FingersForward,

p5.PalmUp p5.PalmDown p5.PalmLeft p5.PalmRight, p5.PalmForward,

p5.ThumbUp p5.ThumbDown p5.ThumbLeft p5.ThumbRight, p5.ThumbForward,

These only check the angle of the hand itself. The finger bends are irrelevant.
At least one of these values from each set will always be true
(except when no rotation has been measured yet).

Currently the thumb direction will be reported wrong on left handed gloves, but
this will be fixed later.

Another new thing is the finger gestures. You can specify how bent each finger
should be with only five characters!

l = straight
r = partly bent
n = completely bent
x = don't care

You use a sequence of five characters starting with the thumb.


var.pointing = p5.xlnnn
var.fist = p5.nnnnn
var.claws = p5.rrrrr

Combining the two new features you can do this:

var.ThumbsUp = p5.lnnnn and p5.ThumbUp and p5.FingersForwards

You can specify the maximum bend value for "l", and the minimum bend
value for "n" like this:

p5.maxl = 27
p5.minn = 48

You can set the P5 filters like this:

p5.FilterDistance = 0.7 cm
p5.DeadBandFilter = false

p5.FilterFrames = 10
p5.AveragingFilter = true

If you do not specify a midi device type and/or number then it will use the
default. You can now change what that default is at run time.
The same applies to channels.

if key.rightshift then
  midi.DeviceOut = midi.thru1.DeviceOut
end if

if not key.rightshift then
  midi.DeviceOut = midi.player.DeviceOut
end if

if key.leftctrl then
  midi.DefaultChannel = 10
end if

if not key.leftctrl then
  midi.DefaultChannel = 1
end if

midi.c5 = key.leftshift

Percussion instruments are now supported like musical notes.
You just specify them like this:

midi.bassdrum1 = key.leftalt

Note that percussion instruments are always played on channel 10 no matter what.

Changing the regular melodic instrument for a channel is done like this:

midi.instrument = 128  // gun shot
midi.c5 =

The instrument can be numbered 1 to 128.
If you prefer 0 to 127 you can do this:

midi.instrument0 = 127 // gun shot
midi.c5 =


There are several ways of using the mouse position

Mouse.VirtualDesktopX // write-only

CursorPos tells you the pixel of the cursor on screen.
x by itself tells you the cursor position as a fraction of the screen width
VirtualDesktopX tells you the cursorpos as a fraction of the multiple monitors
DirectInputX tells you the physical mouse movements and ignores the cursor

DirectInput is measured in mickeys, CursorPos is measured in pixels and
the others are fractions between 0 and 1.

CursorPos will not work in most DirectX games, since they use there own cursors.


Basically a PIE file looks like this:

something = something
something else = something else

If you want to write a really complicated PIE program you can also do this:

something = something
if whatever then
something else = something else
end if

The only other thing you can have in a PIE program is this:

// This is a comment

That's all there is to it. So let's see what the somethings can be...


The things you are trying to set can be keys on the keyboard, buttons
on the mouse, axes and buttons on the joystick, or notes and
controllers on a musical MIDI device.

The things on the right hand side that you are trying to use can be
keyboard, mouse, joystick or Virtual Reality glove.

To simulate the left control key when you press the A button on your
p5 glove you would write this:

keyboard.LeftControl = p5.AButton

To simulate the left mouse button when you press the B button on your
p5 glove you would write this:

mouse.LeftButton = p5.BButton

The joystick is slightly more complicated. If you want to simulate the
Joystick in PIE then you need to first download and install another
program called PPJoy from the internet. This program is freely
available. You also need to set up that program to add a virtual
joystick. Then you need use PPJoy to set the mapping for that joystick
to say how many axes and buttons it has, and which axes and buttons
they are. Then in your PIE program you can do this:

ppjoy.digital0 = p5.CButton

You probably set up PPJoy to use digital 0 as the first joystick
button, so this will simulate the first joystick button when you press
the C Button on the joystick.

You don't need to simulate MIDI to play HALO, so I won't bore you with that.

If you want to simulate the keyboard you can leave out the
"keyboard." part. If you don't specify the type of hardware, it will
assume you mean the keyboard. This is fine:

LeftControl = p5.AButton

The other case where you can leave out the type of hardware is for the


This will simulate the left mouse button when you press the B Button on the p5.

LMB = p5.BButton

It is not fussy about the names of the keys. It understands most of
the different names that keys have. Instead of LeftControl you could
have used any of the following:

LControl, LeftCtrl, LCtrl, Control, Ctrl

You can even use "key." instead of "keyboard.":

key.LCtrl = p5.AButton

Note that it is not Case Sensitive. You can use capitals or lowercase

On the right hand side, instead of AButton you could use any of the following:

ButtonA, A, Button1

You can also use "glove." instead of "p5.".  If you have more than one
p5 glove, then you can specify the number of the glove like this:

key.LCtrl = glove2.AButton

The syntax is very flexible. You can even write this:

Keyboard's LeftControl := ButtonA of glove2;

The semicolon at the end of the line is optional. Instead of the C
style assignment operator, you can use the Delphi one of :=

And instead of the "." you can use "'s " or "::" or "->" or " of ".
But if you use "of" then you need to reverse the order.

You can only have one statement per line, and one line per statement.


Code Completion will automatically pop up when you type a ".". It will
not pop up if you type any of the other things, like "::".

If the thing before the dot is a type of hardware then it will pop up
with a list of things you can set or read from that hardware. It will
only include one name for each.

If you want to get a list of the types of hardware, or things you can
use before the "." then press Ctrl+Space.


You can use mathematical operators to make more complicated
expressions on the right hand side.

For example, if you want to simulate the left control key when they
press both the A and the B button on the glove at the same time, then
you would write this:

LeftControl = p5.ButtonA and p5.ButtonB

You can also use OR or XOR or NOT.

With things that can either be true or false, you can use "+" instead of "and".

LeftControl = p5.ButtonA + p5.ButtonB

Mathematicians will tell you that this is not the way to do "and", but
to hell with them. I'm writing this programming language, not them.
I think you can also do "or" with "/", but I can't remember.

Some things are ambiguous, for example:
LeftControl = p5.A and p5.B or p5.C

This could mean that you have to either press both the first two
buttons, or just press the third one by itself. Or it could mean that
you have to either press the A and B buttons together, or the B and C
buttons together.

Because it is ambiguous it will give you an error when you try to compile it.
You need to put brackets around it like this if you mean the first one:

LCtrl = (p5.A and p5.B) or (p5.C)

Or like this if you mean the second one:

LCtrl = (p5.A) and (p5.B or p5.C)

Some things are analog rather than digital, and therefore have a range
of possible values. For example X, Y and Z position of the P5 glove.
In this case you can use other mathematical operators or comparisons.

key.w = p5.x < -200

This will simulate the W key if the x coordinate of the glove is less
than negative 200 p5 units.

All the P5 distances are measured in P5 Units. There are 51.2 P5 Units
in an Inch. This means one P5 Unit is about half a milimetre.

All the P5 angles are measured in DEGREES. They can range from -360 to
360 degrees. It can tell the difference between rolling your hand
right 270 degrees and rolling your hand left 90 degrees, even though
they end up in the same position.

All the joystick values are between -1 and 1. This means that if you
want to simulate the joystick using the P5 you must write something
like this:

ppjoy.analog0 = p5.x / 400
ppjoy.analog1 = -(p5.y / 400)

This means that if you hold your hand 400 P5 Units (8 inches) or more
to the right of the centre then it will count as moving the joystick
all the way to the right. If you hold your hand 8 inches to the left
it will count as moving the joystick all the way to the left. The
reason why the Y coordinates are negated is because on a joystick
positive Y means down, but for the P5 positive Y means up!

Note that all speeds are measured in p5 units per second.

Finger bends are measured as 0 to 63. 0 means straight. 63 means bent.

You can do integer division with DIV and MOD. They don't have to be
integers to do integer division. MOD returns the remainder. DIV
returns how many times it can completely divide into it.

5.7 div 1.5   is equal to 3
5.7 mod 1.5  is equal to 1.2
This is because 1.5 divides into 5.7 three times, with 1.2 remainder.
DIV will always return an integer.


The operator precedence is like this:

exponents ^ **
arithmetic * / + -   mod div
inequality comparison  < <= > >=
equality comparison = == != <>
boolean logic    AND  OR  XOR  NOT

mod and div can not be mixed with other arthmetic operators, including
themselves. You need brackets to avoid ambiguity.

Multiplication and division are done before addition and subtraction.

inequality comparisons can't be mixed. But you can use mathematical
range expressions like this:  200 <= p5.x <= 500  which means that x
has to be between 200 and 500.

and can't be mixed with or.


There are many mathematical and other functions you can use. Type
"math." to see a list of them in code completion.

All the Delphi maths functions are implemented. The delphi "hypot"
function has been expanded to allow an optional third parameter for
calculating 3D distances.

Sin, Cos and Tan all expect DEGREES.

eg. = sin(p5.roll) > 0.5

There are also some date and time functions.

The Now() function will give you the current date and time as the
number of days since whenever. It will contain fractions telling you
the time of day.

There are also some special functions for clicks and presses and such things.

Pressed(LeftControl)  will be true the instant when the Left Control
key is first pressed.

Released(LeftControl) will be true only for the instant when it is
first released.

There are also HeldDown, KeepDown, Clicked, DoubleClicked and
SingleClicked. See the recent email I wrote about them.

You need to include the brackets for functions. It does not currently
verify that you specified the right number of parameters. It will
ignore any extra parameters and may crash or use 0 if there are not
enough. I can't remember.

You can check if something is true and then do a bunch of stuff if it
is, by using IF statements.

It works like this:

if p5.y > 800 then
LeftControl = p5.Index > 30
LeftShift = p5.Middle > 30
end if

This means that while you are holding your glove up high you can
simulate Control by bending your index finger, and you can simulate
Shift by bending your middle finger. If you are not holding your glove
up high then wiggling your fingers will do nothing.

There are no ELSE statements yet. Sorry, they haven't been implemented.

The syntax of the IF statement is flexible. You can use C, Pascal or
BASIC style if statements, or a combination.

If (p5.x>800) {

if p5.x > 800 then begin

if p5.x > 800 then
end if

if p5.x > 800

If you use a bracket after the if then it will think you want to use C
Style if statements. The following will give you an error:

if (p5.y > 800) and (p5.x > 800) then
end if

So do this instead:

if ((p5.y > 800) and (p5.x > 800)) then
end if


You can use variables in your PIE programs to remember things. This is
good for two reasons. Firstly you can do complicated gestures that
require you to do a series of steps. Secondly you simplify expressions
and reuse expressions in several places.

You don't have to declare variables before you use them. You just
write "var." and then any name you like.

For example:

var.MovingRight = p5.x > 300
key.D = var.MovingRight

Comments do absolutely nothing, but they are very useful.
Any line that begins with "//" will be a comment and will be drawn in
pale purple. They don't effect what the program does.

You can check your program for errors by compiling it.
Chose "Compile" from the "Compile" menu.
If there are errors then a box will appear at the bottom of the window
with a list of the errors and their line numbers. You can single-click
on the error to go to that line number. The lines with errors will be
highlighted in red. If there are no errors then the box will not be
visible and it will say nothing.

You can run your program by chosing "Run" from the "Compile" menu. It
will automatically compile it before it starts running, so you don't
need to worry about that. It will still run if there are errors, but
the lines with errors will not be included in the program.

While your program is running it will display "[Running]" in the title
bar. It will continually loop through your program. Every time it gets
to the bottom it will wait 25 miliseconds then repeat again from the
top. It will simulate any keystrokes or joystick or mouse values that
you programmed while it is running.

To stop your program you need to chose "Stop" from the "Compile" menu.

By the way:
Don't forget to save your program before you exit PIE. It will not ask
you to save before you exit.


You can debug part of your program with the DEBUG object, like this:

debug = p5.x > 200

While your program is running a box will appear in the top right
corner with the value in it.


I hope people are actually using my Programmable Input Emulator. It is
an EXTREMELY powerful tool. And it is not as difficult to use as it
might first appear. I know it uses "programming" but it is really very
simple. Most "programs" are just like:

W = p5.z > -800
S = p5.z < -1000
A = p5.x < 200
D = p5.x > 200

Ctrl = p5.index > 30

Part of the idea was that people in the community would write their
own PIE programs for games and applications that they use or have, and
upload them so that other lazier people can use them.

So can people try it out and upload some PIE programs they have
written into the files section of this group, or just cut and paste
them into a message and send them out?

I'm just surprised that PIE even works on Windows 98.

I think you'll find that keyboard emulation won't work on Windows 98
with the current version of PIE. I can change this in a later version
of PIE, but I still won't be able to get keyboard emulation to work in
DirectInput games on Windows 98. At least not without a very different
technique (like hooking the DirectInput function calls, or writing my
own keyboard driver). I'm really sorry. It is just a limitation of the
Windows API in Windows 98. I will try and make a new version that will
emulate the keyboard in non-DirectInput programs on Windows 95 and 98.

Joystick emulation (with PPJoy), Mouse Emulation and MIDI emulatuion
should work on windows 98.

I have never had a problem with PPJoy and the pitch and yaw axes. It
might be Windows 98. Or it might be that your DirectInput version is
too old.

Absolute mode is completely absolute. It uses the absolute angles of
the LEDs and converts them into absolute LED coordinates. Then it
chooses the most accurate LED and uses its position combined with the
rotation measurement to work out the absolute position of the centre
of the glove. Unfortunately the hardware is not very precise so the
LED coordinates aren't quite exact, and the rotation is not always
calculateable, so it isn't always right.

X and Y should be 0 when your middle finger is pointing at the red
light on the front of the receptor.

I have never got the opposite extreme values you mention. When the
glove is out of range the current version of PIE will predict the
glove's current location based on its velocity and acceleration when
it left visibility. Prediction only works in filtered mode with the
BETA 2 DualMode driver.  If you run PIE with the BETA 1 DualMode
driver then it will just use the last detected position when you go
out of range.

The filtered absolute mode (which is what PIE uses when you use X, Y
and Z) will smooth out the values and use prediction to try and give
you the correct absolute location of the glove.

The maximum x and y values without using prediction are equal to the
current z value (only not negative). For example if the current z
value is -1000 then the maximum x and y values are 1000. I'm not sure
about the maximum z value. But I have not had any problem with
prediction giving me the wrong values when the glove is out of range.
Prediction is my friend.

When you say recalibrate the P5, I assume you mean recalibrate PPJoy's
virtual joystick. The P5 will not be controlling the virtual joystick
unless PIE or my other emulator is running. So the P5's location on
startup can not affect the virtual joystick's calibration. Personally
I have never calibrated the virtual joystick, and recommend leaving
the default calibration and adjusting your PIE program instead. Don't
forget if you want to access the joystick control panel applet you can
do it from the Settings menu in PIE.

I am sorry keyboard emulation won't work in Windows 98.


Setting MIDI values inside an IF statement will send a MIDI message
every time it is executed, if you are using the latest version of PIE.
If you are using the version I think you are using then it will only
send a MIDI message the first time you set it to non-zero. Neither of
these behaviours is desirable, although I think the new one may be
slightly less bad. But I have to redesign things to fix this.

Setting PPJoy values inside an IF statement should work OK.

Don't forget if you set something to true in an if statement then it
will stay true until you eventually set it to false in another if

The other cool MIDI property you should experiment with is
Midi.Instrument. BUT you need to divide the instrument number by 127.

Try this:

if not p5.a then
var.ADown = false
end if

if p5.a and not var.ADown then
var.Instrument = random(128)
var.ADown = true
end if

midi.Instrument = var.Instrument/127

You have already seen the Midi.Volume property.

All the midi properties are between 0 and 1. The notes can only be
true or false (1 or 0). This means that some things you have to divide
by 127 (MIDI uses 7 bit bytes).

Most of the MIDI support was designed for things like AudioMulch
rather than actually playing music on your soundcard. Playing music
and sound effects for audio feedback is just an added bonus. :-)

As well as the notes you can also set the note velocities and the note

eg.  Midi.C5Velocity = 100/127

I have no idea what this does :-) Probably strikes the note harder if
your soundcard supports that. Setting a note to true is equivalent to
setting its velocity to 64/127. Setting a note to false is almost
equivalent to setting its velocity to 0.

Another useful one might be Midi.PanPosition

There are lots of properties you can set, but most of them probably
don't work on sound cards.

By the way, most of these properties apply only to their own midi channel.
You can do this:

Midi.Channel1.Instrument = 0
Midi.Channel2.Instrument = 42
Midi.Channel1.PanPosition = 0/127
Midi.Channel2.PanPosition = 127/127
Midi.Channel1.MiddleC = key.LeftShift
Midi.Channel2.MiddleC = key.RightShift

There are 16 channels.

There are 128 controls you can set, numbered 0 to 127, I think
Instument and PanPosition are two of them. The first 32 actually have
14 bits of precision. The rest only have 7. Controls 32 to 63 are the
bottom 7 bits of the first 32 controls. You can set the controls by
name or number.

eg. Midi.Control2 = 32/127

Anyway, get the current version of PIE and use its code completion.

Version 0.13:

What's new in 0.13:
This long boring readme.txt file
PPJoy output now actually works

In PPJoy you can set up multiple virtual joysticks numbered from 1 to 16.
You can use any of these virtual joysticks in PIE like this:

PPJoy5.Digital0 = key.RightShift
PPJoy5.Digital1 = key.RightControl

If you leave out the number, or specify 0, then it will use Virtual Joystick 1.

Version 0.12:

New features are:

Code Completion
Troubleshooter menu with fix for Roid's errors
Support for multiple P5 gloves
Support for multiple PPJoy virtual joysticks
Assignments inside IF statements behave more sensibly.
Improved Lord Of The Rings program
Pressed, Released, Clicked, DoubleClicked, SingleClicked, HeldDown and
KeepDown functions

Things to watch out for:

The Midi object now numbers from 1 instead of from 0. This is to make
everything more consistent. This means Midi1 is the first midi device,
Midi2 is the second, etc. Midi0 is the Midi Mapper.

Glove and PPJoy also number from 1.

Setting MIDI expressions inside an IF statement will now send a MIDI
message every frame, unlike outside an IF statement where they only
send a message when that variable has changed.

New features Instructions

Code Completion is invoked by pressing Ctrl+Space, or by typing a dot.
To select an item you can type part of it or use the arrow keys, the
press Enter. You can press Escape to cancel it. You can disable Code
Completion from the Troubleshooter menu. Code Completion doesn't work
correctly when you type Dot if you haven't done Ctrl+Space yet, so PIE
simulates a Ctrl+Space followed by Escape key press on startup. This
may do weird things, but you probably don't need to worry about it.

The troubleshooter menu allows you to disable Code Completion, PPJoy
updates and DirectInput reads. Note that DirectInput is always
initialized and finalized even when reads are disabled. The settings
are not saved when you exit and restart PIE.

You can use multiple P5 Gloves now like this:   Key.Enter = glove2.ButtonA
or like this: Key.Enter = p5.glove2.ButtonA
or like this: Key.Enter = p52.ButtonA
I don't recommend the last one.

comments powered by Disqus