• We have added Language Translations for French, Italian and Spanish menus, you can change your language at the bottom of every page, bottom left in the footer.
  • Spanish (Español, Latin American) translations have been added for the Forums and Resource Manager (Downloads). You can change your Language Here!

Using Keycodes In Your Script

JonPurpleHaze

Site Nudger
Staff member
Here's a list of the keycodes you can use for keypresses in your game. Note that Visual Pinball has a set of predefined keys used for Flipper and tilting. Since the people playing your table prefere their own keys setup. it's recommended that you do not change the main control keys in the script.
To change the control keys, which affect all the tables using the standard Visual Pinball code, go to the editor view. At the top menu bar, click preferences, and select the keys menu. This is the standard code generated by creating a new table in the Visual Pinball editor:
Code

Sub Table1_KeyDown(ByVal keycode)

if keycode = PlungerKey Then
Plunger.PullBack
Bullet6 end if

if keycode = LeftFlipperKey Then
LeftFlipper.RotateToEnd
PlaySound "FlipperUp"
Bullet6 end if

if keycode = RightFlipperKey Then
RightFlipper.RotateToEnd

PlaySound "FlipperUp"
Bullet6 end if

if keycode = LeftTiltKey Then
Nudge 90, 2
Bullet6 end if

if keycode = RightTiltKey Then
Nudge 270, 2
Bullet6 end if

if keycode = CenterTiltKey Then
Nudge 0, 2
Bullet6 end if

Bullet6 end Sub

Sub Table1_KeyUp(ByVal keycode)

if keycode = PlungerKey Then
Plunger.Fire
Bullet6 end if

if keycode = LeftFlipperKey Then
LeftFlipper.RotateToStart
PlaySound "FlipperDown"
Bullet6 end if

if keycode = RightFlipperKey Then
RightFlipper.RotateToStart

PlaySound "FlipperDown"
Bullet6 end if

Bullet6 end Sub

The Table1_KeyDown subroutine is what happens when you press a key down, and the Table1_KeyUp is what happens when you let go of the key. The default keys used by Visual Pinball are the shift buttons for the flippers, the enter key for the plunger, the /, A, and space bar keys for nudging, and the 1 and 5 keys for credits and starting a game. Keycodes The following are a list of the keys and their numeric value... 0 = 11 1 = 2 2 = 3 3 = 4 4 = 5 5 = 6 6 = 7 7 = 8 8 = 9 9 = 10 A = 30 ADD = 78 APOSTROPHE = 40 AT = 145 AX = 150 B = 48 BACK = 14 BACKSLASH = 43 BACKSPACE = 14 C = 46 CALCULATOR = 161 CAPSLOCK = 58 COLON = 146 COMMA = 51 D = 32 DECIMAL = 83 DELETE = 211 DIVIDE = 181 DOWN = 208 DOWNARROW = 208 E = 18 END = 207 EQUALS = 13 ESCAPE = 1 F = 33 F1 = 59 F2 = 60 F3 = 61 F4 = 62 F5 = 63 F6 = 64 F7 = 65 F8 = 66 F9 = 67 F10 = 68 F11 = 87 F12 = 88 F13 = 100 F14 = 101 F15 = 102 G = 34 H = 35 HOME = 199 I = 23 INSERT = 210 J = 36 K = 37 L = 38 LALT = 56 LBRACKET = 26 LCONTROL = 29 LEFTARROW = 203 LSHIFT = 42 LWIN = 219 M = 50 MINUS = 12 MULTIPLY = 55 N = 49 NUMLOCK = 69 NUMPAD0 = 82 NUMPAD1 = 79 NUMPAD2 = 80 NUMPAD3 = 81 NUMPAD4 = 75 NUMPAD5 = 76 NUMPAD6 = 77 NUMPAD7 = 71 NUMPAD8 = 72 NUMPAD9 = 73 NUMPADCOMMA = 179 NUMPADENTER = 156 NUMPADEQUALS = 141 NUMPADMINUS = 74 NUMPADPERIOD = 83 NUMPADPLUS = 78 NUMPADSLASH = 181 NUMPADSTAR = 55 O = 24 P = 25 PAUSE = 197 PERIOD = 52 PGDN = 209 PGUP = 201 Q = 16 R = 19 RALT = 184 RBRACKET = 27 RCONTROL = 157 RETURN = 28 RIGHT = 205 RIGHTARROW = 205 RMENU = 184 RSHIFT = 54 RWIN = 220 S = 31 SCROLL = 70 SEMICOLON = 39 SLASH = 53 SPACE = 57 STOP = 149 T = 20 TAB = 15 U = 22 UNDERLINE = 147 UPARROW = 200 V = 47 W = 17 X = 45 Y = 21 Z = 44

Updated Jun 22, 2005 Written by shiva 3185 reads
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    Top