VPX Documentation

Global

2min
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)