*.VBS content

1.           Classes

a.  cvpmTimer class for switch pulsing and easy timer handling.

b.          cvpmBallStack class for ball tracking in stacks or saucers.

c.          cvpmDropTarget class for easy drop target bank handling

d.  cvpmNudge class for Tilt handling

e.          cvpmMagnet class for playfield Magnets

f.          cvpmTurntable class for playfield turntables

g.          cvpmCaptiveBall class for captive balls

h.  cvpmMech class for handling playfield mechanics

i.   cvpmVLock class for visible ball locks

2.           Solenoid callback functions

a.  Flippers

b.  Diverters

c.  Walls

d.  Auto Plungers

e.  Gates

f.   Sound

g.  Flashers

h. Generic for any object

3.           Constants

a.  Common switches/Solenoids

4.           User interface

a.  Open options window (F1)

b.  Show keys help (F2)

c.  Reset emulation (F3)

d.  Toggle display lock status (F4)

Using the *.VBS files

To use the *.VBS files the file must be in the same directory as the table file. Add the following code at the top of the script

‘ Load VPinMAME and *.VBS file, check versions

LoadVPM "02000000", "S11.VBS", 2.4

Sub LoadVPM(VPMver, VBSfile, VBSver)

     On Error Resume Next

          If ScriptEngineMajorVersion < 5 Then MsgBox "VB Script Engine 5.0 or higher required"

          ExecuteGlobal GetTextFile(VBSfile, 1).ReadAll

          If Err Then MsgBox "Unable to open " & VBSfile & ". Ensure that it is in the same folder as this table. " & vbNewLine & Err.Description

          Set Controller = CreateObject("VPinMAME.Controller")

          If Err Then MsgBox "Can't Load VPinMAME." & vbNewLine & Err.Description

          If VPMver>"" Then If Controller.Version < VPMver Or Err Then MsgBox "VPinMAME ver " & VPMver & " required."

          If VPinMAMEDriverVer < VBSver Or Err Then MsgBox VBSFile & " ver " & VBSver & " or higher required."

     On Error Goto 0

End Sub

 

Class cvpmTimer

This class is used to simplify timed events required for VPinMAME.

A single instance of this class is available as “vpmTimer”.

·        Method: .PulseSwitch switch, time, command

·        Method: .PulseSw sw

Pulses (quick on-off) switch and then execute command after time has elapsed.

switch:          switch to pulse

time:          time until callback is called in ms (1/1000s)

command:          Execute this string when timer expires.
switch number will be added at the end

Example:

              1. Walls do not have UnHit events.

Sub Wall10_Hit : vpmTimer.PulseSw 10 : End Sub

              2. Under playfield handling. Trigger switch 8, wait 0.5s and then call
              SubwayHandler

vpmTimer.PulseSwitch 8,500,”SubwayHandler”

Sub SubwayHandler(swNo)

   If swNo = 8 Then ...

 

·        Method: .AddTimer time, command

Execute command after time has elapsed

time:           Time until callback is called 1/1000s

command:          Execute this string when timer expires.
switch number “0” will be added at the end

Example:

              1. Call “delayedSub” after 1 second

vpmTimer.AddTimer 1000,”DelayedSub”

Sub DelayedSub(swNo)   ‘swNo is always 0 for AddTimer events

              2. Kick out the ball from a kicker after 2 seconds

‘Note the “’” at the end to ignore the added “0”

vpmTimer.AddTimer 2000,”Kicker.Kick 90,10 ’”

Class cvpmBallStack

This class implements all kind of ball handling where kickers are involved.

It can be used in two different ways:

Stack      Balls are destroyed as they enter the stack and created when leaving.
              Up to 10 balls can be in the stack at the same time.

Saucer    Balls are not destroyed (i.e stays visible) and only one ball can be in the stack at any point in time.

Example:

Set bsTrough = New cvpmBallStack

Set bsSaucer = New cvpmBallStack

 

Stack version

·        Method: .InitSw entrySw,sw1,sw2,sw3,sw4,sw5,sw6,sw7

Initialize the switches used in the stack.

entrySw:          switch triggered when a ball enters the stack (e.g. an outhole)
If an entry switch is specified, balls will keep the switch activated until the entry solnoid is fired.
If entry switch is 0 balls will go directly into the stack.

sw1-sw7:          Switches activated when balls are in the stack. Next ball to leave the stack will activate sw1, second ball sw2 etc

 

Example:

              1. A Trough with an outhole switch and 3 switches

bsTrough.InitSw swOutHole, swRTrough, swCTrough,_
swLTrough,0,0,0,0

              2. A Lock with 2 switches

bsLock.InitSw 0,swLock1,swLock2,0,0,0,0,0

 

·        Method: .InitKick kicker, direction, force

Initialise the kicker used to kick out balls from the stack.

If the kicker is not initialized the stack work as normal but no ball will be kicked out (It is still removed from the stack)

kicker:                    kicker object

direction:          kickout direction

force:                    kickout force

Example:

              Kickout from the “BallRelease” kicker direction 90 and power 5

bsTrough.InitKick BallRelease, 90, 5

 

·        Method: .InitNoTrough kicker, switch, direction, force

Simplified init function for single ball games without a trough. Number of balls is automatically set to 1

kicker:                    kicker object

switch:          outhole switch

direction:          kickout direction

force:                    kickout force

Example:

              Single ball game

bsTrough.InitNoTrough BallRelease, swOuthole, 90, 5

 

·        Property: .KickBalls = x

Specifies the maximum number of balls that can be kicked out at the same time. Default = 1.

First ball will be kicked out with 100% power, 2nd with 80%, 3rd with 64%…

Example:

              Kick out maximum 2 balls at a time

bsLock.KickBalls = 2

 

·        Method: .InitEntrySnd ballSound, sound

Specify the sound used when the entry solenoid is fired.

ballSound:          sound to play if a ball is kicked

sound:                    sound to play if no ball is kicked

Example:

bsTrough.InitEntrySnd “Outhole”, “SolenoidOn”

 

 

Saucer version

·        Method: .InitSaucer kicker, sw, direction, force

Initialize a saucer

kicker:          kicker object used for the saucer

sw:          switch activated when a ball is in the saucer

direction:          direction of kickout

force:          force of kickout

Example:

bsSaucer.InitSaucer saucerkicker, swSaucer, 90, 10

 

Common to Stacks and Saucers

·        Property: .KickForceVar = forceVar

·        Property: .KickAngleVar = angleVar

Randomly vary the kickout force and angle by “var” units (default 0)

Example:

              Kick out balls with force 10 +/- 2 (i.e. 8-12) and angle 85-95

bsLock.InitKick lockKicker, 90, 10

bsLock.KickForceVar = 2

bsLock.KickAngleVar = 5

 

·        Property: .KickZ = angle

Specify the vertical angle for kickout

angle:                    vertical angle in radians (PI/2 = vertical)

Example:

              Kickout ball in a 45 degree angle towards the playfield

bsTrough.KickZ = 3.1415926/4

 

·        Method: .InitAltKick direction, force

Specify an alternative kickout direction and force. Used mainly with saucers that can kick the ball out in two different directions.

direction:          direction of kickout

force:          force of kickout

Example:

              Kickout ball either up or down

bsSaucer.InitSaucer saucerKicker, swSaucer, 0, 5

bsSaucer.InitAltKick 180,5

SolCallback(sSaucerUp) = ”bsSaucer.SolOut”

SolCallback(sSaucerDown) = ”bsSaucer.SolOutAlt”

 

·        Method: .InitExitSnd ballSound, sound

Same as .InitEntrySnd but for the Exit solenoid

ballSound:          sound to play if a ball is kicked

sound:          sound to play if no ball is kicked

Example:

bsTrough.InitExitSound “BallRelease”, “SolenoidOn”

 

·        Method: .AddBall kicker

Add a ball into the Stack or Saucer. If a kicker is specified the ball will be destroyed for a Stack (not for Saucers*).  If an entry switch is specified balls will not be put into the stack until the entry solenoid is fired (see .SolIn)

* Balls are always kicked out from the kicker specified with the .InitSaucer method. If a different kicker is specified in the .AddBall method the ball will be moved (destroyed and created with the same properties) to the normal kicker at kickout. This can be used to simulate a vertical up kicker (VUK).

kicker:          Kicker where ball is

Example:

              1. Add a ball currently in the outhole kicker

Sub Outhole_Hit : bsTrough.AddBall Me : End Sub

              2. Add a ball in a Saucer

Sub Saucer_Hit : bsSaucer.AddBall 0 : End Sub

 

·        Property: .Balls = x

Fill stack with balls. Any existing balls will disappear.

Example:

              Put 3 balls in Trough

bsTrough.Balls = 3

 

Solenoid handlers

·        Method: .SolIn enabled

·        Method: .EntrySol_On

Kicks a ball waiting on the entry Switch into the stack (not applicable for Saucers).

SolIn can be specified as a solenoid handler.

Example:

              1. Directly from solenoid callback

SolCallback(sOuthole) = “bsTrough.SolIn”

              2. From procedure

SolCallback(sOuthole) = “SolOuthole”

Sub SolOuthole(enabled)

   If enabled Then

      bsTrough.EntrySol_On

 

·        Method: .SolOut enabled

·        Method; .ExitSol_On

Kicks out a ball from the stack or saucer .

SolOut can be specified as a solenoid handler.

Example:

              1. Directly from solenoid callback

SolCallback(sBallRelease) = “bsTrough.SolOut”

              2. From procedure

SolCallback(sBallRelease) = “SolBallRelease”

Sub SolBallRelease(enabled)

   If enabled Then

      bsTrough.ExitSol_On

·        Method: .SolOutAlt enabled

·        Method; .ExitAltSol_On

Kicks out a ball from the stack or saucer in the alternative direction.

SolOutAlt can be specified as a solenoid handler.

Example:

              See .InitAltKick method

Class cvpmDropTarget

This class is used to handle drop target banks.

 

·        Method: .InitDrop targets, switches

Initializes the targets and the switches for the drop targets.

targets:          Droppable walls. Arrays/Collections can be used if each target consists of more than one wall.

switches:          Switches connected to each target. If Nothing the switches will be taken from the TimerInterval property of the targets.

Example:

              1. Single target

dtDrop.InitDrop Target, swTarget

              2. Multiple targtes

dtDrop.InitDrop Array(Target1, Target2, Target3), Array(sw1,sw2,sw3)

              3. Multiple targets with two walls for each target

dtDrop.InitDrop Array(Array(T1Front,T1Back),Array(T2Front,T2Back)), Array(sw1,sw2)

              4. Targets where switch number is set in the TimerInterval property

dtDrop.InitDrop Array(Target1,Target2,Array(T3Front,T3Back)),Nothing

 

·        Method: .CreateEvents instance

Creates the events for the drop targets. “Sub Target_Hit …”

instance:          The name of the cvpmDropTarget object.

Example:

dtDrop.InitDrop Array(Target1, Target2, Target3), Array(sw1,sw2,sw3)

dtDrop.CreateEvents “dtDrop”

 

·        Property: .AnyUpSw = switch

·        Property: .AllDownSw = switch

·        Property: .LinkedTo = dropTargetBanks

Some drop target banks have switches indication if all targets are up or down. Use these properties to specify the switches.

Sometimes games have common swicthes for several drop target banks. The .LinkedTo property specifies drop target banks that have a common AnyUpSw or AllDownSw. (note that drop target banks must be linked both ways)

DropTargetBanks          Drop target bank (or array) which share an AnyUp or AllDn switch

Example:

              1. Normal drop target bank

dtDrop.AnyUpSw = 25

dtDrop.AllDownSw = 30

              2. Three banks with a common AllDownSw

dtLDrop.AllDownSw = 34

dtLDrop.LinkedTo = Array(dtCDrop,dtRDrop)

dtCDrop.LinkedTo = Array(dtLDrop,dtRDrop)

dtRDrop.LinkedTo = Array(dtLDrop,dtCDrop)

 

·        Method: .InitSound drop, raise

Specify sound connected to drop targets

drop:          sound when a target is hit

raise:          sound when targets are raised

Example:

dtDrop.InitSound “DropTarget”,”RaiseTarget”

 

·        Method: .Hit targetNo

·        Method: .SolHit targetNo, enabled

A drop target has been hit. .SolHit can be specified as a solenoid handler.

targetNo:          The target that has been hit (1,2,3...)

Example:

              1. Target 2 has been hit

Sub Target2_Hit : dtDrop.Hit 2 : End Sub

              2. Solenoid for target 3

SolCallback(sTarget2) = “dtDrop.SolHit 3,”

 

·        Method: .SolDropUp enabled

·        Method: .DropSol_On

Raise target handler. Restores all drop targets and switches in the bank

.SolDropUp can be specified as a solenoid handler

Example:

              1. Directly from solenoid callback

SolCallback(sRaiseDrop) = “dtDrop.SolDropUp”

              2. From procedure

SolCallback(sRaiseDrop) = “SolRaiseDrop”

Sub SolRaiseDrop(enabled)

   If enabled Then

      dtDrop.DropSol_On

 

·        Method: .SolDropDown enabled

Drop all targets. Can be specified as a solenoid handler

Example:

SolCallback(sDropDown) = “dtDrop.SolDropDown”

 

·        Method: .SolUnhit targetNo, enabled

Raise one target. Can be specified as a solenoid handler

targetNo:          The target that should be raised (1,2,3...)

Example:

SolCallback(sRaiseDrop3) = “dtDrop.SolUnhit 3,”

 

Class cvpmNudge

This class is used to handle nudging and Tilts.

 

·        Property: .TiltSwitch = swNo

Specifies switch to be triggered when a Tilt occurs.

Example:

vpmNudge.TiltSwitch = swTilt

 

·        Property: .Sensitivity = sens

Specifies the tilt sensitivity between 0 (low) – 10 (high).

Example:

vpmNudge.Sensitivity = 5

 

·        Property: .TiltObj = Objects

Specifiy objects (bumpers and slingshots) affected by a tilt.

Example:

vpmNudge.TiltObj = Array(Bumper1, Bumper2,LeftSling,RightSling)

 

·        Method: .DoNudge direction, force

Nudge the table

direction:          Direction of nudge.

force:          Nudge force

Example:

vpmNudge.DoNudge 85, 2

 

·        Method: .SolGameOn enabled

Activates or deactivates bumpers and slingshots

Example:

SolCallback(sGameOn) = “VpmNudge.SolGameOn”

Class cvpmMagnet

This class is used to handle playfield magnets. The magnet itself is one or more triggers covering the area where the magnet can affect the ball. By default the magnet use vpmTimer for updates. On slow computers this might cause erratic switch behaviour. Performance can be improved by adding an extra timer called “vpmFastTimer”. Magnets will automatically use “vpmFastTimer” if it exists.

 

·        Method: .InitMagnet trigger, strength

Initializes the magnet.

trigger:          Trigger(s) used to simulate the magnet

strength:          Magnet strength at center

Example:

MLeft.InitMagnet LeftMagnet, 10

MLeft.InitMagnet Array(LeftMagnet1, LeftMagnet2), 14

 

·        Method: .CreateEvents instance

Creates the magnet events “Sub Magnet_Hit …”

instance:          The name of the cvpmMagnet object.

Example:

MLeft.InitMagnet LeftMagnet, 10

MLeft.CreateEvents “MLeft”

 

·        Property: .Solenoid = sol

Specifies the solenoid that controls the magnet. If not set or set to 0 the magnet is controlled with the .MagnetOn property.

sol:          Solenoid number

Example:

MLeft.Solenoid = sLeftMagnet

 

·        Property: .X = xPos

·        Property: .Y = yPos

·        Property: .Strength = strength

·        Property: .Size = radius

Changes the magnet properties. Note that the trigger is not moved so the new magnet position must remain within the area covered by the trigger(s).

xPos, yPos:          Playfield coordinates

strength:          Magnet strength at center

radius:          Magnet reach

Example:

MLeft.X = MLeft.X + 5

Mleft.Strength = 12

 

·        Property: .GrabCenter = True/False

The cvpmMagnet class updates the ball based on a timer. This might cause the ball to “vibrate” at the center of the magnet. .GrabCenter forces the ball to stop immediately on the center.

Example:

MLeft.GrabCenter = False

 

·        Method: .AddBall ball

A ball has entered the magnets reach. Usuall called from the magnet trigger’s hit event.

ball:          Ball object

Example:

Sub LeftMagnet_Hit : MLeft.AddBall ActiveBall : End Sub

 

·        Method: .RemoveBall ball

A ball has left the magnets reach. Usuall called from the magnet trigger’s unhit event.

ball:          Ball object

Example:

Sub LeftMagnet_UnHit : MLeft.RemoveBall ActiveBall : End Sub

 

·        Property: .Balls

An array of all balls currently in the magnets reach.

Example:

BallsOnMagnet = Ubound(mLeft.Balls)

 

·        Property: .MagnetOn enabled

Turn the magnet on or off. Only works if no solenoid is specified.

enabled:          True to turn magnet on

Example:

MLeft.MagnetOn = True

SolCallback(sLeftMagnet) = “MLeft.MagnetOn=”

 

·        Method: .AttractBall ball

Calculate and perform a magnets effect on a specific ball.

ball:          Ball object

Example:

MLeft.AttractBall ActiveBall

 

Class cvpmTurnTable

This class is used to handle rotating objects like turntables. The turntable itself is a trigger covering the area where of the turntable. By default the turntables use vpmTimer class for updates. On slow computers this might cause erratic switch behaviour. Performance can be improved by adding an extra timer called “vpmFastTimer”. Turntables will automatically use the “vpmFastTimer” if it exists.

 

·        Method: .InitTurntable trigger, maxSpeed

Initializes the turntable.

trigger:          Trigger used to simulate the turnTable

maxSpeed:          Maximum turntable speed

Example:

ttCenter.InitTurnTable CenterTable, 40

 

·        Method: .CreateEvents instance

Creates the turntable events “Sub TurnTable_Hit …”

instance:          The name of the cvpmTurnTable object.

Example:

ttCenter.InitTurnTable CenterTable, 40

ttCenter.CreateEvents “ttCenter”

 

·        Property: .MaxSpeed = maxSpeed

·        Property: .Speed = speed

·        Property: .SpinUp = acc

·        Property: .SpinDown = ret

·        Property: .SpinCW = spinDir

Changes the turntables properties. Note that the acceleration and retardation will affect the speed. Set .SpinUp = 0 and .SpinDown = 0 to control speed directly.

maxSpeed:          Maximum turntable speed

speed          Turntable speed

acc:          Spin up acceleration [speed units/0.5s]

ret:          Spin down retardation

spinDir:          True for clockwise spin, false for counter clockwice (does not change motor state)

Example:

TtCenter.maxSpeed = 50

ttCenter.SpinUp = 20

ttCenter.SpinDown = 5

 

·        Method: .AddBall ball

A ball has entered the turntable reach. Usuall called from the turntable trigger’s hit event.

ball:          Ball object

Example:

Sub CenterTable_Hit : ttCenter.AddBall ActiveBall : End Sub

 

·        Method: .RemoveBall ball

A ball has left the turntable. Usuall called from the tunrtable trigger’s unhit event.

ball:          Ball object

Example:

Sub CenterTable_UnHit : ttCenter.RemoveBall ActiveBall : End Sub

 

·        Property: .Balls

An array of all balls currently in the turntables reach.

Example:

              Make all balls on the turntable red

For Each ball In ttCenter.Balls : ball.Color = vbRed : Next

 

·        Property: .MotorOn = enabled

·        Method: .SolMotorState clockWise, enabled

Control the motor status of the turntable.

clockWise:          True = Turntable spinning clockwise

enabled:          True = Table motor is on

Example:

              1. Solenoid handlers

SolCallback(sCenterCW) = “ttCenter.SolMotorState True,”

SolCallback(sCenterCCW) = “ttCenter.SolMotorState False,”

              2. Direct control

ttCenter.MotorOn = False

 

 

·        Method: .AffectBall ball

Calculate and perform a turntable’s effect on a specific ball.

ball:          Ball object

Example:

ttCenter.AffectBall ActiveBall

 

Class cvpmMech

This class is used to create a handler of playfield mechanics including motors. The class will calculate the position of the mechanics, update switches and call a user-defined function whenever the poosition changes.

 

·        Property: .MType = type

Specifies the mechanics type. The type is consists of four groups:

1. How the motor is controlled

vpmMechOneSol – A single solneoid controls the power to the motor. One direction only.

vpmMechOneDirSol – The first solenoid controls the power to the second solenoid controls the direction.

vpmMechTwoDirSol – The first solenoid controls clockwise movement and the second solenoid controls counter-clockwise movement.

vpmMechStepSol – Two solenoids control a step motor

2. How the mechanic controlled by the motor moves

vpmMechCircle – The mechanic moves in a circle and comes back to the starting point

vpmMechReverse – The mechanic moves from one end to the other and then moves back without the motor changing direction

vpmMechStopEnd – The mechanics stops when it reaches either end point.

3. The speed of the mechanic

vpmMechLiner – The mechanic moves at a constant speed from one end to the other (default)

vpmMechNonLinear – The mechanics speed is slow at the endpoints and fast in the middle

4. Mech handler properties

vpmMechSlow – Normal handler. Updated ~60 times per second. (default)

vpmMechFast – A fast handler. Sometimes required for very fast puls controlled mechanics (e.g. step motors). Update speed is ~240 times per second.

vpmMechStepSw – The switches are updated based on mechanincs “step” value (default)

vpmMechLengthSw – The switches are updated based on mechanics “length” value.

 

The type field is a combination of the above values

Example:

              Terminator 2 Gun

mGun.Type = vpmMechOneSol + vpmMechReverse + vpmMechNonLinear

 

·        Property: .Sol1 = solNol

·        Property: .Sol2 = solNol

Specifies the solenoids used to control the playfield mechanics.

Example:

              Monster Bash Dracula

mDracula.Sol1 = 41

mDracula.Sol2 = 42

 

·        Property: .Length = x

Specifies the length from one end to the other or a full circle (vpmMechCircle). The length parameter is the number 1/60th second the motor must be on.

Example:

              Terminator 2 Gun. ~3.5s at full speed.

mGun.Length = 200

 

·        Property: .Steps = x

The number of the positions reported back by the mechanic handler.

Example:

              Terminator 2 Gun. 20 different positions

MGun.Steps = 20 ‘one position for every 10 “length” units

 

·        Property: .Acc = acc

·        Property: .Ret = ret

Specifies the acceleration and retardation of the mechanic.

acc:          “Length” units required to reach full speed

ret:          number of times slower retardation is than acceleration

Example:

              World Cup Soccer ’94 Soccer ball. Takes 3 seconds to speed up and the same to stop

mSoccerBall.Acc = 180

mSoccerBall.Ret = 1

 

·        Method: .AddSw = swNo, startStep, endStep

Specifies a switch to be automatically updated by the mechanics handler.

swNo          switch number

startStep          First step position where the switch is activated

endstep          Last step position where the switch is activated

Example: Terminator 2 Gun. Home position at 0, Mark position at 8-9

mGun.AddSw swGunHome, 0, 0

mGun.AddSw swGunMark, 8, 9

 

·        Method: .AddPulseSw = swNo, interval, length

Specifies a switch to be automatically pulsed when mech is moving.

swNo          switch number

interval          Length between pulses (in steps)

length          Length of each pulse (in steps)

Example: Pulse switch every 5 steps

mGun.AddPulseSw swMech, 5, 1

 

·        Property: .Callback = callback

Specifies function called whenever the position of the mechanic changes. The function must take three argument.

NewPos          Current position (step) of mechanics

Speed          Current speed of mechanic

LastPos          Previous position (step) of mechanics

Example:

mGun.Callback = GetRef(”UpdateGun”)

Sub UpdateGun(aNewPos, aSpeed, aLastPos)

   GunWalls(aLastPos\2).IsDropped = True

   GunWalls(aNewPos\2).IsDropped = False

End Sub

 

·        Property: .Start

Sets up the mechnics handler and starts it.

Example:

Set GunMech = New cvpmMech

With gunMech

   .Sol1 = sGunMotor

   .Length = 200

   .Steps = 58 ' 29 walls

   .MType = vpmMechOneSol + vpmMechReverse + vpmMechNonLinear

   .AddSw swGunHome, 0, 1

   .AddSw swGunMark, 20, 21

   .Callback = GetRef("UpdateGun")

   .Start

End With

 

·        Property: .Position

·        Property: .Speed

The current position and speed of the mechanic.

The position is in the range 0 to Steps-1 (e.g. ,Steps = 58 means position is 0-57).

Speed is 0 (stopped) to .Acc (full speed) (e.g. .Acc=10 means speed is 0-10)

Class cvpmCaptiveBall

This class is used to handle captive balls on the playfield. The handler takes the hitting balls velocity and angle into account when moving captive ball.

The Captive Ball requires the following elements:

1. One or two kickers for the moving ball. (If two kickers are specified the ball will rest in the first and the second will be used to kick out the ball)

2. A wall that holds the captive ball back

3. A trigger in front of the wall. (To estimate the ball speed).

 

·        Method: .InitCaptive trigger, wall, kickers, ballAngle

Initialises the captive ball obejcts (Does not create the ball).

trigger          Trigger placed in front of the captive ball. (optional but operation will be much better if it there)

wall          Wall holding the captive ball back.

kickers          One or two kickers for the normal captive ball + kickers for “nailed” balls.

ballAngle          The angle the captive ball should move.

Example:

cbCaptive = New cvpmCaptiveBall

cbCaptive.InitCaptive CaptiveTrigger, CaptiveWall, Array(Captive1,Cative2)

·        Property: .NailedBalls = nailedballs

Specify the number of nailed balls. (default 0). One extra kicker must have been specified in the InitCaptive method for each nailed ball.

nailedBalls:          0-n

 

·        Method: .Start

Start the captive ball handler, i.e. create the moving ball. Note that if “nailed” ball is used, the actual ball must be created manually

Example:

              Captive Ball with a red “nailed” ball

cbCaptive.InitCaptive CaptiveTrigger, CaptiveWall, Array(Captive1,Cative2,Captive3)

cbCaptive.Start

Captive1.CreateBall.Color = vbRed

 

·        Property: .ForceTrans = fTrans

·        Property: .MinForce = minForce

Controls the movement of the captive ball.

fTrans          The amount of the hitting balls speed that is transferred to the captive ball (0-1). Note that the hitting ball’s speed is not reduced. Use the elasticity of the wall to control the hitting balls speed.

minForce          The minimum force applied to the captive ball. If set to low the captive ball might not return to its resting position. (depends on the distance between the moving ball’s kickers and table slope.)

Example:

cbCaptive.ForceTrans = 0.4

cbCaptive.MinForce = 3.5

 

·        Property: .RestSwitch = swNo

Switch activated when the ball is in the resting position

Example:

cbCaptive.RestSwitch = swCaptiveResting

 

·        Method: .CreateEvents instance

Creates the events required for the captive ball

instance:          The name of the cvpmCaptiveBall object.

Example:

cbCaptive.CreateEvents “cbCaptive”

 

·        Method: .TrigHit ball

·        Method: .BallHit ball

·        Method: .BallReturn kicker

Called from the events of captive ball objects. All these event are automatically generated with the .CreateEvents method.

Example:

Sub CaptiveTrigger_Hit : cbCaptive.TrigHit ActiveBall : End Sub

Sub CaptiveTrigger_UnHit : cbCaptive.TrigHit 0 : End Sub

Sub CaptiveWall_Hit : cbCaptive.BallHit ActiveBall : End Sub

Sub Captive2_Hit : cbCaptive.BallReturn Me : End Sub

 

Class cvpmVLock

This class is used to create a ball lock where the balls are visible. The balls are kept in kickers and can be either be kicked out at the top (entrance) or be let out through the bottom.

The setup is a combination of kickers and triggers. One kicker is required for each ball that can enter the lock and each kicker must be covered by a trigger. A kicker has radius 25 so the trigger must have a radius of at least 26. The trigger/kicker pairs should be placed as closed to each other without overlapping but if the lock can release one ball at a time some distance between the trigger/kicker pairs might be needed for the timing.

 

·        Method: .InitLock triggers, kickers, switches

Initialises the visible lock.

triggers          Triggers for the lock from bottom to top

wall          Kickers for the lock matching the triggers

Switches          Switches activated at each lock position. If 0 or Nothing the switches will be fetched from the triggers TimerInterval property

Example:

Set Lock = New cvpmVLock

Lock.InitVLock Array(LTrig1,LTrig2,LTrig3),    Array(LKick1,LKick2,LKick3), Array(swLock1,swLock2,swLock3)

 

·        Method: .InitSnd ball, noBall

Initialises the sounds to play when exit solenoid is actiavted.

ball          Sound to play when at least one ball is in the lock

noBall          Sound to play when the lock is empty

Example:

Lock.InitSnd ”BallKick”, ”Solenoid”

 

·        Method: .CreateEvents instance

Creates all events for triggers and kickers required for the lock

Example:

              Single ball lock (stupid example)

Lock.InitVLock LTrigger, LKicker, swLock

Lock.CreateEvents ”Lock”

 

·        Method: .TrigHit ball, no

·        Method: .TrigUnHit ball,no

·        Method: .KickHit no

Called from the events of the lock triggers and kickers. All these event are automatically generated with the .CreateEvents method.

Example:

Sub LTrigger_Hit : Lock.TrigHit ActiveBall, 1 : E