Skip to content

Table of Contents - VB Script Developer Guide
- Has someone already fixed this? - Further Documentation - Basics
- How to find error messages - Line 1 Error Message - Variables declared after usage - WScript related errors

- Pup Pack Developer Guide - Overview - Missing features and bugs
- General
- Missing functions
- No transparent background
- Multiple sounds playing
- Triggers on screens which are off
- Conflict vbscript/screens file
- Triggers skip same priority
- Label font scaled wrong
- Label animations
- Screen z-order

Jump to the bottom




bg

VB Script Developer Guide

bg2

Has someone already fixed this?

Before trying to fix anything, its worth double checking if this script has already been fixed.

We are not the only community using VPXS, and others also document and fix VBS scripts.

The biggest being the JSM repository: jsm174/vpx-standalone-scripts

Check there first!




bg2

Further Documentation

Further to JSMs fantastic repository, there are also further documentation available directly on the vpx standalone repository:




bg2

Basics

VBS (Visual Basic Script) is used to program our VPXS pinball tables.

There are however many issues that pop up when trying to run tables specifically on VPX Standalone that are not present when running on VPX.

That means you often have to correct common 'mistakes' to get tables running on VPXS.




bg2

How to find error messages

Unfortunately we never really get accurate or useful error message.

But we do get the line that errored, which is pretty useful.

After a table has crashed, check the vpinball.log for the error messages.




bg2

Line 1 Error Message

If you see an error message on 'Line 1' in your vpinball.log file, that does not mean that the error was actually on line 1.

What that means is that the error was in an 'Executed' section of code.

This could be either: - Execute '{code here}'

and / or

- GlobalExecute '{code here}'




bg2

Variables declared after usage

Probably the single most common issue is variables being declared after they are used.

VBS when ran in VPX does not care where the variables are declared, so you can have them declared at the bottom of the script if you want.

VPXS however is more picky, you need to declare the variables before you use them. So its a good idea to have all, or most, variable declarations at the top of the VBS script.

For more information: master/standalone/docs/vbscript.md - declaration-and-definition-issues




bg2

WScript.Shell or WshShell are Windows-only functions that allow writing to the filesystem, reading the Windows Registry, and so on. These features will never be implemented in VPXS and must be commented out of Table VBS files.

In the specific case of Taito do Brasil tables, there is a function in all of the VBS for those tables that gets around an issue involving NVRAM persistence. In plain English, if you quit out of a Taito do Brasil table mid-game, the state of the game persists when you reload the table. The functions unfortunately are tied to resetting the table lamps at the end of game, causing each additional game to not function properly.

To correct this, look for the following lines in these tables:

Under Sub table1_Init delete or comment out(put a straight single quote at the beginning of a line '):
NVramPatchLoad
and
Sub table1_exit:NVramPatchExit:Controller.stop:End Sub

Replace the Sub table1_exit line with:

Sub table1_exit:Controller.stop:End Sub

Under Sub LampTimer_Timer() delete or comment out:
NVramPatchKeyCheck

Comment or remove this entire block:

' =============================================================================================================
'                 NVram patch for Taito do Brasil tables by Pmax65
'
' NVramPatchExit    ' Must be placed before the Controler.Stop statement into the Table1_Exit Sub
' NVramPatchLoad    ' Must be placed before the VPinMAME controller initialization
' NVramPatchKeyCheck' Must be placed in the lamptimer timer
' =============================================================================================================

Const GameOverLampID = 149 ' set this constant to the ID number of the game-over lamp

Dim NVramPatchCoinCnt

Function GetNVramPath()
    Dim WshShell
    Set WshShell = CreateObject("WScript.Shell")
    GetNVramPath = WshShell.RegRead("HKCU\Software\Freeware\Visual PinMame\globals\nvram_directory")
End function

Function FileExists(FileName)
    DIM FSO
    FileExists = False
    Set FSO = CreateObject("Scripting.FileSystemObject")
    FileExists = FSO.FileExists(FileName)
    Set FSO = Nothing
End Function

Sub Kill(FileName)
    Dim ObjFile, FSO
    On Error Resume Next
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set ObjFile = FSO.GetFile(FileName)
    ObjFile.Delete
    On Error Goto 0
    Set FSO = Nothing
End Sub

Sub Copy(SourceFileName, DestFileName)
    Dim FSO
    On Error Resume Next
    Set FSO = CreateObject("Scripting.FileSystemObject")
    FSO.CopyFile SourceFileName, DestFileName, True
    On Error Goto 0
    Set FSO = Nothing
End Sub

Sub NVramPatchLoad
    NVramPatchCoinCnt = 0
    If FileExists(GetNVramPath + "\" + cGameName + ".nvb")Then
        Copy GetNVramPath + "\" + cGameName + ".nvb", GetNVramPath + "\" + cGameName + ".nv"
    Else
        Copy GetNVramPath + "\" + cGameName + ".nv", GetNVramPath + "\" + cGameName + ".nvb"
    End If
End Sub

Sub NVramPatchExit
    If LampState(GameOverLampID)Then
        Kill GetNVramPath + "\" + cGameName + ".nvb"
        Do
            LampTimer_Timer          ' This loop is needed to avoid the NVram reset (losing the hi-score and credits)
        Loop Until LampState(20) = 1 ' when the game is over but the match procedure isn't still ended
    End If
End Sub

' =============================================================================================================
' To completely erase the NVram file keep the Start Game button pushed while inserting
' two coins into the first coin slit (this resets the high scores too)
' =============================================================================================================

Sub NVramPatchKeyCheck
    If Controller.Switch(swStartButton)then
        If Controller.Switch(swCoin1)then
            If NVramPatchCoinCnt = 2 Then
                Controller.Stop
                Kill GetNVramPath + "\" + cGameName + ".nv"
                Kill GetNVramPath + "\" + cGameName + ".nvb"
                QuitPlayer 2
            Else
                NVramPatchCoinCnt = 1
            End If
        Else
            If NVramPatchCoinCnt = 1 Then
                NVramPatchCoinCnt = 2
            End If
        End If
    Else
        NVramPatchCoinCnt = 0
    End If
End Sub

Replace it with(paying attention to the GameOverLampID value at the top of the above code block):

Const GameOverLampID = 149 ' set this constant to the ID number of the game-over lamp

Sub LampReset
    If LampState(GameOverLampID)Then
        Do
            LampTimer_Timer          ' This loop is needed to avoid the NVram reset (losing the hi-score and credits)
        Loop Until LampState(20) = 1 ' when the game is over but the match procedure isn't still ended
    End If
End Sub










bg

Pup Pack Developer Guide

bg2

Overview

Below current as of: 10/08/26

Pup packs currently run much better then they historically have done in this project thanks to Wraiths bundle work.
Many Pups run that couldn't before.

But each pup is still trial and error to get right. Often times the screens, triggers, sounds, etc. are off or need tweaked.


The basic steps are:

  • Download the puppack to your PC

  • If the pup pack has a present Pup Pack Options folder, pick the option you want. (For ex: 2 or3 screens, PUP on BG, or DMD). Drag the screens.pup, triggers.pup, and playlists.pup files from the Pup Pack Options folder into the table's pup pack folder root. OR you can run the preconfigured .bat file for your option on your PC, if one is available. The .bat files will copy the .pup files over for you

  • In Table manager, add a pupvideos folder to table root Paste the table's pup pack folder into the pupvideos folder. The table's puppack folder name is usually the rom or table name, and it typically downloads with the proper name. If not, consult the .vbs and look for cPuPPack = to see the puppack name

  • If the pup does not initialize at first launch. Try adding these settings to the {vpx-table}.ini:

    [Standalone]
    B2SPlugins = 1
    PUPCapture = 1
    PUPPlugin = 1
    



If the pup still does not initialize after these steps, or show up the way you want. Consult the troubleshooting steps below.

Some pups rely upon .vbs switches, or .directb2s interdependencies. You will need to examine the vpinball.log, .vbs and other configs to troubleshoot.




bg2

Missing features and bugs

This is a very technical deep dive into missing features in the standalone puppack implementation. It assumes you have already deep knowledge of the pinup player system and you have a advanced knowledge of table vbscripts. You can read some documentation (not everything is documented) here: https://nailbuster.com/wikipinup/doku.php?id=pup_dmd

Keep in mind: A simple puppack you can get mostly running, but the for most puppacks it can be a lot of work and time consuming to get it to work. If in the future features are added or bugs are fixed in standalone it can break your working puppacks (because of workarounds) and you have to adapt it again. Also the problem for standalone is that the windows pinup player is not open source so its more difficult to emulate (reverse engineering). Depending on the situation you can make different workarounds, but sometimes it is simply not possible to create an acceptable solution (it is often try and error).

A puppack will impact the framerate, depending on the complexity it can be from 5 fps to around 15 fps.




bg2

General

The system is very flexible and has a lot of options and therefore it is complex. If an option or feature is not implemented a message is logged in the table log file. Look for the text "Not implemented" in the log what is not implemented. This will give you an idea how much functionality you are missing and if it worth your time to get it to work.




bg2

Missing functions

The following functions called from the vbscript on the pindisplay object (CreateObject("PinUpPlayer.PinDisplay")) are not implemented yet. These are used rare, the most used functions are implemented.

  • playlistplay
  • play
  • playpause
  • playresume
  • setAspect
  • setVolume
  • SetLength




bg2

No transparent background

A pup screen always has a black background, but this can also be transparent (can generate performance issues?). This is a big problem when also the B2S is used, you get blinking in stead of two screens laying on top of each other. When you have the following construction in screens there are two problems:

ScreenNum,ScreenDes,PlayList,PlayFile,Loopit,Active,Priority,CustomPos
2,Backglass,,,0,off,,
11,"Backglass 2",bg,"Movie.mp4",0,ForceOn,,"2,19.5,17,60.9,58.5"

The backglass is turned off, but there is an extra screen 11 with custom position on screen 2 with forceon option. At the moment because in standalone the backglass is turned off everything is not displayed. This is incorrect, because of forceon screen 11 should be shown on a transparent backglass. This is a problem for example in Star Tours and in Tom and Jerry table/puppack combination. This can be fixed to replace off with show for screen 2, but then you have a black background.




bg2

Multiple sounds playing

There is a bug in the playstop function. Sometimes, e.g. a background music is playing on a musiconly screen, when this function is called the music is not stopped, but keeps playing and when the loop option is set, this plays forever. This can also be the case when there is a stop trigger. If this is called from the script a workaround can be to disable the loop and force to play a sound with zero volume (fix used in Space Cadet Galaxy Edition).




bg2

Triggers on screens which are off

A trigger on a screen which is turned off, is sometimes still played. For instance there is a topper screen which is turned off (this has to do with the different display layout you find in puppacks), but the media is still started. Solution is to remove the screens which are turned off and remove the triggers for this screen. But remember a screen can be turned on from the script and then it should not be removed, unless it is a screen which should not be used anyway (e.g. topper) but then also the script code has to be removed.




bg2

Conflict vbscript/screens file

Sometimes there is a screens.pup file but the same screens numbers are also created from the script. This gives in standalone a conflict and is handled wrong. The script should overrule the screens.pup. Workaround is to conbine the options from the script in the screens.pup file and remove the script calls.




bg2

Triggers skip same priority

In triggers you have the option SkipSamePrty which means that if the new media has the same or lower priority as the currently playing media then the new one is skipped. This is for when there are multiple triggers to determine which one has to play and is the most important. At the moment the problem is in standalone that this should only be done if there is media playing, but in standalone this is also done if there is no media playing. This means you are missing triggers. A workaround is to remove the option, but then you get to many or the wrong one is playing. A better workaround is to play around with the priorities, but this is a lot of try and error. You also have to play the table a lot to test the triggers. I sometimes change the script to trigger the events quicker/more easy.




bg2

Label font scaled wrong

Sometimes it works, sometimes it does not. When a text is displayed with LabelSet function on a screen, which has a custom position,width and height, sometimes the font size is wrong. A scaling factor has to be applied. I have not found out yet when it works and when not. Workaround is to apply the font scaling factor (have to calculated by hand) in the script for all the LabelInit calls for this screen.




bg2

Label animations

A label can also have animations (e.g. blinking or motion) this is done with a labelset with the option mt:1. This is not supported at the moment (and diffcult to emulate). For example:

PuPlayer.LabelSet 2,"Service","Blinking text", 1,"{'mt':1,'at':1,'fq':150,'len':1}"

These options are discarded but if the text is totally displayed wrong you have to change mt:1 into mt:2 and you probably have to add options (see mt:2 example above) to correct it. Offcourse you are missing the animation.




bg2

Screen z-order

This is important for the order in which the screens lay on top of each other. There are screen options ForceBack (set it to the back), ForceOn (always on top, always visible) and ForcePop (always on top, but only shown if media is played). There are more. Standalone sometimes messes up what should be in front/back. The only workaround is to play with the different options in the screen definitions to try to get it in the correct order.





Back to the top