Global

Read time6 min

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

(VARIANT)

set array of (long-)values (0..255,0..255,0..255), size needs to match the previously set width and height

Dim myDMDdata

myDMDdata = Array(CLng(0), CLng(&hFFFFFF), CLng(&hFFFFFF), CLng(0)) 'set 4 fully black/white pixels DMDWidth = 2 DMDHeight = 2 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 • volume is in 0..1 • pan ranges from -1.0 (left) over 0.0 (both) to 1.0 (right) • randompitch ranges from 0.0 (no randomization) to 1.0 (vary between half speed to double speed) • pitch can be positive or negative and directly adds onto the standard sample frequency • useexisting is 0 or 1 (if no existing/playing copy of the sound is found, then a new one is created) • restart is 0 or 1 (only useful if useexisting is 1) • front_rear_fade is similar to pan but fades between the front and rear speakers 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. You can use the sound manager's position dialog to experiment with values for these. 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. 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.

PlaySound "FlipperUp",0,0.5,-1.0,1.0,1,1,0.0

• would play the sound not looped (0)

• at volume (0.5) (*)

• only on left speaker (-1.0)

• with varying pitch (1.0)

• it would reuse the same channel if it is already playing (1)

• restarts the sample (1)

• 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)





doc powered bycompany wiki & knowledge base