VISUAL PINMAME COM OBJECT PROPERTY/METHOD REFERENCE

Version 1.33

The following is a list of all properties and methods made accessible by VPinMAME's COM interface, with details below.
Summary
Properties Methods
GameNameRunning
PauseDip
HandleMechanicsWPCNumbering
LampSolenoid
SwitchGIString
ChangedLampsChangedSolenoids
ChangedGIDoubleSize
SplashInfoLineShowFrame
BorderSizeXBorderSizeY
WindowPosXWindowPosY
ShowTitleHandleKeyboard
ShowDMDOnlySampleRate
AntialiasLockDisplay
VersionChangedLEDs
Hidden 
RunStop
ShowOptsDialogShowAboutDialog
ShowPathesDialogCheckROMS
SetDisplayPosition

Details
Visual PinMAME Control
Properties
GameName Read/Write
Initializes VPinMAME for game "gameName".
gameName: PinMAME short name (e.g. "tz_94h")
(See gamelist.txt for all gamenames supported in PinMAME!)

Example:
Controller.GameName = "tz_94h"
If Controller.GameName = "tz_94h" Then ...
Running Read Only
Returns True if the emulation is running, False otherwise.

Example:
If Controller.Running Then ...
Pause Read/Write
Setting this property to True will "Pause" the current emulation.
Setting it to false will "Resume" a paused emulation.

Example:
Controller.Pause = True
If Controller.Pause Then ...
Version Read Only

Returns the version number of Visual PinMAME as an 8-digit string "vvmmbbrr":

vv = Major version
mm = Minor version
bb = Beta version
rr = Revision

Example:
A result of "00990201" signifies "Version 0.99 Beta 2 Rev A

If (Controller.Version<"00990201") Then MsgBox "You need a newer version of VPinMAME." : Exit Sub

Methods
Run(parentWindow, minVersion)
Starts Visual PinMAME emulation of game specified with .GameName property

parentWindow: handler of window to put outputin. (Default= 0 -> no parent window)

minVersion: Minimum version of Visual PinMAME (e.g. 100 for 1.00) required to run this game! (Default=any version)

Example:
Controller.Run 0,110 ' VPinMAME 1.1 or higher required
Stop
Stops Visual PinMAME emulation.

Example:
Controller.Stop

Game Settings
Properties
Dip (Dip Bank Number) Read/Write
Sets/Gets the Dip switch settings for the current game.
Dip Bank Number: dip 1-8 = bank 0, dip 9-16 = bank 1 ...
value: binary value to set the dips 1=On, 0=Off

Example:
Controller.Dip(0) = &H55
Controller.Dip(1) = &Haa
HandleMechanics Read/Write
If the game has a PinMAME simulator it can be used to simulate hardware "toys".
value: # of which Mechanics VPinMAME should handle.
Look at the PinMAME simulator source for each specific game to determine the #.

Example:
' For TZ: 1=Clock, 2=Gumball Machine
Controller.HandleMechanics = 1+2 ' Handle both Clock and gumball machine
WPCNumbering Read Only
Determine if game uses WPC Numbering of Switches and Lamps
WPCNumbering = Column*10 + Row (11,12,13,14,15,16,17,18,21,22...)
non WPCnumbering = 1,2,3,4,...

Example:
If WPCNumbering Then firstSwitch = 1 Else firstSwitch = 11
SampleRate Read/Write
Sets/Gets the sample rate

Example:
Controller.SampleRate = 22050
Methods
None

Customization
Properties
SplashInfoLine Read/Write
Game credits to display in startup splash screen.

Example:
Controller.SplashInfoLine = "Game design by ..."
ShowFrame Read/Write
Enabled/Disables the window border
Only works if ShowTitle is set to False!

Example:
Controller.ShowFrame = True 'Show a frame around the VPinMAME window
DoubleSize Read/Write
Sets Visual PinMAME window to Double Size or Normal Size.
Returns whether Window is Double Size or not.

Example:
Controller.DoubleSize = True 'Make Visual PinMAME Window Double Sized!
Antialias Read/Write
Enables/disables scan lines/coumns between the dots of the DMD. Default value is True. Returns whether the scanlines are enabled or not.
Set this property before the emulation starts.

Example:
Controller.Antialias = True 'Enable the scanlines
BorderSizeX
BorderSizeY
Read/Write
Sets & Gets the size of an empty area around the DMD Display
Default value is 4 Pixels

Example:
Controller.BorderSizeX = 20 '20 Pixels of space On Left & Right sides of DMD
Controller.BorderSizeY = 20 '20 Pixels of space On Top & Bottom sides of DMD
WindowPosX
WindowPosY
Read/Write
Sets & Gets the position of the Display Window

Example:
Controller.WindowPosX = 100 'Set X Position of Window to 100 Controller.WindowPosY = 100 'Set Y Position of Window to 100
LockDisplay Read/Write
Sets/Gets the lock state of the display
If the display is locked no keyboard events are handled and the display can't be the active window!

Example:
Controller.LockDisplay = True
Hidden Read/Write, VPM 1.32 or higher
Sets or gets the hidden state of the display.
Setting Hidden=True makes the VPM display invisible until it is turned back on with Hidden=False or VPM is restarted.
This is useful for applications that want to do the display drawing on their own.

Example:
Controller.Hidden = True
Methods
SetDisplayPosition(x,y,hWnd)
Sets the position of the display to x and y; if hWnd is a valid window handle, x and y are assumed to be relative to the window, so this function calculates the proper screen position of the display

Example:
Controller.SetDisplayPosition(100,100,hWnd) 'hWnd = Handle of a Window.
ShowOptsDialog(hWnd)
Shows the options dialog for the current game or set default options if no game name is set. The hWnd is the handle of the parent window, default is 0 (no parent window).

Example:< BR > Controller.ShowOptsDialog
ShowPathesDialog(hWnd)
Shows the pathes dialog where the user can set the diffrent pathes (ROMS, Cfg, Screenshots). The hWnd is the handle of the parent window, default is 0 (no parent window).

Example:< BR > Controller.ShowPathesDialog
ShowAboutDialog(hWnd)
Displays the About dialog of Visual PinMAME. The hWnd is the handle of the parent window, default is 0 (no parent window).

Example:< BR > Controller.ShowAboutDialog
CheckROMS(nShowOptions,hWnd)
Checks the rom set for the current game and displays the results.

nShowOptions:
0 = Allways displays the results
1 = Only displays the results if there are errors found
2 = Never displays the results

Return value is true if the roms are good.
The hWnd is the handle for the parent window, default is 0 (no parent window)

Example:
Controller.CheckROMS(0,hWnd) : Displays the results of the ROM check (hWnd = Handle of a Window)

Aggregate Polling Functions
These properties return a matrix with everything that has changed since the last call.
The array contains the following info
Matrix(0,0) Number of first changed item
Matrix(0,1) New status of first item
Matrix(1,0) Number of second changed item
Properties
ChangedLamps Read Only
Returns which lamps have changed since last call to this property!

Example:
chg = Controller.ChangedLamps
count = UBound(chg)
If count > 0 Then
 For ii = 0 To count
   Text = "Lamp " & chg(ii,0) & "=" & chg(ii,1)
 Next
End if
ChangedSolenoids Read Only
Same as ChangedLamps but for solenoids
ChangedGI Read Only
Same as ChangedLamps but for GI strings
ChangedLEDs Read Only, VPM 1.20 or higher
Returns changed display digit segments since last call to this property.

Two parameters specify which digits are to be examined. Digits are numbered from 0 up to the highest digit present on the game display. The numbering scheme varies with game model family. Depending on the game model, each digit contains 7 or more segments. The states of the segments are returned as a bit pattern where a 1 denotes a lit segment. Which bit corresponds to which segment is game model dependant.

chg = Controller.ChangedLEDs ( mask2, mask1 )

mask1 is a 32-bit mask for digits 0 to 31. For each bit set in this mask, information about the corresponding digit is returned if it has changed since the last call. The lowest bit denotes digit 0. Bits for nonexisting digits are ignored.

mask2 like mask1 but for digits 32 to 63.

chg is the returned array with three values for each changed digit. The IsEmpty(chg) function can be used to test for an empty array in case no segments have changed. Otherwise array indices 0 to Ubound(chg) contain the following information:
chg(x,0): digit number 0 to 63
chg(x,1): changed segments of this digit
chg(x,2): currently lit segments of this digit

Example:

Williams system 6 games use the digit numbering:
digit 0 to 5 = Player 1 display 100,000 to 1
digit 6 to 11 = Player 2 display 100,000 to 1
digit 12 to 17 = Player 3 display 100,000 to 1
digit 18 to 23 = Player 4 display 100,000 to 1
digit 24 to 25 = Credit display 10s and 1s
digit 26 to 27 = Match display 10s and 1s
digit 28 to 63 = not used

and segments bits " "=&h00, "0"=&h3f, "1"=&h06, "2"=&h5b, "3"=&h4f, "4"=&h66, "5"=&h6d, "6"=&h7d, "7"=&h07, "8"=&h7f and "9"=&h6f

A credit display changing from "01" to "02" will be reported by
chg = Controller.ChangedLEDs ( 0, &H03000000 )
as
IsEmpty(chg) : False ' changed segments have been detected
Ubound(chg) : 0 ' array contains only one entry because the 10s digit didn't change
chg(0,0) : 25 ' digit number of the credit 1s digit
chg(0,1) : &h5d ' segments changed by switching from "1" to "2"
chg(0,2) : &h5b ' segments lit showing "2"

Methods
None

Game Input/Output
Properties
Lamp(number) Read Only
Get status of a single lamp
number: lamp #
return: True = Lamp on, False = Lamp off

Example:
If Controller.Lamp(32) = True Then
   'Light #32 is on..
Else
   'Light #32 is off..
End If
Solenoid(number) Read Only
Get status of a single solenoid
number: solenoid #
return: True = Solenoid on, False = Solenoid off

Example:
If Controller.Solenoid(5) = True Then
   'Solenoid #5 is on..
Else
   'Solenoid #5 is off..
End If
GIString(number) Read Only
Get status of a single GI String (Note: Works only for WPC Game!)
number: GI String #
return: True = GI String on, False = GI String off

Example:
If Controller.GIString(5) = True Then
   'GI String #5 is on..
> Else
   'GI String #5 is off..
End If
Switch(number) Read/Write
Get Or Set the status of a single switch
number: Switch #
setting/returning: True = Switch On, False = Switch Off

Example:
(SETTING)
Controller.Switch(25) = True 'Turn Switch 25 on..
(GETTING)
If Controller.Switch(25) = True Then
   'Switch #25 is on..
Else
   'Switch #25 is off..
End If
Methods
None

Debugging
Properties
ShowDMDOnly Read/Write
Enable/disable VPinMAME status matrices.
Set this property before the emulation starts.

Example:
Controller.ShowDMDOnly = False 'Do NOT Display lamp,switch and solenoid matrix
HandleKeyboard Read/Write
If set to True, VPinMAME will process the keyboard. Standard MAME keys can be used in VPinMAME output window. Also the internal ball simulator is enabled.
If set to False, the scripting language will process the keyboard.
Set this property before the emulation starts.

Example:
Controller.HandleKeyboard = True 'Let VPinMAME handle Keyboard input
ShowTitle Read/Write
Show title bar on VPinMAME output window (to move it around)

Example:
Controller.ShowTitle = True 'Display the Title Bar
Methods
None

Events
May not be supported in all scripting environments!
OnSolenoid(solenoidNo, isActive)
Called whenever a solenoid changes state
OnStateChange(newState)
Called whenever the emulation is started or stopped (not called on Pause)