|
@@ -0,0 +1,559 @@
|
|
1
|
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
2
|
+<html>
|
|
3
|
+<head>
|
|
4
|
+ <title>Programmable Input Emulator 0.41</title>
|
|
5
|
+
|
|
6
|
+ <meta http-equiv="content-type"
|
|
7
|
+ content="text/html; charset=ISO-8859-1">
|
|
8
|
+
|
|
9
|
+ <meta name="author" content="Carl Kenner">
|
|
10
|
+</head>
|
|
11
|
+ <body>
|
|
12
|
+
|
|
13
|
+<h1>Programmable Input Emulator 0.41 Introduction</h1>
|
|
14
|
+ <br>
|
|
15
|
+
|
|
16
|
+(Don't forget to also read the Documentation.rtf file)<p>
|
|
17
|
+ The GlovePIE Programmable Input Emulator (previously known as PIE) emulates input devices
|
|
18
|
+by using other input devices.<br>
|
|
19
|
+ This means you can use the joystick in a keyboard only game (eg. DOOM3)
|
|
20
|
+ or the keyboard in a joystick only game (eg. Return Of The King Co-op mode).
|
|
21
|
+ Or you can control any game with a virtual reality glove. Or you can create
|
|
22
|
+ macros to do complex moves at the touch of a button (eg. Mortal Kombat).
|
|
23
|
+Or you can play musical instruments from your PC.<br>
|
|
24
|
+ <br>
|
|
25
|
+ This is still a beta version, so it will be buggy and incomplete.<br>
|
|
26
|
+
|
|
27
|
+<h2>You can emulate:</h2>
|
|
28
|
+
|
|
29
|
+<ul>
|
|
30
|
+ <li>the mouse</li>
|
|
31
|
+ <li>the keyboard (on windows 2000 and XP)</li>
|
|
32
|
+ <li>Multiple joysticks or gamepads (if you download and install PPJoy)</li>
|
|
33
|
+ <li>Multiple MIDI devices (if you download and install Midi Yoke or
|
|
34
|
+Hubi's loopback driver)</li>
|
|
35
|
+ <li>Microphone input (in theory)</li>
|
|
36
|
+
|
|
37
|
+</ul>
|
|
38
|
+ <br>
|
|
39
|
+
|
|
40
|
+<h2>You can get input from:</h2>
|
|
41
|
+
|
|
42
|
+<ul>
|
|
43
|
+ <li>multiple mice</li>
|
|
44
|
+ <li>multiple keyboards</li>
|
|
45
|
+ <li>multiple joysticks or gamepads</li>
|
|
46
|
+ <li>Multiple Essential Reality P5 virtual reality gloves</li>
|
|
47
|
+ <li>multiple MIDI devices</li>
|
|
48
|
+ <li>a microphone</li>
|
|
49
|
+
|
|
50
|
+</ul>
|
|
51
|
+ <br>
|
|
52
|
+
|
|
53
|
+<h2>Requirements:</h2>
|
|
54
|
+
|
|
55
|
+<ul>
|
|
56
|
+ <li>DirectX 8 or higher</li>
|
|
57
|
+ <li>PPJoy if you want to use virtual joysticks</li>
|
|
58
|
+ <li>Midi Yoke if you want to emulate MIDI
|
|
59
|
+input</li>
|
|
60
|
+ <li>Windows 2000 or above if you want to emulate the keyboard</li>
|
|
61
|
+ <li>SAPI 5.0 (Comes with Windows XP and Office XP) or SAPI 5.1 if you
|
|
62
|
+ want speech synthesis and recognition</li>
|
|
63
|
+
|
|
64
|
+</ul>
|
|
65
|
+ I highly recommend buying an Essential Reality P5 virtual reality glove.
|
|
66
|
+ They are very cheap. You can do wonderous
|
|
67
|
+things with a virtual reality glove and PIE! Actually you should buy two since
|
|
68
|
+they are cheap and you save on shipping if you buy both at once.<br>
|
|
69
|
+ <br>
|
|
70
|
+
|
|
71
|
+<h2>Installing:</h2>
|
|
72
|
+ <br>
|
|
73
|
+ Just extract the ZIP file into whatever folder you want. There is
|
|
74
|
+ no installation program.<br>
|
|
75
|
+ You will also need to download and install PPJoy and Midi Yoke if you
|
|
76
|
+want to use them. After you install PPJoy you need to create at least one
|
|
77
|
+virtual joystick.<br>
|
|
78
|
+ You should associate .PIE files with GlovePIE in windows, so you can just click
|
|
79
|
+ on PIE scripts and open them in GlovePIE.<br>
|
|
80
|
+ <br>
|
|
81
|
+
|
|
82
|
+<h2>Uninstalling:</h2>
|
|
83
|
+ Just delete the folder you installed GlovePIE into.<br>
|
|
84
|
+ You may also want to remove or change the association for .PIE files.<br>
|
|
85
|
+ <br>
|
|
86
|
+
|
|
87
|
+<h2>Running:</h2>
|
|
88
|
+ You can start GlovePIE by double clicking on its icon in windows explorer,
|
|
89
|
+or by double clicking on a .PIE file if you have set up the associations.
|
|
90
|
+You can also start it from a command prompt (aka DOS window), or create
|
|
91
|
+a shortcut to it on your desktop, quick-launch bar, or start menu. <br>
|
|
92
|
+ <br>
|
|
93
|
+ By default, when PIE starts it displays an empty script window. You can
|
|
94
|
+ write a new PIE script there, or you can load an existing file from the
|
|
95
|
+file menu. But it will not actually do anything until you choose "Run" from
|
|
96
|
+the "Run!" menu. Then it will check your script for errors and run it. If
|
|
97
|
+there are any errors it will just ignore those lines. When you have finished
|
|
98
|
+playing you can choose "Stop" from the "Run!" menu. PIE will not emulate
|
|
99
|
+anything unless it is running. Exiting PIE by closing its window will stop
|
|
100
|
+all emulation. You can also just check your program for errors without running
|
|
101
|
+it by choosing "Check for errors" from the "Run" menu. If there are any
|
|
102
|
+errors a box will pop up at the bottom of the window with a list of errors
|
|
103
|
+and line numbers. If nothing appears then there are no errors. You can tell
|
|
104
|
+when your script is running because the title bar at the top of the window
|
|
105
|
+will change.<br>
|
|
106
|
+ <br>
|
|
107
|
+ If you run PIE from the command prompt or a shortcut then you can specify
|
|
108
|
+ command line parameters. You must use quotation marks around any parameter
|
|
109
|
+ which includes a space.<br>
|
|
110
|
+
|
|
111
|
+<table cellpadding="2" cellspacing="2" border="1" width="60%">
|
|
112
|
+ <tbody>
|
|
113
|
+ <tr>
|
|
114
|
+ <td valign="top"><i>filename.PIE</i><br>
|
|
115
|
+ </td>
|
|
116
|
+ <td valign="top">The name of a PIE script to open. You may or may
|
|
117
|
+ not include the .PIE extension. The script will not do anything until you
|
|
118
|
+ choose "Run" from the "Run!" menu.<br>
|
|
119
|
+ </td>
|
|
120
|
+ </tr>
|
|
121
|
+ <tr>
|
|
122
|
+ <td valign="top">
|
|
123
|
+ <pre>-<i>filename.PIE</i></pre>
|
|
124
|
+ </td>
|
|
125
|
+ <td valign="top">The name of a PIE script to open and run. You may
|
|
126
|
+ or may not include the .PIE extension. It will start running automatically<br>
|
|
127
|
+ </td>
|
|
128
|
+ </tr>
|
|
129
|
+ <tr>
|
|
130
|
+ <td valign="top">
|
|
131
|
+ <pre>/r:<i>filename.EXE</i></pre>
|
|
132
|
+ </td>
|
|
133
|
+ <td valign="top">The name of a .EXE file or other program to start
|
|
134
|
+ running automatically when PIE starts. This allows you to start the game
|
|
135
|
+and PIE at the same time.<br>
|
|
136
|
+ </td>
|
|
137
|
+ </tr>
|
|
138
|
+
|
|
139
|
+ </tbody>
|
|
140
|
+</table>
|
|
141
|
+ <br>
|
|
142
|
+ <br>
|
|
143
|
+
|
|
144
|
+<h2>Menus:</h2>
|
|
145
|
+ PIE has the following menus:<br>
|
|
146
|
+ <br>
|
|
147
|
+
|
|
148
|
+<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
|
149
|
+ <tbody>
|
|
150
|
+ <tr>
|
|
151
|
+ <td valign="top">File<br>
|
|
152
|
+ </td>
|
|
153
|
+ <td valign="top"><br>
|
|
154
|
+ </td>
|
|
155
|
+ <td valign="top">Standard file menu. Except the only way to save
|
|
156
|
+files is by choosing "Save As..."<br>
|
|
157
|
+ </td>
|
|
158
|
+ </tr>
|
|
159
|
+ <tr>
|
|
160
|
+ <td valign="top">File<br>
|
|
161
|
+ </td>
|
|
162
|
+ <td valign="top">New<br>
|
|
163
|
+ </td>
|
|
164
|
+ <td valign="top">Clears the script window. You will lose your work
|
|
165
|
+ if you haven't saved it.<br>
|
|
166
|
+ </td>
|
|
167
|
+ </tr>
|
|
168
|
+ <tr>
|
|
169
|
+ <td valign="top">File<br>
|
|
170
|
+ </td>
|
|
171
|
+ <td valign="top">Open...<br>
|
|
172
|
+ </td>
|
|
173
|
+ <td valign="top">Load a PIE script file. This will not start it
|
|
174
|
+running until you choose "Run" from the "Run!" menu. <br>
|
|
175
|
+ You will lose your work if you haven't saved it.<br>
|
|
176
|
+ </td>
|
|
177
|
+ </tr>
|
|
178
|
+ <tr>
|
|
179
|
+ <td valign="top">File<br>
|
|
180
|
+ </td>
|
|
181
|
+ <td valign="top">Save As...<br>
|
|
182
|
+ </td>
|
|
183
|
+ <td valign="top">The only way to save a file. If you don't use this
|
|
184
|
+ you will lose your work! <br>
|
|
185
|
+ You need to choose the filename every time. Sorry.<br>
|
|
186
|
+ </td>
|
|
187
|
+ </tr>
|
|
188
|
+ <tr>
|
|
189
|
+ <td valign="top">File<br>
|
|
190
|
+ </td>
|
|
191
|
+ <td valign="top">Exit<br>
|
|
192
|
+ </td>
|
|
193
|
+ <td valign="top">Quit PIE and stop emulating anything. Please save
|
|
194
|
+ your work before you choose this. <br>
|
|
195
|
+ It will NOT ask you whether you want to save.<br>
|
|
196
|
+ </td>
|
|
197
|
+ </tr>
|
|
198
|
+ <tr>
|
|
199
|
+ <td valign="top">Edit<br>
|
|
200
|
+ </td>
|
|
201
|
+ <td valign="top"><br>
|
|
202
|
+ </td>
|
|
203
|
+ <td valign="top">Standard edit commands<br>
|
|
204
|
+ </td>
|
|
205
|
+ </tr>
|
|
206
|
+ <tr>
|
|
207
|
+ <td valign="top">Run!<br>
|
|
208
|
+ </td>
|
|
209
|
+ <td valign="top"><br>
|
|
210
|
+ </td>
|
|
211
|
+ <td valign="top">The Run menu is for running and checking your script.
|
|
212
|
+ It won't emulate anything unless it is running.<br>
|
|
213
|
+ </td>
|
|
214
|
+ </tr>
|
|
215
|
+ <tr>
|
|
216
|
+ <td valign="top">Run!<br>
|
|
217
|
+ </td>
|
|
218
|
+ <td valign="top">Check for errors<br>
|
|
219
|
+ </td>
|
|
220
|
+ <td valign="top">Check the script for errors. This was called "Compile"
|
|
221
|
+ in the previous version. <br>
|
|
222
|
+ Only use this while your program is not running.<br>
|
|
223
|
+ A box will pop up at the bottom of the window if there are any errors.
|
|
224
|
+Errors will also be highlighted in red.<br>
|
|
225
|
+ You can single-click on an error in the box to go to that line.<br>
|
|
226
|
+ </td>
|
|
227
|
+ </tr>
|
|
228
|
+ <tr>
|
|
229
|
+ <td valign="top">Run!<br>
|
|
230
|
+ </td>
|
|
231
|
+ <td valign="top">Run<br>
|
|
232
|
+ </td>
|
|
233
|
+ <td valign="top">Start your script going. This starts the actual
|
|
234
|
+emulation process. <br>
|
|
235
|
+ Basically it will just loop through your script about 40 times per second.<br>
|
|
236
|
+ If there are any errors they will be highlighted and included in the error
|
|
237
|
+ box, but the script will still run and just ignore those lines.<br>
|
|
238
|
+ The script will keep running until you chose "Stop" from the "Run!" menu,
|
|
239
|
+ or try to close the PIE window.<br>
|
|
240
|
+ While running, your script may move the cursor around or press keys which
|
|
241
|
+ may do bad things to the PIE window if it is in the foreground.<br>
|
|
242
|
+ I recommend starting notepad and placing it in the foreground while you
|
|
243
|
+ are running a script that presses keys.<br>
|
|
244
|
+ </td>
|
|
245
|
+ </tr>
|
|
246
|
+ <tr>
|
|
247
|
+ <td valign="top">Run!<br>
|
|
248
|
+ </td>
|
|
249
|
+ <td valign="top">Stop<br>
|
|
250
|
+ </td>
|
|
251
|
+ <td valign="top">Stops your script running. You should do this before
|
|
252
|
+ you check for errors or run your program again. <br>
|
|
253
|
+ You don't need to do this before closing the window, that will stop it
|
|
254
|
+automatically.<br>
|
|
255
|
+ </td>
|
|
256
|
+ </tr>
|
|
257
|
+ <tr>
|
|
258
|
+ <td valign="top">Settings<br>
|
|
259
|
+ </td>
|
|
260
|
+ <td valign="top"><br>
|
|
261
|
+ </td>
|
|
262
|
+ <td valign="top">Turns the P5 gloves' mouse mode off, or brings
|
|
263
|
+up Control Panel applets for the various input devices PIE uses.<br>
|
|
264
|
+ </td>
|
|
265
|
+ </tr>
|
|
266
|
+ <tr>
|
|
267
|
+ <td valign="top">Settings<br>
|
|
268
|
+ </td>
|
|
269
|
+ <td valign="top">Turn P5 Mouse Mode Off<br>
|
|
270
|
+ </td>
|
|
271
|
+ <td valign="top">If you have any P5 virtual reality gloves connected,
|
|
272
|
+ this will switch off mouse mode for all of them. <br>
|
|
273
|
+ Don't do this while your script is running or the P5 will no longer work
|
|
274
|
+ with it.<br>
|
|
275
|
+ </td>
|
|
276
|
+ </tr>
|
|
277
|
+ <tr>
|
|
278
|
+ <td valign="top">Settings<br>
|
|
279
|
+ </td>
|
|
280
|
+ <td valign="top">Control Panel<br>
|
|
281
|
+ </td>
|
|
282
|
+ <td valign="top">Starts control panel<br>
|
|
283
|
+ </td>
|
|
284
|
+ </tr>
|
|
285
|
+ <tr>
|
|
286
|
+ <td valign="top">Settings<br>
|
|
287
|
+ </td>
|
|
288
|
+ <td valign="top">P5<br>
|
|
289
|
+ </td>
|
|
290
|
+ <td valign="top">This will bring up the P5 control panel (for your
|
|
291
|
+ virtual reality glove) if it is installed.<br>
|
|
292
|
+ You can calibrate or test your bend sensors, change the mouse mode settings,
|
|
293
|
+ or test the buttons.<br>
|
|
294
|
+ This is the original Essential Reality version that only supports a single
|
|
295
|
+ glove. If you want to calibrate or change the settings for multiple gloves,
|
|
296
|
+ you should download the Dual Mode Driver and use its VBControlPanel instead.<br>
|
|
297
|
+ </td>
|
|
298
|
+ </tr>
|
|
299
|
+ <tr>
|
|
300
|
+ <td valign="top">Settings<br>
|
|
301
|
+ </td>
|
|
302
|
+ <td valign="top">PPJoy<br>
|
|
303
|
+ </td>
|
|
304
|
+ <td valign="top">Brings up the PPJoy control panel, if PPJoy is
|
|
305
|
+installed. This allows you to add virtual joysticks or set the number of
|
|
306
|
+buttons, axes and hats the virtual joystick has. You can also chose which
|
|
307
|
+axes or hats correspond to analog0 to analog15, and what buttons or hats
|
|
308
|
+correspond to digital0 to digital31.<br>
|
|
309
|
+ </td>
|
|
310
|
+ </tr>
|
|
311
|
+ <tr>
|
|
312
|
+ <td valign="top">Settings<br>
|
|
313
|
+ </td>
|
|
314
|
+ <td valign="top">Joystick<br>
|
|
315
|
+ </td>
|
|
316
|
+ <td valign="top">Brings up the Game Controllers or Joystick control
|
|
317
|
+ panel. It allows you to test your virtual joystick. I don't recommend calibrating
|
|
318
|
+ virtual joysticks.<br>
|
|
319
|
+ </td>
|
|
320
|
+ </tr>
|
|
321
|
+ <tr>
|
|
322
|
+ <td valign="top">Settings<br>
|
|
323
|
+ </td>
|
|
324
|
+ <td valign="top">Mouse<br>
|
|
325
|
+ </td>
|
|
326
|
+ <td valign="top">Brings up the mouse control panel.<br>
|
|
327
|
+ </td>
|
|
328
|
+ </tr>
|
|
329
|
+ <tr>
|
|
330
|
+ <td valign="top">Settings<br>
|
|
331
|
+ </td>
|
|
332
|
+ <td valign="top">Keyboard<br>
|
|
333
|
+ </td>
|
|
334
|
+ <td valign="top">Brings up the keyboard control panel.<br>
|
|
335
|
+ </td>
|
|
336
|
+ </tr>
|
|
337
|
+ <tr>
|
|
338
|
+ <td valign="top">Settings<br>
|
|
339
|
+ </td>
|
|
340
|
+ <td valign="top">MIDI<br>
|
|
341
|
+ </td>
|
|
342
|
+ <td valign="top">Brings up the closest thing to a MIDI control panel.
|
|
343
|
+ This should allow you to chose which MIDI device you want to use as the default
|
|
344
|
+ output.<br>
|
|
345
|
+ </td>
|
|
346
|
+ </tr>
|
|
347
|
+ <tr>
|
|
348
|
+ <td valign="top">Settings<br>
|
|
349
|
+ </td>
|
|
350
|
+ <td valign="top">Speech<br>
|
|
351
|
+ </td>
|
|
352
|
+ <td valign="top">Tries to bring up the Speech control panel to change
|
|
353
|
+ the default text to speech voice. This may not work if the SAPI is not installed
|
|
354
|
+ in the default directory.<br>
|
|
355
|
+ </td>
|
|
356
|
+ </tr>
|
|
357
|
+ <tr>
|
|
358
|
+ <td valign="top">TroubleShooter<br>
|
|
359
|
+ </td>
|
|
360
|
+ <td valign="top"><br>
|
|
361
|
+ </td>
|
|
362
|
+ <td valign="top">This menu allows you to disable features that you
|
|
363
|
+ don't think are working or are giving you errors. The settings are not saved
|
|
364
|
+ between sessions. <br>
|
|
365
|
+ It was designed for an error some people got with the joystick, but those
|
|
366
|
+ error messages no longer appear so it is unnecessary.<br>
|
|
367
|
+ </td>
|
|
368
|
+ </tr>
|
|
369
|
+ <tr>
|
|
370
|
+ <td valign="top">Help<br>
|
|
371
|
+ </td>
|
|
372
|
+ <td valign="top"><br>
|
|
373
|
+ </td>
|
|
374
|
+ <td valign="top">Get help on PIE.<br>
|
|
375
|
+ </td>
|
|
376
|
+ </tr>
|
|
377
|
+
|
|
378
|
+ </tbody>
|
|
379
|
+</table>
|
|
380
|
+ <br>
|
|
381
|
+ <br>
|
|
382
|
+
|
|
383
|
+<h2>Scripting Tutorial:</h2>
|
|
384
|
+
|
|
385
|
+<h3>Tutorial 1 - easy stuff</h3>
|
|
386
|
+ Lets make a pie script to simulate pressing the W, A, S and D keys when
|
|
387
|
+ you press the arrow keys.<br>
|
|
388
|
+ This will not work on Windows 98.<br>
|
|
389
|
+ <br>
|
|
390
|
+ Start up PIE.<br>
|
|
391
|
+ Choose the "File" Menu, then click "New". This will clear whatever was
|
|
392
|
+in the big white box so you can type your own script.<br>
|
|
393
|
+ We want the W key to be controlled by the up key so type this on one line
|
|
394
|
+ then press Enter:<br>
|
|
395
|
+ <br>
|
|
396
|
+ W = Up<br>
|
|
397
|
+ <br>
|
|
398
|
+ This is a working PIE Script so you can test it by choosing the "Run!"
|
|
399
|
+menu and clicking "Run". <br>
|
|
400
|
+ <br>
|
|
401
|
+ Whenever you press the up arrow key (on the cursor pad, not the numeric
|
|
402
|
+ keypad) it will type a "w". Try it out! This will work in any program.<br>
|
|
403
|
+ Note that it will still move the cursor up. The Up arrow key still has
|
|
404
|
+its original function, but it emulates a w at the same time. Try holding
|
|
405
|
+down shift and pressing Up. It will type a capital W, unless capslock is
|
|
406
|
+on. Unlike the real "W" key, holding down the Up arrow will only type a single
|
|
407
|
+"w".<br>
|
|
408
|
+ <br>
|
|
409
|
+ Now chose the "Run!" menu and click "Stop". This will return our keyboard
|
|
410
|
+ to normal.<br>
|
|
411
|
+ <br>
|
|
412
|
+ Now do the other keys like this:<br>
|
|
413
|
+ <br>
|
|
414
|
+ A = Left<br>
|
|
415
|
+ S = Down<br>
|
|
416
|
+ D = Right<br>
|
|
417
|
+ <br>
|
|
418
|
+ (Don't worry if the S is orange, that is because S is also an abbreviation
|
|
419
|
+ for seconds).<br>
|
|
420
|
+ <br>
|
|
421
|
+ Save your script as Tutorial1.PIE by chosing the "File" menu then "Save
|
|
422
|
+ As...".<br>
|
|
423
|
+ And run it again. Stop it when you have finished playing.<br>
|
|
424
|
+ <br>
|
|
425
|
+ You can change it to use any keys you want. You can even use keys that
|
|
426
|
+don't exist on your keyboard, like the MediaPlay key which is on some multimedia
|
|
427
|
+ keyboards. If you don't know what a key is called, just guess. It is not
|
|
428
|
+fussy about the key names. You could have written this and it would still
|
|
429
|
+work:<br>
|
|
430
|
+ <br>
|
|
431
|
+ W = UpArrow<br>
|
|
432
|
+ A = CursorLeft<br>
|
|
433
|
+ <br>
|
|
434
|
+ If you want to make it clear that it is a key on the keyboard, you can
|
|
435
|
+type this:<br>
|
|
436
|
+ <br>
|
|
437
|
+ key.W = key.Up<br>
|
|
438
|
+ <br>
|
|
439
|
+ (When you type the dot it will pop up with a list of keys. If you can't
|
|
440
|
+ get out of this, click somewhere in the PIE window. Then press Control +
|
|
441
|
+Space and the list will pop up again, but this time it should work. If not,
|
|
442
|
+choose the "Troubleshooter" menu and click "Disable Code Completion")<br>
|
|
443
|
+ <br>
|
|
444
|
+ or this:<br>
|
|
445
|
+ <br>
|
|
446
|
+ keyboard.W = keyboard.Up<br>
|
|
447
|
+ <br>
|
|
448
|
+ or even this:<br>
|
|
449
|
+ <br>
|
|
450
|
+ keyboard's W = UpArrow of Keyboard<br>
|
|
451
|
+ <br>
|
|
452
|
+ <br>
|
|
453
|
+
|
|
454
|
+<h3>Tutorial 2 - emulating a joystick</h3>
|
|
455
|
+ This time we will control a virtual joystick using the keyboard.<br>
|
|
456
|
+ This will only work if you have downloaded and installed PPJoy.<br>
|
|
457
|
+ <br>
|
|
458
|
+ This is not really much harder to do in PIE than the keyboard, but we
|
|
459
|
+have know how to use PPJoy and the joystick control panel first. So please
|
|
460
|
+be patient.<br>
|
|
461
|
+ <br>
|
|
462
|
+ Start PIE.<br>
|
|
463
|
+ Click File/New.<br>
|
|
464
|
+ <br>
|
|
465
|
+ But before we write our script, we need to make sure PPJoy is set up correctly.<br>
|
|
466
|
+ Chose the "Settings" menu and click "PPJoy".<br>
|
|
467
|
+ If PPJoy is installed it should pop up with a window titled "PPJoy
|
|
468
|
+ Joystick and Gamepad Configuration Utility".<br>
|
|
469
|
+ There is a big white list box in the middle of the window with the heading
|
|
470
|
+ "Configured joysticks". One of the items in the list needs to be "Virtual
|
|
471
|
+ Joystick 1".<br>
|
|
472
|
+ <br>
|
|
473
|
+ If Virtual Joystick 1 is not there, or the box is empty then you need
|
|
474
|
+to do the following:<br>
|
|
475
|
+
|
|
476
|
+<ul>
|
|
477
|
+ <li>click the "Add..." button.</li>
|
|
478
|
+ <li>Where it says "Parallel port" choose "Virtual port"</li>
|
|
479
|
+ <li>Where it says "Controller number" choose "Controller 1"</li>
|
|
480
|
+ <li>Click the "Add" button</li>
|
|
481
|
+ <li>Now wait and go through the hardware setup dialog boxes that pop
|
|
482
|
+up</li>
|
|
483
|
+ <li>Choose the default options in any dialog boxes</li>
|
|
484
|
+ <li>Be patient, it needs to find and install several drivers</li>
|
|
485
|
+
|
|
486
|
+</ul>
|
|
487
|
+ Regardless of whether it was there before, or you just added it, you should
|
|
488
|
+ have a "Virtual Joystick 1" in the list box. Select it and choose "Mapping".
|
|
489
|
+ It will pop up with the dialog box saying "Welcome to the Joystick/Pad mapping
|
|
490
|
+ wizard". If it doesn't work then you probably weren't patient enough in the
|
|
491
|
+ previous step. Choose "Set a custom mapping for this controller" (which should
|
|
492
|
+ already be selected) and click "Next >". Now you can choose how
|
|
493
|
+many axes, buttons and hats the virtual joystick should have, and which axes
|
|
494
|
+they are. Leave the default settings and click "Next >". Now you can choose
|
|
495
|
+ which analog inputs control which axes. You will notice that analog0 controls
|
|
496
|
+ the x axis (horizontal), and analog1 controls the y axis (vertical). These
|
|
497
|
+ are good defaults so click "Next >". Now you can choose which digital
|
|
498
|
+inputs should control which buttons. Notice digital 0 controls joystick button
|
|
499
|
+1, and digital 1 controls joystick button 2. These are also good defaults
|
|
500
|
+so choose next. Now you can choose which analog or digital inputs control
|
|
501
|
+the imaginary hats on the top of the joystick. One will be controlled by
|
|
502
|
+digitals 16-19 and the other will be controlled by analog 8. These are good
|
|
503
|
+defaults too, so click Next and then Finish.<br>
|
|
504
|
+ <br>
|
|
505
|
+ Click "Done" in the PPJoy control panel and go back to PIE.<br>
|
|
506
|
+ <br>
|
|
507
|
+ We can test the virtual joystick we just made by choosing the "Settings"
|
|
508
|
+ menu and chosing "Joystick". This will open up the joystick control panel.
|
|
509
|
+ Choose PPJoy Virtual Joystick 1 and click "Properties". Now it will pop up
|
|
510
|
+ with another dialog box, choose the "Test" tab. This displays all the axes
|
|
511
|
+ and buttons on the virtual joystick. They should all be in the middle.<br>
|
|
512
|
+ <br>
|
|
513
|
+ Now lets make a PIE script to control the virtual joystick. Assuming your
|
|
514
|
+ screen resolution is 1024 by 768, Type the following:<br>
|
|
515
|
+ <br>
|
|
516
|
+ ppjoy.analog0 = (mouse.cursorposx - 512) / 512<br>
|
|
517
|
+ <br>
|
|
518
|
+ Remember how analog 0 was the x axis in the mapping before? Well it was.
|
|
519
|
+ <br>
|
|
520
|
+ <br>
|
|
521
|
+ The above line sets the analog 0 value for virtual joystick 1 to a number
|
|
522
|
+ between -1 and 1 depending on the location of the mouse cursor on the screen.<br>
|
|
523
|
+ <br>
|
|
524
|
+ Now run your script by choosing Run/Run on the menu. Go back to the Joystick
|
|
525
|
+ control panel's test tab and see how the horizontal position of the cross
|
|
526
|
+ in the box is controlled by the mouse.<br>
|
|
527
|
+ <br>
|
|
528
|
+ Now let's do the same for the y axis (384 is half the screen height):<br>
|
|
529
|
+ <br>
|
|
530
|
+ ppjoy.analog1 = (mouse.cursorposy - 384) / 384<br>
|
|
531
|
+ <br>
|
|
532
|
+ This works because PIE uses joystick values between -1 and 1. The cursor
|
|
533
|
+ position is in pixels from 0 to 767. Subtracting 384 gives a value between
|
|
534
|
+ -384 and 383. Dividing by 384 gives a value between -1 and (almost) 1.<br>
|
|
535
|
+ <br>
|
|
536
|
+ There is an easier way to do the exact same above calculations in PIE:<br>
|
|
537
|
+ <br>
|
|
538
|
+ ppjoy.analog0 = MapRange(mouse.cursorposx, 0,1023, -1,1)<br>
|
|
539
|
+ ppjoy.analog1 = MapRange(mouse.cursorposy, 0,767, -1,1)<br>
|
|
540
|
+ <br>
|
|
541
|
+ Now let's do the buttons:<br>
|
|
542
|
+ <br>
|
|
543
|
+ ppjoy.digital0 = mouse.LeftButton<br>
|
|
544
|
+ ppjoy.digital1 = mouse.RightButton<br>
|
|
545
|
+ ppjoy.digital2 = mouse.MiddleButton<br>
|
|
546
|
+ ppjoy.digital3 = mouse.XButton1<br>
|
|
547
|
+ ppjoy.digital4 = mouse.XButton2<br>
|
|
548
|
+ <br>
|
|
549
|
+ Now run your script and test it in the joystick control panel or a game.
|
|
550
|
+ You should be able to control the joystick with the mouse.<br>
|
|
551
|
+ <br>
|
|
552
|
+ If you wanted to control virtual joystick 2, you would just change ppjoy
|
|
553
|
+ to ppjoy2.<br>
|
|
554
|
+ eg. ppjoy2.digital0 = mouse.LeftButton<br>
|
|
555
|
+ <br>
|
|
556
|
+ <br>
|
|
557
|
+
|
|
558
|
+</body>
|
|
559
|
+</html>
|