---
title: Global
slug: global
description: Explore the extensive variables and methods offered in VPX with this comprehensive document. Discover game time, system time, custom parameters, key mappings, window configuration, DMD settings, and much more. Dive into nudge calibration, sensor readings,
docTags: 
createdAt: 2019-11-28T18:50:02.000Z
---

## Variables

*Variables are items in vpx you can set, adjust or call.*

| Call                            | Detail                                                                                                                                     | Example                                                                                                                                                                                         |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| GameTime(int)                   | gets the current internal game time in milliseconds                                                                                        |                                                                                                                                                                                                 |
| SystemTime(int)                 | gets the current system time in milliseconds                                                                                               |                                                                                                                                                                                                 |
| GetCustomParam(int)             | GetCustomParam(1) to get "param1" and GetCustomParam(2) to get "param2" from the command line "VPinballX.exe -c1 param1 -c2 param2"        |                                                                                                                                                                                                 |
| NightDay(int)                   | 0..100 value set in the UI (by the user) that defines if its night or day, so that the script can tweak table elements based on that value |                                                                                                                                                                                                 |
| LeftFlipperKey                  |                                                                                                                                            |                                                                                                                                                                                                 |
| RightFlipperKey                 |                                                                                                                                            |                                                                                                                                                                                                 |
| LeftTiltKey                     |                                                                                                                                            |                                                                                                                                                                                                 |
| RightTiltKey                    |                                                                                                                                            |                                                                                                                                                                                                 |
| CenterTiltKey                   |                                                                                                                                            |                                                                                                                                                                                                 |
| PlungerKey                      |                                                                                                                                            |                                                                                                                                                                                                 |
| StartGameKey                    |                                                                                                                                            |                                                                                                                                                                                                 |
| AddCreditKey                    |                                                                                                                                            |                                                                                                                                                                                                 |
| AddCreditKey2                   |                                                                                                                                            |                                                                                                                                                                                                 |
| LeftMagnaSave                   |                                                                                                                                            |                                                                                                                                                                                                 |
| RightMagnaSave                  |                                                                                                                                            |                                                                                                                                                                                                 |
| LockbarKey                      |                                                                                                                                            |                                                                                                                                                                                                 |
| ShowDT(bool)                    | Desktop mode enabled (true) or Rotated Fullscreen mode enabled (false)                                                                     |                                                                                                                                                                                                 |
| ShowFSS(bool)                   | Extended Backglass mode enabled (true) or not (false)                                                                                      |                                                                                                                                                                                                 |
| WindowWidth(int)                | get width of rendering window/fullscreen                                                                                                   |                                                                                                                                                                                                 |
| WindowHeight(int)               | get height of rendering window/fullscreen                                                                                                  |                                                                                                                                                                                                 |
| DMDWidth(int)                   | set width of DMD                                                                                                                           |                                                                                                                                                                                                 |
| DMDHeight(int)                  | set height of DMD                                                                                                                          |                                                                                                                                                                                                 |
| DMDPixels(VARIANT)              | set array of (byte-)values (0..100), size needs to match the previously set width and height                                               |                                                                                                                                                                                                 |
| DMDColoredPixels<br />(VARIANT) | set array of (long-)values (0..255,0..255,0..255), size needs to match the previously set width and height                                 | Dim myDMDdata<br />myDMDdata = Array(CLng(0), CLng(\&hFFFFFF), CLng(\&hFFFFFF), CLng(0)) 'set 4 fully black/white pixels<br />DMDWidth = 2<br />DMDHeight = 2<br />DMDColoredPixels = myDMDdata |

## Methods

*Methods are procedures or actions that you can fire in VPX.*

| Call                                                                                                                                             | Detail                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Example                                                                                                                                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Nudge(float Angle, float Force)                                                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                                                        |
| NudgeGetCalibration NudgeSetCalibration(int XMax, int YMax, int XGain, int YGain, int DeadZone, int TiltSensitivty)                              | Get/set calibration settings                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | See "Nudge test and calibration" table included with VPX.                                                                                                                                                                                                                                                                                              |
| NudgeSensorStatus(VARIANT \*XNudge, VARIANT \*YNudge)                                                                                            | Read nudge sensor status X/Y values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | See "Nudge test and calibration" table included with VPX.                                                                                                                                                                                                                                                                                              |
| NudgeTiltStatus(VARIANT \*XPlumb, VARIANT \*YPlumb, VARIANT \*TiltPercent)                                                                       | Read digital plumb X/Y values and the configured tilt sensitivity.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | See "Nudge test and calibration" table included with VPX.                                                                                                                                                                                                                                                                                              |
| PlaySound(string, int loopcount, float volume, float pan, float randompitch, int pitch, bool useexisting, bool restart, float front\_rear\_fade) | • loopcount chooses the amount of loops<br />• volume is in 0..1<br />• pan ranges from -1.0 (left) over 0.0 (both) to 1.0 (right)<br />• randompitch ranges from 0.0 (no randomization) to 1.0 (vary between half speed to double speed)<br />• pitch can be positive or negative and directly adds onto the standard sample frequency<br />• useexisting is 0 or 1 (if no existing/playing copy of the sound is found, then a new one is created)<br />• restart is 0 or 1 (only useful if useexisting is 1)<br />• front\_rear\_fade is similar to pan but fades between the front and rear speakers<br /><br />Volume, pan, and front\_rear\_fade are logarithmic scale, so they may not behave as you would think.  Pan of 0.1, for example, is pretty far to the right.<br /><br />You can use the sound manager's position dialog to experiment with values for these.<br /><br />Note that values in the sound manger's position dialog are ADDED to the values in the script.  So if sound manager has volume of -0.2, but the script specifies 0.5 you get a total volume of 0.3.<br /><br />If useexisitng is 1 and restart is 0, the currently playing sound will continue to play, but is  adjusted according to the other parameters.   This allows us to increase/decrease the frequency of an already playing sample, or adjust the panning, as we do for ball rolling sounds.    Other examples where this might be useful is adjusting the speed of a motor sample.<br /> | PlaySound "FlipperUp",0,0.5,-1.0,1.0,1,1,0.0 <br /> • would play the sound not looped (0)<br /> • at volume (0.5) (\*)<br /> • only on left speaker (-1.0)<br /> • with varying pitch (1.0)<br /> • it would reuse the same channel if it is already playing (1)<br /> • restarts the sample (1)<br /> • and plays it on the front speakers only (0.0) |
|                                                                                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                                                        |
|                                                                                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                                                        |
| StopSound(string)                                                                                                                                | Stops the specified sample                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                                                                                                                                                                                                                                                        |
| PlayMusic(string, float volume)                                                                                                                  | volume 0..1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |                                                                                                                                                                                                                                                                                                                                                        |
| MusicVolume(float volume)                                                                                                                        | volume 0..1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |                                                                                                                                                                                                                                                                                                                                                        |
| EndMusic()                                                                                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                                                        |
| FireKnocker(int Count)                                                                                                                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                                                        |
| QuitPlayer(int CloseType)                                                                                                                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                                                        |
| Version                                                                                                                                          | returns VP\_VERSION\_MAJOR \* 1000 + VP\_VERSION\_MINOR \* 100 + VP\_VERSION\_REVISION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                                                                                                                                                                                                                                                                                                                                        |
| VPBuildVersion                                                                                                                                   | same, deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                                                                                        |
| VersionMajor                                                                                                                                     | major VP version number                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                                                                                                                                                                                                                                                                        |
| VersionMinor                                                                                                                                     | minor VP version number                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                                                                                                                                                                                                                                                                        |
| VersionRevision                                                                                                                                  | VP version revision                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                                                                                                                        |
| GetBalls(Ball)                                                                                                                                   | returns all Balls on the table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                                                                                                                                                                                                                                                                                                                                        |
| GetElements(Editable)                                                                                                                            | returns all Elements on the table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |                                                                                                                                                                                                                                                                                                                                                        |
| GetElementByName(string)                                                                                                                         | returns a certain Element, based on the name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |                                                                                                                                                                                                                                                                                                                                                        |
| MaterialColor(string,OLE\_COLOR)                                                                                                                 | change base color of a material                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                                                        |
| LoadValue(string,string,VARIANT)                                                                                                                 | load a value for tablename,valuename,value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                                                                                                                                                                                                                                                        |
| SaveValue(string,string,VARIANT)                                                                                                                 | save a value for tablename,valuename,value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                                                                                                                                                                                                                                                        |
| UserDirectory(string)                                                                                                                            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                                                        |


