Advertisement
Guest User

GlovePie's readme

a guest
Aug 22nd, 2019
1,550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 72.40 KB | None | 0 0
  1. =================================
  2. Glove Programmable Input Emulator (GlovePIE)
  3. Version 0.45 (31 December 2011) Free Version
  4. Copyright (c) Carl Kenner 2004-2011
  5. =================================
  6.  
  7. Control games and applications any way you want.
  8. Send fake keyboard keys, jostick actions, mouse moves, midi input or speech input to any program.
  9. Use a VR Glove, Kinect, Wiimote, SIXAXIS, keyboard, joysticks, mice, touchpad or a microphone
  10. to control any program.
  11. =================================
  12.  
  13. Note! If GlovePIE won't run, try right clicking the EXE and choosing properties, then disabling visual themes.
  14.  
  15. This is a free version of GlovePIE. It does not support VR920, Playstation Move, Playstation Navigation subcontrollers,
  16. Emotiv Epoc, 5DT Gloves, or Flock of Birds. It does not emulate XBox 360 controllers.
  17.  
  18. If a commercial version is made later, it will not support the Microsoft Kinect SDK.
  19.  
  20. =================================
  21. Copyright
  22.  
  23. GlovePIE is Copyright 2011 by Carl Kenner, except for the scripts by other authors. By using this software you agree to obey the following license conditions:
  24.  
  25. * 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.
  26.  
  27. * 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.
  28.  
  29. * 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!
  30.  
  31. * NaturalPoint, or anyone or anything acting on their behalf, may not decompile, disassemble, view in a hex editor, reverse engineer, or study in any way any part of this software.
  32.  
  33. ==============================
  34.  
  35. Files you MUST have:
  36. ====================
  37.  
  38. DirectX 9 or above (DX9 is included in Windows Vista and most games)
  39. http://www.microsoft.com/windows/directx/default.aspx
  40.  
  41. Files you SHOULD have to get the most benefit:
  42. ==============================================
  43.  
  44. The latest version of GlovePIE:
  45. http://glovepie.org
  46.  
  47. PPJoy (for emulating the joysticks, you may have problems with 64 bit OSes)
  48. http://www.geocities.com/deonvdw/Docs/PPJoyMain.htm
  49. http://www.simtel.net/product.download.mirrors.php?id=75176
  50.  
  51. MIDI Yoke (for emulating MIDI input devices)
  52. http://www.midiox.com/myoke.htm
  53.  
  54. LibUsb-Win32 (for the Playstation 3 SIXAXIS, either Filter or Device version)
  55. http://libusb-win32.sourceforge.net/
  56.  
  57. SAPI 5.1 or above (for speech and voice commands)
  58. If you want speech recognition (recommended):
  59. You need the version of SAPI which includes the Microsoft Recogniser.
  60. Vista/Windows 7 contain the latest versions of the Recogniser.
  61. If you have Microsoft Office 2003 then you have Recogniser 6.1.
  62. If you have Microsoft Office XP (2002) then you have version 5 which you may be happy with.
  63.  
  64. Otherwise if you have a professional or server version of Windows 2000 or above
  65. then you can get the latest version (6.1) with the Internet Explorer Speech Add-In here (65Mb):
  66. http://www.ics.forth.gr/uachess/downloads/IE-speech_add-in_v1.zip
  67. http://www.voicewebsolutions.net/community/tutorials/voicewebstudio/salt/MicrosoftInternetExplorerSpeechAddInSetup.exe
  68.  
  69. The rest of you can try SAPI 5.1 with recogniser here (50Mb):
  70. http://www.chant.net/downloads/sapi51.exe
  71.  
  72. Or the SAPI 5.1 SDK is here (68Mb):
  73. http://download.microsoft.com/download/speechSDK/SDK/5.1/WXP/EN-US/speechsdk51.exe
  74.  
  75. If you only want speech synthesis:
  76. If you have Office XP (2002) or above or Windows XP then you should have speech synthesis already.
  77. If you have the Internet Explorer Speech Add-In or SAPI 5.1 then you have it too.
  78. Otherwise you only need to download this (6Mb)
  79. http://www.members.lycos.co.uk/moralmike/sapi5.msi
  80. http://www.aldostools.com/sapi51.msi
  81. (If you can't run MSI files download microsoft installer)
  82.  
  83. Extra speech synthesis voices:
  84. If you don't have Mary and Mike (because you have Windows XP) then you can get them here:
  85. http://www.aldostools.com/sapi51xp.msi
  86. (If you can't run MSI files download microsoft installer)
  87.  
  88. If you want Michael and Michelle then you need to install Microsoft e-book Reader,
  89. then install Microsoft Reader Speech pack then (optionally) uninstall Microsoft Reader.
  90.  
  91. If you want high quality realistic speech, then you need to download the trial version
  92. of one of the Cepstral voices. You can try the demos and download them here:
  93. http://www.cepstral.com/demos/
  94. The voices that are only 20Mb aren't as good, but 100Mb or 60Mb seems extravagant.
  95. The demos sometimes add a nag message to the spoken text. Please don't use a keygen
  96. to crack them because these voices are good and you can buy them for only $30.
  97.  
  98. If you want languages other than English then you can find them somewhere.
  99.  
  100. Windows 2000 or above. Sorry. If you have an older version of Windows, use GlovePIE 0.29.
  101.  
  102. What's new in Version 0.45
  103. ==========================
  104. * Officially free
  105. * Kinect support
  106. * Import files from FAAST (not completely implemented though)
  107. * TrackIR emulation now works in DiRT 3, and Operation Flashpoint Red River
  108. * TrackIR emulation might not work in some games it used to work in
  109. * TrackIR emulation no longer uses or generates any haikus
  110. * Smooth function bug fixed
  111. * Uses Direct3D 9 instead of Direct3D 8
  112. * Larger debug box
  113. * PIE.DebugFontSize can be changed in scripts
  114. * Troubleshooter > Diagnose menu, checks for problems with input devices
  115. * Debug window now aligns itself with the main window
  116. * Keyboard bug work-around for people with IR receivers on their laptops.
  117. (this bug is present in all DirectInput or SDL programs except GlovePIE,
  118. but is most noticable in DOSBox, it stops [{ ]} \| '" `~ keys from working)
  119. * Multiple keyboards sorted better
  120. * One MIDI bug fixed
  121. * Cursor now supports FakeCursor / RealCursor
  122. * WiiGuitar touch frets
  123. * SIXAXIS strings work correctly when no SIXAXIS is connected
  124. * Probably some other things I forgot
  125.  
  126. What's new in Version 0.43
  127. ==========================
  128. See also documentation.rtf
  129. * Drum Kits and DJ Hero Turntables should now be detected correctly.
  130. * Wiimotes wait slightly longer when checking which expansion is plugged in
  131. * Nunchuk.Calibrated can now be set to false to recalibrate the Nunchuk joystick.
  132. * "0.1 is not a valid floating point number" bug fixed (only affected Europeans sometimes)
  133. * Variables can now have non-latin names
  134. * Scanner has better unicode support
  135. * Can double click in code completion list to select
  136. * improved code completion detection
  137. * Wild Divine Lightstone bug fixed
  138. * BeginsWith and EndsWith functions no longer case sensitive
  139. * "Any" object axes fixed
  140. * Joystick not working on second run bug fixed
  141. * Extra DualShock3 raw fields for testing
  142. * New menus for new GlovePIE website
  143. * Minimise-to-tray button moved from title/caption bar to menu bar
  144. * Automatically runs as administrator again
  145. * Uses external manifest file
  146. * Maybe visual themes bug is fixed
  147. * Extra mouse detected bug in multiple mouse support fixed
  148. * MouseParty script included (multiple mouse pointers with multiple mice)
  149. * MouseVoiceCommands script included
  150.  
  151. What's new in Version 0.42
  152. ==========================
  153. * Right click popup menu added to editor
  154. * Switching tabs doesn't deactivate Wiimote and Sixaxis anymore.
  155. * Partial support (untested) for Wild Devine Lightstone (biometric device)
  156. * Support for Neurosky EEG device (untested)
  157. * Wii Motion Plus wrong calibration on second run bug fixed
  158. * Wiimote and Sixaxis show middle 2 lights while calibrating gyros
  159. * Nunchuk.Shake gesture added
  160. * Nunchuk.SwingVertical gesture improved
  161. * Wiimote.Battery now works again
  162. * FakeMouse.DirectInputY is fixed
  163. * FakeMouse and RealMouse now support vectors.
  164. * RealMouse now supports multiple mice individually
  165. * Emotiv.RawGyroTotalX, RawGyroTotalY and RawGyroTotalXY added.
  166. * Lego Indiana Jones scripts included
  167. * Wii Motion Plus mouse control script included
  168.  
  169. What's new in Version 0.41
  170. ==========================
  171. * Emotiv Epoc support fixed
  172. * Emotiv Epoc gyro support added (in theory)
  173. * Some Emotiv Epoc improvements
  174. * Updated EDK.dll file (hopefully fixes false positives in AVG)
  175. * GlovePIE now always runs as administrator
  176. (otherwise you can't send keys and mouse to fullscreen games in Vista)
  177.  
  178. What's new in Version 0.40
  179. ==========================
  180. * GlovePIE 0.30 security bug fixed
  181. * Autoconnect Wii Remotes with Microsoft Bluetooth stack
  182. * Autodetect bluetooth stack
  183. * Wii Motion Plus support
  184. * Gesture recognition for Wiimotes, Nunchuks, and SIXAXISes
  185. * Improved GUI autodetect feature
  186. * Emotiv Epoc SDK version support (in theory, actually it didn't work)
  187. * DJ Hero Turntable (Wii) support (in theory)
  188. * Guitar Hero World Tour Drums (Wii) support (in theory)
  189. * Balance Board working
  190. * Dual Shock 3 might work without rumbling if you don't use gyro
  191. * VR920 and stereoscopic 3D support removed
  192. (protest to Vuzix and MTBS3D if you want it back)
  193. * Unicode support
  194. * Lots of new fields
  195. * Other bug fixes and improvements
  196. * Improved copy protection (to stop it running in Israel)
  197. * Some new bugs added (I'm guessing)
  198. * Separated into two versions, one with 5DT and Flock of Birds support
  199. and one with Emotiv support (Emotiv won't work with 5DT or Birds)
  200.  
  201. What's new in Version 0.30
  202. ==========================
  203. * SIXAXIS support (USB only, everything working except bluetooth)
  204. * Wii Guitar Hero 3 controller support
  205. * Wii Fit Balance Board support (broken, sorry)
  206. * Novint Falcon support
  207. * VR920 Virtual Reality HMD support
  208. * XBox 360 controller support (untested)
  209. * Touchpad support
  210. * 3DConnexion SpaceBall support
  211. * TrackIR emulation
  212. * Improved TrackIR support (untested)
  213. * PS3 BD Remote support
  214. * GlovePIE Can display 3D graphics for visualisation
  215. * Swallow function for swallowing keyboard keys
  216. * "Any" object, for any kind of wiimote/gamepad/sixaxis to seem the samne. eg. Any.Joy1x, Any.RightTrigger, etc.
  217. * Translation support, edit the INI files to add your language
  218. * Vista support (mostly)
  219. * Fake Cursor roll (fake cursors can rotate like on a Wii)
  220. * Wii-like hand cursor available
  221. * Fake cursors can be set to custom colours or images
  222. * Fake keys now repeat like normal keys, or can be set to repeat multiple keys at once (unlike a real keyboard)
  223. * Smooth function doesn't crash so much
  224. * Code completion doesn't pop up when empty (eg var.)
  225. * Wiimote is no longer counted in the joystick.count
  226. * PPJoy digital goes up to 40 instead of 32 (needed for POV hat switches)
  227. * "/tray" command line option to minimize to system tray
  228. * Euro and Dollar keys on Acer Laptops added (but need to close LaunchManager for GlovePIE to see them)
  229. * Units of weight and force added, unit multiplication fixed
  230. * Matrix array elements now work
  231. * Midi pitch wheel bug fixed
  232. * Joystick.AnyButton
  233. * Starting() function instead of "if not var.initialised"
  234. * Other things that I forgot
  235.  
  236. What's new in version 0.29
  237. ==========================
  238. * Minimize to System Tray button
  239. * Recent Files menu
  240. * OutputToFile( ) function to write values to output.txt
  241. * Division by zero no longer crashes compiler
  242. * Automatically connect Wiimotes when you press 1+2
  243. (bluesoleil only, you need to do it manually with other stacks)
  244. Hold Power button to disconnect Wiimote.
  245. * Wiimote speaker supported (single notes only, no wave files)
  246. * Classic Controller support fixed and tested
  247. * Wiimote.SmoothPitch and Wiimote.SmoothRoll now calculate angles
  248. without seperating out the acceleration, for smooth (but
  249. inaccurate) angles when your hand wobbles.
  250. * "Press X" now works without brackets
  251. * "100Hz" now works without space
  252. * Numbers allowed after dot, "Wiimote.1" works like "Wiimote.One"
  253. * Infinity and NaN are now valid numbers.
  254. * Other compiler improvements
  255. * Improved documentation
  256. * More scripts! Play old Zelda, Mario, or Metroid games with the
  257. exact same controls as the modern Wii game.
  258.  
  259. What's new in version 0.28
  260. ==========================
  261. * Running scripts from command line works again
  262. * New function: DeadZone(wiimote.nunchuk.joyX, 10%)
  263. * Wii Classic Controller support (theoretical)
  264. * Can now tell the difference between classic and nunchuk
  265. * Nunchuk built-in calibration supported
  266. * Nunchuk no longer reduces performance of other reports
  267. * Note, when IR and Nunchuk are used together dot size is no longer available
  268.  
  269. What's new in version 0.27
  270. ==========================
  271. * Nunchuk support
  272. * Setting channel to 0x3E or 0x3F no longer prevents Wiimote forces from working.
  273.  
  274. What's new in version 0.26
  275. ==========================
  276. * TroubleShooter > BlueTooth Fix menu, for other bluetooth stacks.
  277.  
  278. What's new in version 0.25
  279. ==========================
  280. * WiimoteScripts folder
  281. * Wiimote battery level
  282. * Wiimote normalized gx, gy, gz force values (0=none, 1=gravity)
  283. * Wiimote pitch, roll, and rotation matrix, seperate from movement
  284. * Wiimote raw accelerations in m/s/s with gravity
  285. * Wiimote relative accelerations without gravity
  286. * Calibrate Wiimote manually, or use Wiimote's own built in settings
  287. * Access BlueSoleil window from CP-Settings > BlueTooth menu
  288. * Extract Miis from Wiimote (From File menu)
  289. * MIDI no longer gives error if no input device
  290. * Various other bugs fixed, and new bugs introduced
  291.  
  292. What's new in version 0.24
  293. ==========================
  294. * GlovePIE now runs in Europe without crashing on every decimal point!
  295. * Wiimote bugs fixed, and tested. It should work now.
  296. * Wiimote.Expansion is a number representing which expansion is plugged in.
  297. * WiimoteDumpBytes(wiimotenumber, address, count) reads count bytes from the
  298. Wiimote's memory and displays it in the debug window.
  299. * TestWiimote.PIE now shows IR cursors.
  300.  
  301. What's new in version 0.23
  302. ==========================
  303. * Multiple Wiimote support
  304. * Wiimote not working the second time bug fixed
  305. * Support for Wiimote Sensor Bar (aka candles, christmas tree lights, IR remote controls, etc)
  306. * Nunchuk no longer stops Wiimote buttons from working
  307. * Other Wiimote features
  308.  
  309. What's new in version 0.22
  310. ==========================
  311. * Included correct version of this file this time :-)
  312. (Read the section below which wasn't included last time, oops)
  313. * Wiimote support (partial)
  314. * Wiimote works with "detect input" button in GUI
  315. * Concept 2 PM3 Rowing Machine Support
  316. * TrackIR, OptiTrack and SmartNav support.
  317. * FakeSpace Pinch Gloves support (9600 baud default)
  318. to use FakeSpace Pinch gloves at a different baud rate,
  319. set pinch.baud115200 to anything anywhere in your script,
  320. or whatever baud rate you have your dip switches set to.
  321. * WorldViz PPT added to GUI.
  322. * Flock of Birds fixed in GUI.
  323. * Fixed > being displayed as >= in GUI.
  324.  
  325. What's new in version 0.21
  326. ==========================
  327. * eMagin Z800 3D Visor HMD support (partially tested)
  328. * 5DT DataGlove support (untested)
  329. * Intersense tracker and wand support (untested)
  330. * Ascension Flock Of Birds and other trackers support (untested)
  331. * Polhemus Fastrak and IsoTrak II trackers and others (untested)
  332. * WorldViz PPT tracker support (untested)
  333. * Even more improved GUI!
  334. ** Auto-detect buttons! Just do the action you want to emulate, then the action you want to trigger it.
  335. ** Hides parts of GUI until you need them.
  336. ** Only lists most common values in drop-down box unless you click "More..." button.
  337. ** Better selects most appropriate ranges and mappings.
  338. * Shortcut keys (when program isn't running).
  339. * Help menu links to GlovePIE website and Yahoo group
  340. * New command line parameters /p: eg. "/r:notepad" "/p:whatever.txt", will open whatever.txt in notepad
  341. * Apps specified on command line are now run after your script is started, so they are foreground.
  342. * More low level P5 support (p5.TopSensorHAngle, p5.HeadSeparation, p5.Led0err, etc.)
  343. * Running script from command line bug fixed. GlovePIE -script.pie no longer gives an error.
  344. * Multiple keyboards without multiple mice bug fixed (the lazy way).
  345. * Half-running, half-stopped bug fixed.
  346. * Can now import e-Speaking files (look in My Documents for the xml file).
  347. * Window.BeforeDash, Window.AfterDash, Window.AppName, Window.FileName
  348. * License now prohibits cheating online
  349.  
  350. What's new in version 0.20
  351. ==========================
  352. * PIE SOMETIMES MINIMIZES DIFFERENTLY!!! With scripts involving multiple cursors, it will minimize to the desktop, not the taskbar.
  353. And you have to restore it from the desktop, not the taskbar. Sorry.
  354. * OSC Support
  355. * Improved MIDI GUI
  356. * More accurate and responsive frame rate, may use more CPU though, set PIE.FrameRate to change it.
  357. * Force Feedback Gamepad support
  358. * Speech recognition bugs which stopped it recognising half the time have been fixed
  359. * New AskedFor(" ") speech recognition function (only partially implemented)
  360. * Multiple mouse support (windows XP and above)
  361. * Multiple mouse cursors (windows 2000 and above)
  362. * Swallow mouse input (windows 2000 and above)
  363. * Horizontal mouse wheel support (in theory)
  364. * Mouse.WheelUp, Mouse.WheelDown, etc. now work (but not for multiple mice)
  365. * Delta function, tells you how much a variable has changed since last frame
  366. * partial OSC support
  367. * Fixed bug which required space before units
  368. * Fixed bug with negative powers
  369. * e^2 now works like you would expect
  370. * Pie.Frame tells you what Frame PIE is up to
  371. * Pie.Epsilon is now set to 1, meaning ~= only requires them to be within 1 unit
  372. * Windows 95 is temporarily not supported (due to a bug in Delphi 6),
  373. although it may still work if you have updated some windows components.
  374. * Imports lots of different file formats
  375. * Doesn't import the latest version of P5Midi yet. Sorry.
  376.  
  377. Minimizing
  378. ==========
  379. 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.
  380. Now when you minimize the main PIE window it appears as a bar in the bottom
  381. left corner of the desktop. You have to click PIE's taskbar icon then restore
  382. the main window from the bar in the bottom left corner of the screen. Sorry
  383. about the inconvenience.
  384.  
  385. Mouse stuff
  386. ===========
  387. You can read individual mice. But you can't set individual mice (you can set
  388. individual cursors though).
  389.  
  390. To read multiple mice, just put a number after the word mouse and before the dot.
  391. eg. to have the mouse 2 buttons control the keys A S and D use this code:
  392.  
  393. key.Q = mouse1.LeftButton
  394. key.W = mouse1.MiddleButton
  395. key.E = mouse1.RightButton
  396. key.A = mouse2.LeftButton
  397. key.S = mouse2.MiddleButton
  398. key.D = mouse2.RightButton
  399.  
  400. If you want to read the movement of multiple mice you need to use
  401. mouse1.DirectInputX etc. because the other items (like mouse1.x) refer to
  402. the CURSOR and multiple mice don't have their own cursors.
  403.  
  404. Without a number, mouse.LeftButton will register ANY mouse's left button.
  405.  
  406. There is also mouse0 which is a virtual mouse used for Windows Remote Desktop
  407. (Windows XP Professional only).
  408.  
  409. You can also use multiple mouse pointers (which can be controlled by anything,
  410. not just mice).
  411.  
  412. eg. to add a second cursor controlled by the keyboard:
  413.  
  414. Cursor2.Visible = true
  415. Cursor2.LeftButton = Key.LeftCtrl
  416. Cursor2.RightButton = Key.RightCtrl
  417. Cursor2.CursorPosX = var.x2
  418. Cursor2.CursorPosY = var.y2
  419. if Key.RightArrow then var.x2++
  420. if Key.LeftArrow then var.x2--
  421. if Key.UpArrow then var.y2--
  422. if Key.DownArrow then var.y2++
  423.  
  424. You can have as many cursors as you want.
  425.  
  426. "cursor" by itself controls the real mouse cursor. You can also use additional
  427. cursors called "cursor0", "cursor1", "cursor2", etc. They will have a little
  428. coloured number next to them.
  429.  
  430. The extra fake mouse pointers will not work perfectly, and they use up lots of
  431. CPU. They require Windows 2000 or later or they will have a solid rectangular
  432. box behind them.
  433.  
  434. You can swallow all mouse input from the system mouse like this:
  435.  
  436. mouse.swallow = true
  437.  
  438. (be very careful doing this, since you can no longer press the stop button with
  439. the mouse)
  440.  
  441. Or you can swallow only certain kinds of mouse input like this:
  442.  
  443. mouse.SwallowMovement = true
  444. mouse.SwallowButtons = true
  445. mouse.SwallowWheels = true
  446.  
  447. That will not affect DirectInput applications. If you don't swallow mouse input
  448. then mouse1 and mouse2 will both move the real system cursor, which is probably
  449. not what you want in a multiple mouse pointer situation.
  450.  
  451. Swallowing the mouse input will not affect movement or button presses you set
  452. in PIE.
  453.  
  454. To have only mouse1 control the real system mouse pointer you need to do this:
  455.  
  456. mouse.Swallow = true
  457. mouse.LeftButton = mouse1.LeftButton
  458. mouse.MiddleButton = mouse1.MiddleButton
  459. mouse.RightButton = mouse1.RightButton
  460. mouse.DirectInputX = mouse.DirectInputX + Delta(mouse1.DirectInputX)
  461. mouse.DirectInputY = mouse.DirectInputY + Delta(mouse1.DirectInputY)
  462.  
  463. Warning! Do not click on PIE's title bar in this mode or it will freeze for a
  464. few seconds. Alt+Tab will unfreeze it if you are impatient.
  465.  
  466. To read the mouse wheels' positions, use this:
  467.  
  468. mouse.DirectInputZ // vertical wheel
  469. mouse.DirectInputH // horizontal wheel
  470.  
  471. You can now read and set WheelUp, WheelDown, WheelLeft and WheelRight:
  472.  
  473. Mouse.WheelUp = key.UpArrow
  474.  
  475. Key.z = Mouse.WheelDown
  476.  
  477. But reading mouse1.WheelUp etc. is not enabled for multiple mice.
  478. (You need to read their mouse1.DirectInputZ instead).
  479.  
  480. Delta Function
  481. ==============
  482. Are you sick of setting "var.Oldx = whatever" at the end of your script just
  483. so you can tell how much x has changed?
  484.  
  485. Well now you don't have to. You can use the Delta function on anything to find
  486. how much it has changed since last frame.
  487.  
  488. For example, "debug = delta(mouse.CursorPosX)" will tell you how much the cursor
  489. has moved horizontally since last frame.
  490.  
  491. OSC Stuff
  492. =========
  493.  
  494. PIE supports Open Sound Control over UDP. That is kind of like MIDI.
  495.  
  496. You can only pass single variables.
  497.  
  498. First you need to set the port, the destination IP address, and whether you
  499. want the message broadcast to everything connected to the network.
  500.  
  501. OSC.Port = 47110
  502. OSC.IP = "192.168.1.2"
  503. OSC.Broadcast = false
  504.  
  505. Actually if you don't specify the IP address it defaults to "localhost". If you
  506. set Broadcast to true then the IP address is ignored, so you don't need to
  507. specify it. If you don't specify the port it defaults to 47110. If you don't
  508. specify broadcast then it defaults to false.
  509.  
  510. Then you can send OSC messages like this:
  511.  
  512. OSC.blah.foo.bar = 42.6
  513.  
  514. That will set the OSC address /blah/foo/bar to the single precision floating point value 42.6
  515.  
  516. You can also use the SendOsc(ip, port, address, param1, param2, param3, ...)
  517. and the BroadcastOsc(port, address, param1, param2, param3, ...)
  518. messages.
  519.  
  520. ============
  521. Version 0.19
  522. ============
  523. This version is still buggy, but my copy of Delphi won't run anymore so I can't fix it for a while.
  524. So I'm releasing what I've done so far. The next version will have to wait until I can get Delphi
  525. running again.
  526.  
  527. * Doom 3 script demonstrating real walking, jumping, crouching and turning!!!!!
  528. This took a lot of effort, and I highly recommend trying it out, even if you don't have Doom 3,
  529. it can be tested on its own, or with some other first-person shooters (that use END to center the view).
  530. It's really cool once you get the hang of it, but practice on level 1 first!
  531. * Vector support eg. var.v = [1,-3,2] cm
  532. * Other vector sytax eg. var.v = 1i -3j +2k (Note! you need the 1 in front of the i)
  533. * Vector element support eg. var.x = var.v[1]
  534. or like this eg. [var.x, var.y, var.z] = var.v
  535. * 3x3 Matrix support. eg. var.m = p5.RotMat
  536. * Dot product operator eg. var.w = var.v . var.u
  537. * Factorial and DoubleFactorial operators eg. var.x = 3!
  538. * Approximately-equal operators eg. if var.x ~= 1.05 then beep
  539. You can set PIE.Epsilon to the maxium difference tolerated, usually 0.01
  540. There are also the folllowing operators: ~= ~!= ~> ~< ~>= ~<=
  541. When used with strings they do case-insensitive comparison.
  542. * useless tetration operator eg. var.a ^^ var.b
  543. * Can call any function in any dll eg. User32.dll.MessageBox(NULL,'hello','PIE',0)
  544. * Variables tab to view values of all variables while running
  545. * Read angles of finger joints... eg. P5.IndexProximal, P5.IndexMiddle, P5.IndexProximal
  546. * standard string functions
  547. * Added pi constant
  548. * Tell why the glove isn't visible:
  549. p5.TooFarLeft, p5.TooFarUp, p5.BehindSomething, p5.SwitchedOff, p5.UntrackableAngle, etc.
  550. * Fixed lots of hand orientation bugs
  551. * Fixed p5.LedsVisible bug
  552. * Fixed bug preventing variables from being boolean
  553. * Fixed trig functions with no units specified
  554. (defaults to degrees unless expressed in terms of pi)
  555. * Boycott of Israel is enforced by code
  556. * Importing shoot, game commander and P5midi works from Command Line
  557. * New troubleshooter options, eg. Contrasting Colours if you can't see clearly
  558. * New bugs: units now require a space between them and the number, eg "5 cm" instead of "5cm"
  559. * New bugs: P5.IndexPos doesn't work because I disabled it just before Delphi crashed :-(
  560. * New bugs: It seems to hang sometimes, but pressing Ctrl+Alt+Delete may fix it (don't terminate it,
  561. just use Ctrl+Alt+Delete and then Switch-To or Cancel)
  562.  
  563. =============
  564. =============
  565. Version 0.18:
  566. =============
  567. =============
  568. * MIDI GUI!!
  569. * Windows 95/98 keyboard emulation
  570. * Search and replace
  571. * String comparisons now work
  572. * miles, miles per hour, and megahertz now work
  573. * units for musical intervals: semitones, cents, octaves, majorseconds, minorthirds...
  574. * MIDI RPNs: MasterTuning and PitchBendRange
  575. * said() now works better, and has optional extra confidence-required parameter
  576. eg. said("Hello",3)
  577. 0 = no confidence (false recognition)
  578. 1 = low confidence guess, 2 = medium conf guess (default), 3 = high conf guess
  579. 4 = low conf full recognition, 5 = medium conf full recog, 6 = high conf recog
  580. * Lots of microphone properties
  581. * Push To Talk microphone properties
  582. (set enabled to true/false, then override with PushToTalk and PushToNotTalk)
  583. * speech input EMULATION (eg. microphone.CompletePhrase := "hello")
  584. * Speech synthesis in multiple voices (eg. speech.sam.text = "hello")
  585. * Speech synthesis properties (eg. debug = speech.visime)
  586. * window properties
  587. * Sequence gap and duration settings (eg. Pie.SeqGap = 50ms)
  588. * Open p5midi *.p5m files (P5midi emulates midi with p5)
  589. * Open Game Commander *.gcc (Game Commander emulates keys with speech)
  590. * Open Shoot *.xml profiles (Shoot emulates keys with speech)
  591. * => and assignment successfully compile more often
  592. * Key.Apostrophe now works, plus some other keys have more names
  593. * Wait command can now be used in sequences
  594. * StopScript crash fixed
  595. * Syntax highlighter doesn't crash so easily
  596. * Midi.ChannelPressure (aka Midi.ChannelAftertouch) now compiles
  597. * Clicking on an error in the error box now stops the program so you can fix it
  598. * Tooltips (yellow hints) now pop up over controls to help you
  599. * Improved screen layout for people running at other resolutions
  600. * Log file for debugging PIE
  601.  
  602. ==============================
  603.  
  604.  
  605. =============
  606. =============
  607.  
  608. Version 0.17:
  609. =============
  610. =============
  611.  
  612. * 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.
  613. * Voice commands! Speech recognition with the said("whatever") command
  614. * Support for some brands of remote controls used with Pinnacle/Miro PCTV receptor (must set in menu each time)
  615. * Recognition and emulation of sequences of actions... eg. var.GodMode = I,D,D,Q,D
  616. * New implies syntax: a => b now does the same thing as b = a
  617. * New commands/procedures: Say, PlaySound, Display, StopScript, ExitPIE, Execute, Chain, Beep, ControlPanel, MinimizePie, AddCodeLine, etc.
  618. * Commands can be set like variables, eg. ExitPIE = Alt+X
  619. * Key combinations can be set in one go, eg. Ctrl+C = p5.ButtonA
  620. * Alternative ^ syntax for control+key combinations, eg. ^C = p5.ButtonA
  621. * Control, Shift, Alt and Windows now recognise either key, rather than mapping to LControl, LShift, LAlt and LWindows.
  622. * for loops and while loops
  623. * if (something) and (something) now works properly
  624. * Screen object (currently read only) for getting information about the screen (eg Screen.Width).
  625. Supports multiple monitors (eg. screen1.Width, screen2.Width)
  626. * Plug & Play monitor support! Read the physical size of your plug and play monitor (eg. screen.PhysicalWidth)
  627. * New Units! Pixels (size varies depending on resolution), PieFrames (currently 24ms), and Mickeys (400 per inch)
  628. eg. Debug = mouse.CursorPosX in cm
  629. * More natural language features... eg. if alt but neither shift nor control then
  630. * Variables now store their type and units and can store strings
  631. * Fixed bug causing C and Java style integer division (5/2 should be 2.5 NOT 2!!!)
  632. * Improved syntax highlighter
  633. * Improved performance of long sequences of OR or AND operators
  634. * Text area greyed out and has keyboard focus when running, so generated keys do nothing harmful
  635. * More key aliases, such as NumPadDot for Decimal
  636. * Reserved words and unit names are no longer reserved or misrecognised when used after "."
  637. * Assigning to object properties now converts units correctly
  638. * Code completion bug fixed
  639. * key.Minus and "debug = p5.x minus 100" now both work, but "debug = minus 1" doesn't work.
  640. * Setting mouse.x, mouse.VirtualDesktopX, etc. now works. Reading mouse.VirtualDesktopX now works.
  641. * Preliminary documentation
  642.  
  643. =============
  644. =============
  645.  
  646. Version 0.16:
  647. =============
  648. =============
  649.  
  650. * MIDI note velocity bug is fixed so you can now set the velocity of notes.
  651.  
  652. * You can now turn the P5's mouse-mode on and off like this:
  653. p5.MouseMode = true
  654.  
  655. * You can check whether a glove is lefthanded like this:
  656. if glove1.LeftHanded then ...
  657.  
  658. * There is a Smooth function which lets you smooth out any value:
  659.  
  660. // will go smoothly from 0 to 1 when you press it
  661. debug = smooth(key.LeftShift)
  662.  
  663. // will average the previous 12 frames + the current one, and round the
  664. // answer to the nearest cm
  665. debug = smooth(p5.RelativeX, 12, 1 cm)
  666.  
  667. * The Pressed function and others like it now work properly.
  668.  
  669. * The HeldDown and KeepDown functions now allow you to specify the
  670. units for the time.
  671.  
  672. * Glove orientation is now easier to work with. You can now check it like this:
  673.  
  674. // The palm is closer to facing down, back and to the left than to any
  675. other direction
  676. if p5.PalmLeftDownBackStrict then ...
  677.  
  678. // The thumb is facing vaguely in the direction of up forwards and to the left
  679. if p5.ThumbLeftUpForwardVague then ...
  680.  
  681. // The fingers are within 30 degrees of facing diagonally forwards and
  682. // to the right
  683. // (at least they would be if they were straight, this is hand orientation only)
  684. if p5.FingersAngleFromRightForward <= 30 degrees then ...
  685.  
  686. The glove orientation now checks whether it is a left or right-hand. So this:
  687. debug = p5.ThumbUp
  688. will now work correctly for either hand (previously you would have to
  689. point your thumb down if it was your left hand).
  690.  
  691. * There is now a generic p5.speed variable so you don't have to
  692. manually square, add and squareroot the xvelocity, yvelocity and
  693. zvelocity.
  694.  
  695. ==============
  696. ==============
  697. Version 0.15:
  698. ==============
  699. ==============
  700.  
  701. Sings Christmas carols (see Christmas.PIE)
  702. Getting Started documentation
  703. IF statements are more flexible (eg. ELSE is allowed now)
  704. Speech synthesis support
  705. Joystick read bug now fails silently (no million popups)
  706. MapRange function
  707. Wait command (for Macros)
  708. press and release commands
  709. a couple more example scripts
  710. key.Minus now works (but "debug = p5.x minus 100" doesn't anymore)
  711. No divide by zero error if run without a P5 Glove plugged in.
  712. Can access raw P5 LED data
  713. Some other bug fixes
  714. New Dual Mode driver version included
  715. Improved user interface
  716. Added extra license condition (sorry, blame my employer!)
  717. BASIC style hexadecimal notation allowed (&hF3 means 0xF3)
  718.  
  719.  
  720. =============
  721. =============
  722. Version 0.14:
  723. =============
  724. =============
  725.  
  726. What's new in 0.14:
  727.  
  728. You can use and convert units (eg. Metres)
  729. Command line parameters
  730. Support for multiple joysticks
  731. Easy P5 finger gestures (eg. p5.xlnnn)
  732. Easy P5 orientations (eg. p5.PalmDown and p5.FingersRight)
  733. P5 filter modes can be set
  734. New in set operator (eg. if var.value in {1, 3, 7, 2} then )
  735. Support for MIDI percussion
  736. Can specify the default MIDI device and channel
  737. You can now move the mouse in DirectX games
  738. Midi device numbering bugs fixed
  739. Midi instruments are now numbered from 1 to 128
  740. Syntax highlighter now recognises "}" style end if
  741. Debug box expanded and improved
  742. Save confirmation
  743. General bug fixes and tidy ups
  744.  
  745.  
  746. Units
  747. =====
  748. Values and functions now have units. (But variables do not).
  749. You can view the units along with the value in the debug box.
  750. eg. debug = p5.xvelocity
  751.  
  752. You can specify the units for an expression like this:
  753.  
  754. debug = 10 metres per second per second
  755.  
  756. You can use different units together like this:
  757.  
  758. debug = 5 metres + 31 cm // this will give 5.31 metres
  759.  
  760. You can convert things to other units like this:
  761.  
  762. debug = (5 metres + 31 cm) in feet
  763.  
  764. The following units are supported:
  765.  
  766. Distance: Kilometres (km), Metres (m), Centimetres (cm), Millimetres (mm),
  767. P5Units, Feet, Inches
  768. Time: Years (yr), Days, Hours, Minutes (min), Seconds (s),
  769. Milliseconds (ms), Microseconds
  770. Frequency: Hertz (Hz), Kilohertz (KHz), Megahertz (MHz)
  771. Angles: Degrees (deg), Radians (rad), Revolutions
  772. shorthand: kph = kilometres per hour, mps = metres per second,
  773. rpm = revolutions per minute
  774.  
  775. Units support is not perfect yet. Multiplying, dividing and exponents don't
  776. change the units correctly. Plus there are other bugs and weird things.
  777.  
  778.  
  779. Command Line
  780. ============
  781.  
  782. The following command line options are supported:
  783.  
  784. -FileName = load and run FileName.PIE
  785. /r:ExeName = execute external program ExeName (eg. your game)
  786. FileName = load, but don''t run FileName.PIE
  787.  
  788. NOTE! You must put "" around the whole option if it contains a space!
  789. eg. PIE "/r:c:\program files\game\runme.exe" -runme.PIE
  790.  
  791. PIE will not automatically shut down when your external program ends. Sorry.
  792.  
  793.  
  794. Multiple Joysticks
  795. ==================
  796.  
  797. You can use multiple joysticks like this:
  798. keyboard.Space = joystick2.x > 50%
  799.  
  800. Or you can chose joysticks by type like this:
  801. keyboard.space = joystick.ppjoy1.x > 50%
  802. keyboard.space = joystick.real1.x > 50%
  803. keyboard.space = joystick.gamepad1.x > 50%
  804. keyboard.space = joystick.joystick1.x > 50%
  805. keyboard.space = joystick.wheel1.x > 50%
  806. keyboard.space = joystick.flight1.x > 50%
  807. keyboard.space = joystick.firstperson1.x > 50%
  808.  
  809. Note that you still need to use ppjoy to set joystick values,
  810. and joystick to read them. For example to increment a joystick's x axis:
  811.  
  812. ppjoy2.analog0 = joystick.ppjoy2.x + 0.1
  813.  
  814. Even though I just added the ability to specify a default MIDI device,
  815. that isn't implemented for joysticks.
  816.  
  817.  
  818. New P5 Stuff
  819. ============
  820.  
  821. You can check the orientation of the glove with these new true/false values:
  822.  
  823. p5.FingersUp p5.FingersDown p5.FingersLeft p5.FingersRight, p5.FingersForward,
  824. p5.FingersBack
  825.  
  826. p5.PalmUp p5.PalmDown p5.PalmLeft p5.PalmRight, p5.PalmForward,
  827. p5.PalmBack
  828.  
  829. p5.ThumbUp p5.ThumbDown p5.ThumbLeft p5.ThumbRight, p5.ThumbForward,
  830. p5.ThumbBack
  831.  
  832. These only check the angle of the hand itself. The finger bends are irrelevant.
  833. At least one of these values from each set will always be true
  834. (except when no rotation has been measured yet).
  835.  
  836. Currently the thumb direction will be reported wrong on left handed gloves, but
  837. this will be fixed later.
  838.  
  839. Another new thing is the finger gestures. You can specify how bent each finger
  840. should be with only five characters!
  841.  
  842. l = straight
  843. r = partly bent
  844. n = completely bent
  845. x = don't care
  846.  
  847. You use a sequence of five characters starting with the thumb.
  848.  
  849. eg.
  850.  
  851. var.pointing = p5.xlnnn
  852. var.fist = p5.nnnnn
  853. var.claws = p5.rrrrr
  854.  
  855. Combining the two new features you can do this:
  856.  
  857. var.ThumbsUp = p5.lnnnn and p5.ThumbUp and p5.FingersForwards
  858.  
  859. You can specify the maximum bend value for "l", and the minimum bend
  860. value for "n" like this:
  861.  
  862. p5.maxl = 27
  863. p5.minn = 48
  864.  
  865. You can set the P5 filters like this:
  866.  
  867. p5.FilterDistance = 0.7 cm
  868. p5.DeadBandFilter = false
  869.  
  870. p5.FilterFrames = 10
  871. p5.AveragingFilter = true
  872.  
  873.  
  874. NEW MIDI STUFF
  875. ==============
  876. If you do not specify a midi device type and/or number then it will use the
  877. default. You can now change what that default is at run time.
  878. The same applies to channels.
  879.  
  880. if key.rightshift then
  881. midi.DeviceOut = midi.thru1.DeviceOut
  882. end if
  883.  
  884. if not key.rightshift then
  885. midi.DeviceOut = midi.player.DeviceOut
  886. end if
  887.  
  888. if key.leftctrl then
  889. midi.DefaultChannel = 10
  890. end if
  891.  
  892. if not key.leftctrl then
  893. midi.DefaultChannel = 1
  894. end if
  895.  
  896. midi.c5 = key.leftshift
  897.  
  898.  
  899. Percussion instruments are now supported like musical notes.
  900. You just specify them like this:
  901.  
  902. midi.bassdrum1 = key.leftalt
  903.  
  904. Note that percussion instruments are always played on channel 10 no matter what.
  905.  
  906.  
  907. Changing the regular melodic instrument for a channel is done like this:
  908.  
  909. midi.instrument = 128 // gun shot
  910. midi.c5 = key.space
  911.  
  912. The instrument can be numbered 1 to 128.
  913. If you prefer 0 to 127 you can do this:
  914.  
  915. midi.instrument0 = 127 // gun shot
  916. midi.c5 = key.space
  917.  
  918.  
  919. NEW MOUSE STUFF
  920. ===============
  921.  
  922. There are several ways of using the mouse position
  923.  
  924. Mouse.CursorPosX
  925. Mouse.x
  926. Mouse.VirtualDesktopX // write-only
  927. Mouse.DirectInputX
  928.  
  929. CursorPos tells you the pixel of the cursor on screen.
  930. x by itself tells you the cursor position as a fraction of the screen width
  931. VirtualDesktopX tells you the cursorpos as a fraction of the multiple monitors
  932. DirectInputX tells you the physical mouse movements and ignores the cursor
  933.  
  934. DirectInput is measured in mickeys, CursorPos is measured in pixels and
  935. the others are fractions between 0 and 1.
  936.  
  937. CursorPos will not work in most DirectX games, since they use there own cursors.
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944. STRUCTURE OF A PIE PROGRAM
  945. ==========================
  946.  
  947. Basically a PIE file looks like this:
  948.  
  949. something = something
  950. something else = something else
  951.  
  952. If you want to write a really complicated PIE program you can also do this:
  953.  
  954. something = something
  955. if whatever then
  956. something else = something else
  957. end if
  958.  
  959. The only other thing you can have in a PIE program is this:
  960.  
  961. // This is a comment
  962.  
  963. That's all there is to it. So let's see what the somethings can be...
  964.  
  965. THINGS TO SET AND READ
  966. =====================
  967.  
  968. The things you are trying to set can be keys on the keyboard, buttons
  969. on the mouse, axes and buttons on the joystick, or notes and
  970. controllers on a musical MIDI device.
  971.  
  972. The things on the right hand side that you are trying to use can be
  973. keyboard, mouse, joystick or Virtual Reality glove.
  974.  
  975. To simulate the left control key when you press the A button on your
  976. p5 glove you would write this:
  977.  
  978. keyboard.LeftControl = p5.AButton
  979.  
  980. To simulate the left mouse button when you press the B button on your
  981. p5 glove you would write this:
  982.  
  983. mouse.LeftButton = p5.BButton
  984.  
  985. The joystick is slightly more complicated. If you want to simulate the
  986. Joystick in PIE then you need to first download and install another
  987. program called PPJoy from the internet. This program is freely
  988. available. You also need to set up that program to add a virtual
  989. joystick. Then you need use PPJoy to set the mapping for that joystick
  990. to say how many axes and buttons it has, and which axes and buttons
  991. they are. Then in your PIE program you can do this:
  992.  
  993. ppjoy.digital0 = p5.CButton
  994.  
  995. You probably set up PPJoy to use digital 0 as the first joystick
  996. button, so this will simulate the first joystick button when you press
  997. the C Button on the joystick.
  998.  
  999. You don't need to simulate MIDI to play HALO, so I won't bore you with that.
  1000.  
  1001. If you want to simulate the keyboard you can leave out the
  1002. "keyboard." part. If you don't specify the type of hardware, it will
  1003. assume you mean the keyboard. This is fine:
  1004.  
  1005. LeftControl = p5.AButton
  1006.  
  1007. The other case where you can leave out the type of hardware is for the
  1008. following:
  1009.  
  1010. LMB, RMB, MMB
  1011.  
  1012. This will simulate the left mouse button when you press the B Button on the p5.
  1013.  
  1014. LMB = p5.BButton
  1015.  
  1016. It is not fussy about the names of the keys. It understands most of
  1017. the different names that keys have. Instead of LeftControl you could
  1018. have used any of the following:
  1019.  
  1020. LControl, LeftCtrl, LCtrl, Control, Ctrl
  1021.  
  1022. You can even use "key." instead of "keyboard.":
  1023.  
  1024. key.LCtrl = p5.AButton
  1025.  
  1026. Note that it is not Case Sensitive. You can use capitals or lowercase
  1027. interchangeably.
  1028.  
  1029. On the right hand side, instead of AButton you could use any of the following:
  1030.  
  1031. ButtonA, A, Button1
  1032.  
  1033. You can also use "glove." instead of "p5.". If you have more than one
  1034. p5 glove, then you can specify the number of the glove like this:
  1035.  
  1036. key.LCtrl = glove2.AButton
  1037.  
  1038. The syntax is very flexible. You can even write this:
  1039.  
  1040. Keyboard's LeftControl := ButtonA of glove2;
  1041.  
  1042. The semicolon at the end of the line is optional. Instead of the C
  1043. style assignment operator, you can use the Delphi one of :=
  1044.  
  1045. And instead of the "." you can use "'s " or "::" or "->" or " of ".
  1046. But if you use "of" then you need to reverse the order.
  1047.  
  1048. You can only have one statement per line, and one line per statement.
  1049.  
  1050. CODE COMPLETION
  1051. ================
  1052.  
  1053. Code Completion will automatically pop up when you type a ".". It will
  1054. not pop up if you type any of the other things, like "::".
  1055.  
  1056. If the thing before the dot is a type of hardware then it will pop up
  1057. with a list of things you can set or read from that hardware. It will
  1058. only include one name for each.
  1059.  
  1060. If you want to get a list of the types of hardware, or things you can
  1061. use before the "." then press Ctrl+Space.
  1062.  
  1063. COMPLICATED EXPRESSIONS
  1064. ========================
  1065.  
  1066. You can use mathematical operators to make more complicated
  1067. expressions on the right hand side.
  1068.  
  1069. For example, if you want to simulate the left control key when they
  1070. press both the A and the B button on the glove at the same time, then
  1071. you would write this:
  1072.  
  1073. LeftControl = p5.ButtonA and p5.ButtonB
  1074.  
  1075. You can also use OR or XOR or NOT.
  1076.  
  1077. With things that can either be true or false, you can use "+" instead of "and".
  1078.  
  1079. LeftControl = p5.ButtonA + p5.ButtonB
  1080.  
  1081. Mathematicians will tell you that this is not the way to do "and", but
  1082. to hell with them. I'm writing this programming language, not them.
  1083. I think you can also do "or" with "/", but I can't remember.
  1084.  
  1085. Some things are ambiguous, for example:
  1086. LeftControl = p5.A and p5.B or p5.C
  1087.  
  1088. This could mean that you have to either press both the first two
  1089. buttons, or just press the third one by itself. Or it could mean that
  1090. you have to either press the A and B buttons together, or the B and C
  1091. buttons together.
  1092.  
  1093. Because it is ambiguous it will give you an error when you try to compile it.
  1094. You need to put brackets around it like this if you mean the first one:
  1095.  
  1096. LCtrl = (p5.A and p5.B) or (p5.C)
  1097.  
  1098. Or like this if you mean the second one:
  1099.  
  1100. LCtrl = (p5.A) and (p5.B or p5.C)
  1101.  
  1102. Some things are analog rather than digital, and therefore have a range
  1103. of possible values. For example X, Y and Z position of the P5 glove.
  1104. In this case you can use other mathematical operators or comparisons.
  1105.  
  1106. key.w = p5.x < -200
  1107.  
  1108. This will simulate the W key if the x coordinate of the glove is less
  1109. than negative 200 p5 units.
  1110.  
  1111. All the P5 distances are measured in P5 Units. There are 51.2 P5 Units
  1112. in an Inch. This means one P5 Unit is about half a milimetre.
  1113.  
  1114. All the P5 angles are measured in DEGREES. They can range from -360 to
  1115. 360 degrees. It can tell the difference between rolling your hand
  1116. right 270 degrees and rolling your hand left 90 degrees, even though
  1117. they end up in the same position.
  1118.  
  1119. All the joystick values are between -1 and 1. This means that if you
  1120. want to simulate the joystick using the P5 you must write something
  1121. like this:
  1122.  
  1123. ppjoy.analog0 = p5.x / 400
  1124. ppjoy.analog1 = -(p5.y / 400)
  1125.  
  1126. This means that if you hold your hand 400 P5 Units (8 inches) or more
  1127. to the right of the centre then it will count as moving the joystick
  1128. all the way to the right. If you hold your hand 8 inches to the left
  1129. it will count as moving the joystick all the way to the left. The
  1130. reason why the Y coordinates are negated is because on a joystick
  1131. positive Y means down, but for the P5 positive Y means up!
  1132.  
  1133. Note that all speeds are measured in p5 units per second.
  1134.  
  1135. Finger bends are measured as 0 to 63. 0 means straight. 63 means bent.
  1136.  
  1137. You can do integer division with DIV and MOD. They don't have to be
  1138. integers to do integer division. MOD returns the remainder. DIV
  1139. returns how many times it can completely divide into it.
  1140.  
  1141. 5.7 div 1.5 is equal to 3
  1142. 5.7 mod 1.5 is equal to 1.2
  1143. This is because 1.5 divides into 5.7 three times, with 1.2 remainder.
  1144. DIV will always return an integer.
  1145.  
  1146. OPERATOR PRECEDENCE
  1147. =====================
  1148.  
  1149. The operator precedence is like this:
  1150.  
  1151. brackets
  1152. exponents ^ **
  1153. arithmetic * / + - mod div
  1154. inequality comparison < <= > >=
  1155. equality comparison = == != <>
  1156. boolean logic AND OR XOR NOT
  1157.  
  1158. mod and div can not be mixed with other arthmetic operators, including
  1159. themselves. You need brackets to avoid ambiguity.
  1160.  
  1161. Multiplication and division are done before addition and subtraction.
  1162.  
  1163. inequality comparisons can't be mixed. But you can use mathematical
  1164. range expressions like this: 200 <= p5.x <= 500 which means that x
  1165. has to be between 200 and 500.
  1166.  
  1167. and can't be mixed with or.
  1168.  
  1169. FUNCTIONS
  1170. =========
  1171.  
  1172. There are many mathematical and other functions you can use. Type
  1173. "math." to see a list of them in code completion.
  1174.  
  1175. All the Delphi maths functions are implemented. The delphi "hypot"
  1176. function has been expanded to allow an optional third parameter for
  1177. calculating 3D distances.
  1178.  
  1179. Sin, Cos and Tan all expect DEGREES.
  1180.  
  1181. eg.
  1182.  
  1183. Key.space = sin(p5.roll) > 0.5
  1184.  
  1185. There are also some date and time functions.
  1186.  
  1187. The Now() function will give you the current date and time as the
  1188. number of days since whenever. It will contain fractions telling you
  1189. the time of day.
  1190.  
  1191. There are also some special functions for clicks and presses and such things.
  1192.  
  1193. Pressed(LeftControl) will be true the instant when the Left Control
  1194. key is first pressed.
  1195.  
  1196. Released(LeftControl) will be true only for the instant when it is
  1197. first released.
  1198.  
  1199. There are also HeldDown, KeepDown, Clicked, DoubleClicked and
  1200. SingleClicked. See the recent email I wrote about them.
  1201.  
  1202. You need to include the brackets for functions. It does not currently
  1203. verify that you specified the right number of parameters. It will
  1204. ignore any extra parameters and may crash or use 0 if there are not
  1205. enough. I can't remember.
  1206.  
  1207. IF STATEMENTS
  1208. =============
  1209. You can check if something is true and then do a bunch of stuff if it
  1210. is, by using IF statements.
  1211.  
  1212. It works like this:
  1213.  
  1214. if p5.y > 800 then
  1215. LeftControl = p5.Index > 30
  1216. LeftShift = p5.Middle > 30
  1217. end if
  1218.  
  1219. This means that while you are holding your glove up high you can
  1220. simulate Control by bending your index finger, and you can simulate
  1221. Shift by bending your middle finger. If you are not holding your glove
  1222. up high then wiggling your fingers will do nothing.
  1223.  
  1224. There are no ELSE statements yet. Sorry, they haven't been implemented.
  1225.  
  1226. The syntax of the IF statement is flexible. You can use C, Pascal or
  1227. BASIC style if statements, or a combination.
  1228.  
  1229. If (p5.x>800) {
  1230. }
  1231.  
  1232. if p5.x > 800 then begin
  1233. end
  1234.  
  1235. if p5.x > 800 then
  1236. end if
  1237.  
  1238. if p5.x > 800
  1239. end
  1240.  
  1241. IMPORTANT NOTE!
  1242. If you use a bracket after the if then it will think you want to use C
  1243. Style if statements. The following will give you an error:
  1244.  
  1245. if (p5.y > 800) and (p5.x > 800) then
  1246. end if
  1247.  
  1248. So do this instead:
  1249.  
  1250. if ((p5.y > 800) and (p5.x > 800)) then
  1251. end if
  1252.  
  1253. VARIABLES
  1254. =========
  1255.  
  1256. You can use variables in your PIE programs to remember things. This is
  1257. good for two reasons. Firstly you can do complicated gestures that
  1258. require you to do a series of steps. Secondly you simplify expressions
  1259. and reuse expressions in several places.
  1260.  
  1261. You don't have to declare variables before you use them. You just
  1262. write "var." and then any name you like.
  1263.  
  1264. For example:
  1265.  
  1266. var.MovingRight = p5.x > 300
  1267. key.D = var.MovingRight
  1268.  
  1269. COMMENTS
  1270. ==========
  1271. Comments do absolutely nothing, but they are very useful.
  1272. Any line that begins with "//" will be a comment and will be drawn in
  1273. pale purple. They don't effect what the program does.
  1274.  
  1275. COMPILING AND RUNNING
  1276. =====================
  1277. You can check your program for errors by compiling it.
  1278. Chose "Compile" from the "Compile" menu.
  1279. If there are errors then a box will appear at the bottom of the window
  1280. with a list of the errors and their line numbers. You can single-click
  1281. on the error to go to that line number. The lines with errors will be
  1282. highlighted in red. If there are no errors then the box will not be
  1283. visible and it will say nothing.
  1284.  
  1285. You can run your program by chosing "Run" from the "Compile" menu. It
  1286. will automatically compile it before it starts running, so you don't
  1287. need to worry about that. It will still run if there are errors, but
  1288. the lines with errors will not be included in the program.
  1289.  
  1290. While your program is running it will display "[Running]" in the title
  1291. bar. It will continually loop through your program. Every time it gets
  1292. to the bottom it will wait 25 miliseconds then repeat again from the
  1293. top. It will simulate any keystrokes or joystick or mouse values that
  1294. you programmed while it is running.
  1295.  
  1296. To stop your program you need to chose "Stop" from the "Compile" menu.
  1297.  
  1298. By the way:
  1299. Don't forget to save your program before you exit PIE. It will not ask
  1300. you to save before you exit.
  1301.  
  1302. DEBUG
  1303. ======
  1304.  
  1305. You can debug part of your program with the DEBUG object, like this:
  1306.  
  1307. debug = p5.x > 200
  1308.  
  1309. While your program is running a box will appear in the top right
  1310. corner with the value in it.
  1311.  
  1312. ========================
  1313.  
  1314. I hope people are actually using my Programmable Input Emulator. It is
  1315. an EXTREMELY powerful tool. And it is not as difficult to use as it
  1316. might first appear. I know it uses "programming" but it is really very
  1317. simple. Most "programs" are just like:
  1318.  
  1319. W = p5.z > -800
  1320. S = p5.z < -1000
  1321. A = p5.x < 200
  1322. D = p5.x > 200
  1323.  
  1324. Ctrl = p5.index > 30
  1325.  
  1326. Part of the idea was that people in the community would write their
  1327. own PIE programs for games and applications that they use or have, and
  1328. upload them so that other lazier people can use them.
  1329.  
  1330. So can people try it out and upload some PIE programs they have
  1331. written into the files section of this group, or just cut and paste
  1332. them into a message and send them out?
  1333.  
  1334. ==========================
  1335. I'm just surprised that PIE even works on Windows 98.
  1336.  
  1337. I think you'll find that keyboard emulation won't work on Windows 98
  1338. with the current version of PIE. I can change this in a later version
  1339. of PIE, but I still won't be able to get keyboard emulation to work in
  1340. DirectInput games on Windows 98. At least not without a very different
  1341. technique (like hooking the DirectInput function calls, or writing my
  1342. own keyboard driver). I'm really sorry. It is just a limitation of the
  1343. Windows API in Windows 98. I will try and make a new version that will
  1344. emulate the keyboard in non-DirectInput programs on Windows 95 and 98.
  1345.  
  1346. Joystick emulation (with PPJoy), Mouse Emulation and MIDI emulatuion
  1347. should work on windows 98.
  1348.  
  1349. I have never had a problem with PPJoy and the pitch and yaw axes. It
  1350. might be Windows 98. Or it might be that your DirectInput version is
  1351. too old.
  1352.  
  1353. Absolute mode is completely absolute. It uses the absolute angles of
  1354. the LEDs and converts them into absolute LED coordinates. Then it
  1355. chooses the most accurate LED and uses its position combined with the
  1356. rotation measurement to work out the absolute position of the centre
  1357. of the glove. Unfortunately the hardware is not very precise so the
  1358. LED coordinates aren't quite exact, and the rotation is not always
  1359. calculateable, so it isn't always right.
  1360.  
  1361. X and Y should be 0 when your middle finger is pointing at the red
  1362. light on the front of the receptor.
  1363.  
  1364. I have never got the opposite extreme values you mention. When the
  1365. glove is out of range the current version of PIE will predict the
  1366. glove's current location based on its velocity and acceleration when
  1367. it left visibility. Prediction only works in filtered mode with the
  1368. BETA 2 DualMode driver. If you run PIE with the BETA 1 DualMode
  1369. driver then it will just use the last detected position when you go
  1370. out of range.
  1371.  
  1372. The filtered absolute mode (which is what PIE uses when you use X, Y
  1373. and Z) will smooth out the values and use prediction to try and give
  1374. you the correct absolute location of the glove.
  1375.  
  1376. The maximum x and y values without using prediction are equal to the
  1377. current z value (only not negative). For example if the current z
  1378. value is -1000 then the maximum x and y values are 1000. I'm not sure
  1379. about the maximum z value. But I have not had any problem with
  1380. prediction giving me the wrong values when the glove is out of range.
  1381. Prediction is my friend.
  1382.  
  1383. When you say recalibrate the P5, I assume you mean recalibrate PPJoy's
  1384. virtual joystick. The P5 will not be controlling the virtual joystick
  1385. unless PIE or my other emulator is running. So the P5's location on
  1386. startup can not affect the virtual joystick's calibration. Personally
  1387. I have never calibrated the virtual joystick, and recommend leaving
  1388. the default calibration and adjusting your PIE program instead. Don't
  1389. forget if you want to access the joystick control panel applet you can
  1390. do it from the Settings menu in PIE.
  1391.  
  1392. I am sorry keyboard emulation won't work in Windows 98.
  1393.  
  1394. ==========================
  1395.  
  1396. Setting MIDI values inside an IF statement will send a MIDI message
  1397. every time it is executed, if you are using the latest version of PIE.
  1398. If you are using the version I think you are using then it will only
  1399. send a MIDI message the first time you set it to non-zero. Neither of
  1400. these behaviours is desirable, although I think the new one may be
  1401. slightly less bad. But I have to redesign things to fix this.
  1402.  
  1403. Setting PPJoy values inside an IF statement should work OK.
  1404.  
  1405. Don't forget if you set something to true in an if statement then it
  1406. will stay true until you eventually set it to false in another if
  1407. statement.
  1408.  
  1409. The other cool MIDI property you should experiment with is
  1410. Midi.Instrument. BUT you need to divide the instrument number by 127.
  1411.  
  1412. Try this:
  1413.  
  1414. if not p5.a then
  1415. var.ADown = false
  1416. end if
  1417.  
  1418. if p5.a and not var.ADown then
  1419. var.Instrument = random(128)
  1420. var.ADown = true
  1421. end if
  1422.  
  1423. midi.Instrument = var.Instrument/127
  1424.  
  1425. You have already seen the Midi.Volume property.
  1426.  
  1427. All the midi properties are between 0 and 1. The notes can only be
  1428. true or false (1 or 0). This means that some things you have to divide
  1429. by 127 (MIDI uses 7 bit bytes).
  1430.  
  1431. Most of the MIDI support was designed for things like AudioMulch
  1432. rather than actually playing music on your soundcard. Playing music
  1433. and sound effects for audio feedback is just an added bonus. :-)
  1434.  
  1435. As well as the notes you can also set the note velocities and the note
  1436. aftertouch.
  1437.  
  1438. eg. Midi.C5Velocity = 100/127
  1439.  
  1440. I have no idea what this does :-) Probably strikes the note harder if
  1441. your soundcard supports that. Setting a note to true is equivalent to
  1442. setting its velocity to 64/127. Setting a note to false is almost
  1443. equivalent to setting its velocity to 0.
  1444.  
  1445. Another useful one might be Midi.PanPosition
  1446.  
  1447. There are lots of properties you can set, but most of them probably
  1448. don't work on sound cards.
  1449.  
  1450. By the way, most of these properties apply only to their own midi channel.
  1451. You can do this:
  1452.  
  1453. Midi.Channel1.Instrument = 0
  1454. Midi.Channel2.Instrument = 42
  1455. Midi.Channel1.PanPosition = 0/127
  1456. Midi.Channel2.PanPosition = 127/127
  1457. Midi.Channel1.MiddleC = key.LeftShift
  1458. Midi.Channel2.MiddleC = key.RightShift
  1459.  
  1460. There are 16 channels.
  1461.  
  1462. There are 128 controls you can set, numbered 0 to 127, I think
  1463. Instument and PanPosition are two of them. The first 32 actually have
  1464. 14 bits of precision. The rest only have 7. Controls 32 to 63 are the
  1465. bottom 7 bits of the first 32 controls. You can set the controls by
  1466. name or number.
  1467.  
  1468. eg. Midi.Control2 = 32/127
  1469.  
  1470. Anyway, get the current version of PIE and use its code completion.
  1471.  
  1472.  
  1473. =============
  1474. =============
  1475. Version 0.13:
  1476. =============
  1477. =============
  1478.  
  1479. What's new in 0.13:
  1480. This long boring readme.txt file
  1481. PPJoy output now actually works
  1482.  
  1483. In PPJoy you can set up multiple virtual joysticks numbered from 1 to 16.
  1484. You can use any of these virtual joysticks in PIE like this:
  1485.  
  1486. PPJoy5.Digital0 = key.RightShift
  1487. PPJoy5.Digital1 = key.RightControl
  1488.  
  1489. If you leave out the number, or specify 0, then it will use Virtual Joystick 1.
  1490.  
  1491.  
  1492.  
  1493. =============
  1494. =============
  1495. Version 0.12:
  1496. =============
  1497. =============
  1498.  
  1499. New features are:
  1500.  
  1501. Code Completion
  1502. Troubleshooter menu with fix for Roid's errors
  1503. Support for multiple P5 gloves
  1504. Support for multiple PPJoy virtual joysticks
  1505. Assignments inside IF statements behave more sensibly.
  1506. Improved Lord Of The Rings program
  1507. Pressed, Released, Clicked, DoubleClicked, SingleClicked, HeldDown and
  1508. KeepDown functions
  1509.  
  1510. Things to watch out for:
  1511.  
  1512. The Midi object now numbers from 1 instead of from 0. This is to make
  1513. everything more consistent. This means Midi1 is the first midi device,
  1514. Midi2 is the second, etc. Midi0 is the Midi Mapper.
  1515.  
  1516. Glove and PPJoy also number from 1.
  1517.  
  1518. Setting MIDI expressions inside an IF statement will now send a MIDI
  1519. message every frame, unlike outside an IF statement where they only
  1520. send a message when that variable has changed.
  1521.  
  1522. New features Instructions
  1523. ==================
  1524.  
  1525. Code Completion is invoked by pressing Ctrl+Space, or by typing a dot.
  1526. To select an item you can type part of it or use the arrow keys, the
  1527. press Enter. You can press Escape to cancel it. You can disable Code
  1528. Completion from the Troubleshooter menu. Code Completion doesn't work
  1529. correctly when you type Dot if you haven't done Ctrl+Space yet, so PIE
  1530. simulates a Ctrl+Space followed by Escape key press on startup. This
  1531. may do weird things, but you probably don't need to worry about it.
  1532.  
  1533. The troubleshooter menu allows you to disable Code Completion, PPJoy
  1534. updates and DirectInput reads. Note that DirectInput is always
  1535. initialized and finalized even when reads are disabled. The settings
  1536. are not saved when you exit and restart PIE.
  1537.  
  1538. You can use multiple P5 Gloves now like this: Key.Enter = glove2.ButtonA
  1539. or like this: Key.Enter = p5.glove2.ButtonA
  1540. or like this: Key.Enter = p52.ButtonA
  1541. I don't recommend the last one.
  1542.  
  1543. You can use multiple PPJoy devices like this:
  1544. PPJoy2.Digital0 = glove2.ButtonA
  1545. You must have set up PPJoy to have multiple Virtual Joysticks before
  1546. this will work.
  1547.  
  1548. Normally when you set something equal to something else in PIE, it
  1549. only executes the assignment if the expression on the RHS has changed
  1550. since PIE evaluated it last. This philosophy doesn't work inside IF
  1551. statements, since the previous value of the variable will have been
  1552. set elsewhere via a different expression. Key presses behave correctly
  1553. inside an IF statement now, but some other assignments will update the
  1554. property every time the IF statement is executed, whether the value
  1555. has changed or not. Functions like Pressed and Released don't work
  1556. properly inside the body of an IF statement (although they work fine
  1557. in the condition).
  1558.  
  1559. The LordOfTheRings program now has a better bow and arrow system, with
  1560. MIDI sound effects to give you a clue when your gestures have been
  1561. recognised. Also you can parry by rolling your hand quickly (twirling
  1562. your weapon like the character does). To fire your bow you hold the
  1563. bow out in front of you with your left hand (which isn't tracked, but
  1564. helps the illusion), then you reach out with your right hand to grab
  1565. the bow string with your index middle and ring fingers. They should be
  1566. bent but not completely bent. Then pull the bow string back to your
  1567. chin. Then release the bow string by extending those three fingers.
  1568. Then to fire another arrow you reach out again and pull the string
  1569. back again. To go back to your sword just bend your hand around the
  1570. sword handle. To let go of the bow without firing, just move the bow
  1571. string back towards the bow and let it go away from your chin. Most of
  1572. the other gestures in lord of the rings now require you to have your
  1573. fingers bent in a fist like you are holding your sword.
  1574.  
  1575. The Pressed function only returns true for a single frame when the
  1576. key, button or expression is first pressed. The released function only
  1577. returns true when the key is first released. These work not just on
  1578. keys and buttons, but on any expression. For example Midi.c5 =
  1579. pressed(p5.x > 200) will play a very short note when the glove first
  1580. crosses the border into the area to the right of 200.
  1581.  
  1582. The Clicked function works the same as the released function for now.
  1583. The DoubleClicked function returns true for an instant when you double
  1584. click the button. This uses the Mouse.DoubleClickTime property which
  1585. you can set in the Mouse control panel. It works not just on mouse
  1586. buttons, but for any key or any expression.
  1587. The SingleClicked function requires you to click the button, then it
  1588. waits for the DoubleClickTime for you to press it again. If you don't
  1589. press it again within that time it returns true. This is necessary to
  1590. distinguish between single clicks and double clicks, but it adds the
  1591. better part of a second in delay between when you click and when it
  1592. registers.
  1593.  
  1594. The HeldDown function has two parameters like this:
  1595. Midi.C5 = HeldDown(RightShift, 0.8)
  1596. This requires you to hold down the shift key for 0.8 seconds before it
  1597. starts to register. It will then return true until you release it. You
  1598. can do this with any expression.
  1599. Midi.C5 = HeldDown(p5.y > 400, 5)
  1600. This requires you to leave your hand up in the air for five seconds
  1601. before it registers.
  1602. If you only want it to return true for an instant, rather than the
  1603. rest of the time it is held down, you can use the Pressed function:
  1604. Midi.C5 = Pressed(HeldDown(RightShift, 0.8))
  1605.  
  1606. The KeepDown function is really cool though. It makes an expression
  1607. return true for at least a given amount of time.
  1608. Midi.C5 = KeepDown(RightShift, 2)
  1609. This will play Middle C for at least two seconds, even if you only tap
  1610. the shift key.
  1611. If you hold down the key for longer than two seconds it will play for
  1612. longer than two seconds.
  1613. There is a bug which stops the KeepDown function from working on the
  1614. Pressed function. I don't understand why. But
  1615. KeepDown(Pressed(RightShift), 2) will not work (at least not for me).
  1616.  
  1617.  
  1618. =============
  1619. =============
  1620. Version 0.11:
  1621. =============
  1622. =============
  1623.  
  1624.  
  1625. I have updated the Programmable Input Emulator.
  1626. It now has a proper IDE (which has a strange resemblance to Delphi)
  1627. with Syntax Highlighting and a fancy error window that pops out.
  1628.  
  1629. And it now supports MIDI. Well MIDI output. I haven't finished
  1630. implementing MIDI input yet for those of you who want to play DOOM 3
  1631. on your piano keyboard. But you can control your piano keyboard, or
  1632. any other MIDI hardware or software, from PIE. Included is a simple
  1633. PIE program to play notes with your glove.
  1634.  
  1635. You can now access the following Control Panel applets from the PIE
  1636. menu: P5, PPJoy, Joystick, Mouse, Keyboard, and MIDI.
  1637.  
  1638. New language features include variables and IF statements.
  1639.  
  1640. You don't need to declare variables. Just set or read Var.whatever
  1641.  
  1642. If statements are now partially supported. They can be single line or
  1643. multi-line and can use C, Pascal or BASIC syntax. ELSE is not
  1644. implented yet. Setting inputs from inside an IF statement doesn't
  1645. quite work properly yet, so use a variable instead.
  1646.  
  1647. A few samples are included with this version of PIE.
  1648.  
  1649. There are some bug fixes in this version too. You are no longer forced
  1650. to multiply by dividing (like a single celled organism).
  1651.  
  1652. MIDI support is quite complete. You can specify what drivers you want
  1653. to send it to and what channel. You can set notes on or off, or you
  1654. can set controls or channel variables.
  1655.  
  1656. You choose the driver like this:
  1657. midi.whatever // MIDI Mapper, default driver set in control panel
  1658. midi0.whatever // first driver
  1659. midi1.whatever // second driver, etc.
  1660.  
  1661. midi.thru1.whatever // first MIDI Thru port, you need MIDI Yoke or
  1662. something like it
  1663. midi.thru2.whatever // second MIDI Thru port
  1664.  
  1665. midi.port1.whatever // first MIDI port, either a virtual Thru port or
  1666. an external one
  1667.  
  1668. midi.software1.whatever // first software wavetable player
  1669.  
  1670. midi.soundcard1.whatever // first soundcard's built in MIDI driver
  1671.  
  1672. midi.player1.whatever // first MIDI player, either software or soundcard
  1673.  
  1674. You can choose the channel like this:
  1675.  
  1676. midi.channel1.whatever
  1677. midi.player1.channel1.whatever
  1678.  
  1679. You can set notes like this:
  1680.  
  1681. midi.MiddleC = key.RightShift
  1682. midi.c5 = key.RightShift
  1683. midi.CSharp5 = key.LeftShift
  1684.  
  1685. You can set controls like this (the range is 0 to 1):
  1686.  
  1687. midi.control31 = p5.x / 400
  1688.  
  1689. midi.ByteControl68 = p5.x / 400
  1690.  
  1691. You can also use the control name:
  1692.  
  1693. midi.FootPedal = key.RightShift
  1694.  
  1695. You can read the driver name like this:
  1696.  
  1697. debug = midi.software1.name
  1698.  
  1699. You can change the instrument like this:
  1700.  
  1701. midi.channel2.instrument = 7
  1702.  
  1703. Have fun!
  1704.  
  1705. Currently there is only support for CC (Change Controller) messages,
  1706. and not RPN (Registered Parameter Numbers) or NRPN (Non Registered
  1707. Parameter Numbers). This is partly because I only just found out there
  1708. was such a thing.
  1709. However, do not dispair. RPN and NRPN messages are both constructed
  1710. from CC messages, so theoretically it should be possible like this:
  1711.  
  1712. // Set to RPN 0, 0 (Pitch Bend Range)
  1713. Midi.port1.Control101 = 0/127 // RPN MSB Parameter = 0
  1714. Midi.port1.Control100 = 0/127 // RPN LSB Parameter = 0
  1715. Midi.port1.Control6 = 4/127 // 4 semitones
  1716. Midi.port1.Control101 = 127/127
  1717. Midi.port1.Control100 = 127/127
  1718.  
  1719. Note that all the values are between 0 and 1. Control6 is actually a
  1720. 14-bit one by default, so you might prefer to use ByteControl6 and
  1721. Control38.
  1722.  
  1723. The port numbers are not set with a variable, so you would have to use
  1724. if statements. Let's see if we can write a program to set the pitch
  1725. range...
  1726.  
  1727. // PIE Program to set the pitch range via RPN
  1728. // Index finger bend controls the pitch range 0 - 10 semitones
  1729. // Button A goes back a port. Button B goes forward a port. Ports are
  1730. from 1 to 5.
  1731.  
  1732. if not var.initialized then
  1733. var.port = 1
  1734. var.initialized = true
  1735. end if
  1736.  
  1737. if not p5.ButtonA then
  1738. var.APressed = false
  1739. end if
  1740.  
  1741. if not p5.ButtonB then
  1742. var.BPressed = false
  1743. end if
  1744.  
  1745. // A Button goes back one port
  1746. if p5.ButtonA and not var.APressed then
  1747. var.APressed = true
  1748. var.port = var.port - 1
  1749. end if
  1750.  
  1751. // B Button goes forward one port
  1752. if p5.ButtonB and not var.BPressed then
  1753. var.BPressed = true
  1754. var.port = var.port + 1
  1755. end if
  1756.  
  1757. if var.port < 1 then
  1758. var.port = 5
  1759. end if
  1760.  
  1761. if var.port > 5 then
  1762. var.port = 1
  1763. end if
  1764.  
  1765. // show the port number
  1766. debug = var.port
  1767.  
  1768. var.semitones = int(p5.index / 6)
  1769.  
  1770. if var.port = 1 then
  1771. // Set to RPN 0, 0 (Pitch Bend Range)
  1772. Midi.port1.Control101 = 0/127 // RPN MSB Parameter = 0
  1773. Midi.port1.Control100 = 0/127 // RPN LSB Parameter = 0
  1774. Midi.port1.ByteControl6 = semitones/127
  1775. Midi.port1.Control101 = 127/127
  1776. Midi.port1.Control100 = 127/127
  1777. end if
  1778.  
  1779. if var.port = 2 then
  1780. // Set to RPN 0, 0 (Pitch Bend Range)
  1781. Midi.port2.Control101 = 0/127 // RPN MSB Parameter = 0
  1782. Midi.port2.Control100 = 0/127 // RPN LSB Parameter = 0
  1783. Midi.port2.ByteControl6 = semitones/127
  1784. Midi.port2.Control101 = 127/127
  1785. Midi.port2.Control100 = 127/127
  1786. end if
  1787.  
  1788. if var.port = 3 then
  1789. // Set to RPN 0, 0 (Pitch Bend Range)
  1790. Midi.port3.Control101 = 0/127 // RPN MSB Parameter = 0
  1791. Midi.port3.Control100 = 0/127 // RPN LSB Parameter = 0
  1792. Midi.port3.ByteControl6 = semitones/127
  1793. Midi.port3.Control101 = 127/127
  1794. Midi.port3.Control100 = 127/127
  1795. end if
  1796.  
  1797. if var.port = 4 then
  1798. // Set to RPN 0, 0 (Pitch Bend Range)
  1799. Midi.port4.Control101 = 0/127 // RPN MSB Parameter = 0
  1800. Midi.port4.Control100 = 0/127 // RPN LSB Parameter = 0
  1801. Midi.port4.ByteControl6 = semitones/127
  1802. Midi.port4.Control101 = 127/127
  1803. Midi.port4.Control100 = 127/127
  1804. end if
  1805.  
  1806. if var.port = 5 then
  1807. // Set to RPN 0, 0 (Pitch Bend Range)
  1808. Midi.port5.Control101 = 0/127 // RPN MSB Parameter = 0
  1809. Midi.port5.Control100 = 0/127 // RPN LSB Parameter = 0
  1810. Midi.port5.ByteControl6 = semitones/127
  1811. Midi.port5.Control101 = 127/127
  1812. Midi.port5.Control100 = 127/127
  1813. end if
  1814.  
  1815. Of course this is programmable so you can have it go from 127 to 0 if
  1816. you prefer.
  1817. eg.
  1818.  
  1819. // Bending the middle finger makes it quieter...
  1820. Midi.Volume = 1-(p5.middle/63)
  1821.  
  1822. Anyway, none of the code in this email has been tested, but it should
  1823. give you some idea of the power of PIE, and the techniques required.
  1824.  
  1825.  
  1826. "Whatever" means the field. It can be the name of a note, the name of
  1827. a controller, or some other field.
  1828.  
  1829. For example:
  1830.  
  1831. // play Middle C out your speakers when you press Right Shift on the PC Keyboard
  1832. Midi.Player.MiddleC = Keyboard.RightShift
  1833.  
  1834. // Alternative ways of writing the exact same thing:
  1835. Midi.Player.Channel1.MiddleC = Keyboard.RightShift
  1836. Midi.Player1.Channel1.MiddleC = Keyboard.RightShift
  1837. Midi.Player.Channel1.C5 = Keyboard.RightShift
  1838.  
  1839. Another example:
  1840.  
  1841. // Set 14-bit Controller number 0 to 50% via virtual MIDI Thru port 1
  1842. (eg. NT Yoke 1)
  1843. Midi.Thru1.Control0 = 0.5
  1844.  
  1845. // Set 7-bit Controller number 40 to your finger bend via virtual
  1846. MIDI Thru port 1 (eg. NT Yoke 1)
  1847. Midi.Thru1.ByteControl40 = p5.index/63
  1848.  
  1849. You can not "select drivers and channels" globally. You have to
  1850. specify them for every variable. If you do not specify the driver then
  1851. it defaults to the MIDI Mapper (You can change the MIDI Mapper device
  1852. in control panel). If you do not specify the channel then it defaults
  1853. to channel 1.
  1854.  
  1855. See the musical.PIE sample file for a very simple example.
  1856.  
  1857. The next version of PIE (tomorrow) will have Code Completion which
  1858. will make things easier to understand.
  1859.  
  1860.  
  1861.  
  1862. =============
  1863. =============
  1864. Version 0.10:
  1865. =============
  1866. =============
  1867.  
  1868. I have uploaded the current version of my Programmable Input Emulator.
  1869.  
  1870. I hope you don't like instructions because it doesn't come with any yet.
  1871.  
  1872. You need the Dual Mode Driver (either Beta 1, or the new Beta 2 I
  1873. released today), it is not included.
  1874.  
  1875. Basically you write a program in the box on the left, then compile it
  1876. to see if there are any errors, then you run it. Click Stop when you
  1877. have finished running it.
  1878.  
  1879. The program is basically a list of assignment statements, of the form
  1880. something = something. It is repeated continuously until you press
  1881. Stop.
  1882.  
  1883. There are several objects with different properties.
  1884.  
  1885. Keyboard/Key
  1886. Mouse
  1887. Joystick
  1888. P5/Glove
  1889. PPJoy
  1890.  
  1891. For example:
  1892. key.Enter = glove.ButtonA
  1893.  
  1894. There are lots of mathematical operators and functions (all the maths
  1895. functions from Delphi are implemented).
  1896.  
  1897. To emulate the joystick use PPJoy.
  1898. eg.
  1899.  
  1900. PPJoy.Analog0 = P5.x / 400
  1901. PPJoy.Digital4 = P5.Index > 30
  1902.  
  1903. Here are some of the properties:
  1904. Mouse.x y
  1905. Mouse.LeftButton MiddleButton RightButton
  1906. Mouse.DirectInputX DirectInputY
  1907. Mouse.CursorPosX CursorPosY
  1908. Mouse.WheelUp // set only
  1909. Mouse.WheelDown // set only
  1910. Mouse.Cursor // which cursor is currenly being displayed 1 is Arrow, etc.
  1911.  
  1912. Joystick.x y z yaw pitch roll slider dial
  1913. Joystick.xvelocity yvelocity zvelocity
  1914. Joystick.button1 ... button128
  1915.  
  1916. P5.x y z yaw pitch roll
  1917. P5.A B C D
  1918. P5.Thumb Index Middle Ring Pinky
  1919. P5.xvelocity yvelocity zvelocity
  1920.  
  1921. Key.<any key name>
  1922.  
  1923. PPJoy.analog0 ... analog15
  1924. PPJoy.digital0 ... digital31
  1925.  
  1926. A very useful variable that you can assign things to is "debug"
  1927. eg:
  1928.  
  1929. debug = P5.x
  1930.  
  1931. This will display the X coordinate in the small box in the window.
  1932.  
  1933. There are lots of other variables, properties and features that I
  1934. don't have time to explain. Most of the properties have several
  1935. alternate names.
  1936.  
  1937. Anyway, have fun. I'll supply some more PIE programs soon.
  1938.  
  1939. I just discovered a humourous/embarassing bug in my Programmable Input
  1940. Emulator. It can't multiply. It does division instead. I never
  1941. actually tested multiplication, since the P5 coordinates are quite
  1942. large numbers, and I always used division, so I didn't find this bug
  1943. until now.
  1944.  
  1945. So if you want to multiply something by 5, just divide it by 1/5.
  1946. eg.
  1947.  
  1948. debug = p5.x / (1/5)
  1949.  
  1950. Until I have fixed it :-)
  1951.  
  1952. This is what people get for being impatient :-)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement