--------------------------------------------------------------
I wanted to cover a single point with the last tutorial and forgot, so before proceeding,
With a Subway system, you can move virtual balls from stack to stack by not including an exit kicker, angle, and direction.
ie
If you wanted to be able to move a ball from bsSkill to bsTrough instantly, your definition would be:
Set bsSkill=new cvpmBallStack
bsSkill.InitSw 0,29,0,0,0,0,0,0
You would remove the exit sound command as you don't want it to play sound, remove the initkick as the ball will not be
physically kicked, and remove kickZ as the ball isn't being kicked.
Somewhere else in the script you can use bsSkill.ExitSol_On to remove a ball from bsSkill, and then use bsTrough.AddBall 0 to add it
to the trough.
NOTE - ALWAYS check to make sure there is a ball in the source ballstack BEFORE adding a ball to the destination stack this way.
Otherwise your ball count could be wong. If you do not check if a ball is present, then a ballsearch, selftest diagnostic, or any other
firing of that solenoid would keep adding a ball to the destination stack every time it fires, eventually crashing the script with an overflow.
You do this with:
If bsSkill.Balls Then
bsSkill.ExitSol_On
bsTrough.AddBall 0
End If
bsSkill.Balls will tell you if any ball is present in the bsSkill stack.
You can use a variety of script commands to accomplish the same effect and I won't elaborate on all the combinations.
Now, for this tutorial, there are some games that have the balls locked while being visible on the table - and some of the
script routines can cause headaches to work out. Game examples will be: Transporter The Rescue and High Roller Casino.
Most visible ball locks are fun to watch, which I suppose is the main point of having them visible.
lighting the R-E-S-C-U-E lights enables the ball lock. Hitting the left ramp sends the ball to the lock area. The lock area is
shaped like a waterfall. The first ball is locked in the left kicker. When a second ball enters the lock area the machine kicks
the first ball to the second kicker (right one) before the new ball enters the left kicker. It visibly shuffles the balls. If
lock isn't enabled, then balls simply get kicked through the system to the right ramp and back into play.
The timing for this is rather important, because if the left kicker is too slow or weak, then the entire lock system could 'break'
and balls could get jammed in the passageways.
The benefit of such a layout is that you don't need to keep track of where the balls are at all - the rom does it for you. If the
left kicker has a ball the switch is closed. If the right kicker has a ball its switch is closed. If one solenoid fires, then the
left kicker kicks. If another solenoid fires, the right kicker kicks. It is simplistic, yet works marvelously well.
The relevant code is below.
CODE
SolCallback(5)="bsLeftLock.SolOut"
SolCallback(8)="bsRightLock.SolOut"
Dim bsLeftLock, bsRightLock 'create variable reference to lock ballstacks - these declares should be global, outside of any subroutine
'This section should be in tablename_init as it references a rendered playfield object Kicker2
set bsLeftLock=new cvpmBallStack
bsLeftLock.InitSw 0,33,0,0,0,0,0,0
bsLeftLock.InitKick Kicker2,0,20
bsLeftLock.InitExitSnd "Popper", "Solenoid"
set bsRightLock=new cvpmBallStack
bsRightLock.InitSw 0,34,0,0,0,0,0,0
bsRightLock.InitKick Kicker1,0,20
bsRightLock.InitExitSnd "Popper", "Solenoid"
'This section belongs outside tablename_init as it is a subroutine
Sub Kicker1_Hit:bsRightLock.AddBall Me:End Sub
Sub Kicker2_Hit:bsLeftLock.AddBall Me:End Sub
SolCallback(8)="bsRightLock.SolOut"
Dim bsLeftLock, bsRightLock 'create variable reference to lock ballstacks - these declares should be global, outside of any subroutine
'This section should be in tablename_init as it references a rendered playfield object Kicker2
set bsLeftLock=new cvpmBallStack
bsLeftLock.InitSw 0,33,0,0,0,0,0,0
bsLeftLock.InitKick Kicker2,0,20
bsLeftLock.InitExitSnd "Popper", "Solenoid"
set bsRightLock=new cvpmBallStack
bsRightLock.InitSw 0,34,0,0,0,0,0,0
bsRightLock.InitKick Kicker1,0,20
bsRightLock.InitExitSnd "Popper", "Solenoid"
'This section belongs outside tablename_init as it is a subroutine
Sub Kicker1_Hit:bsRightLock.AddBall Me:End Sub
Sub Kicker2_Hit:bsLeftLock.AddBall Me:End Sub
The only extra code we need is for the lock area entry switch. Transporter uses one of these to tell when it should start the ball
shuffling routine. In my table it is called Trigger5 and is on the ramp to the left of the left lock kicker.
CODE
Sub Trigger5_Hit:Controller.Switch(17)=1::ActiveBall.VelY=5:End Sub
Sub Trigger5_Unhit:Controller.Switch(17)=0:End Sub
Sub Trigger5_Unhit:Controller.Switch(17)=0:End Sub
This closes switch 17 and slows the ball down - if the ball enters the lock too fast it could jam the ball being kicked from the
left kicker. Then when the trigger is unhit it releases switch 17.
There are a few things to consider when creating a visible lock - timing, speed, ball clearance, and ball flow. When recreating a
game with VPM, most of these are taken care of simply by the design of the game - other features such as speed will take experimentation
to figure out what works best.
High Roller Casino has no entry switch - just three lock switches and a moving post to hold the balls in place. When lock is lit,
the first ball rolls over switches in order until stopped by the post or a previously locked ball. When lock is not lit, the post
moves down to allow a locked ball to exit, or it can be held down long enough for any ball to roll completely through.
Most games release the balls one at a time - at set intervals for the post movement. Others release all the balls at the same time.
Because the game is controlling the post movement it usually isn't something you need to worry about.
For this visible lock system we will use the cvpmVLock class of the core.vbs file.
The lock has 3 positions, and 3 switches. One important item to note is, to use this class, the kickers must be DISABLED. We also
need three triggers. When the ball hits a trigger, it will close the related switch. When a ball unhits a trigger it will open the
related switch. If there are no balls locked then the new ball will be held in the kicker under the first lock position.
If a ball is locked, the new ball will be held in the second lock position. And yes, if two balls are locked, the new ball will be
held in the third lock position. If the post is down, then all balls are kicked back into play and are allowed to move until the
post is raised again. If the post is then raised, the kickers and triggers go back to 'catch ball' operation.
Make sure the lock kickers and triggers are set to the ramp surface, as the entire lock system resides on top of a wire ramp.
The triggers and kickers and switches are all listed from BOTTOM to TOP - I used to get that confused a lot.
The code for all of this is below:
CODE
SolCallBack(23) = "bsVLock.SolExit"
Dim bsVLock
Set bsVLock=New cvpmVLock
bsVLock.InitVLock Array(Trigger5,Trigger7,Trigger8),Array(Kicker1,Kicker2,Kicker3),Array(25,26,27)
bsVLock.CreateEvents "bsVLock"
Dim bsVLock
Set bsVLock=New cvpmVLock
bsVLock.InitVLock Array(Trigger5,Trigger7,Trigger8),Array(Kicker1,Kicker2,Kicker3),Array(25,26,27)
bsVLock.CreateEvents "bsVLock"
Trigger5 is the bottom trigger, associated with Kicker1 - the bottom kicker, associated with switch 25 - the bottom lock switch.
Trigger7 is the middle trigger, associated with Kicker2 - the middle kicker, associated with switch 26 - the middle lock switch.
Trigger8 is the top trigger, associated with Kicker3 - the top kicker, associated with switch 27 - the top lock switch.
CreateEvents creates the hit and unhit subroutines for you - for the kickers, triggers, and switches involved with the lock. This is
done during the first execution of the table script. Unless you have a special case, where you need more functionality than this class
provides, I highly recommend you keep createevents here to do this for you.
For each lock position, CreateEvents automatically puts code into your script necessary to make it work.
For this example, it creates:
Sub Trigger5_Hit : bsVLock.TrigHit ActiveBall, 1 : End Sub
Sub Trigger5_UnHit : bsVLock.TrigUnHit ActiveBall, 1 : End Sub
Sub Kicker1_Hit : bsVLock.KickHit 1 : End Sub
Sub Trigger7_Hit : bsVLock.TrigHit ActiveBall, 2 : End Sub
Sub Trigger7_UnHit : bsVLock.TrigUnHit ActiveBall, 2 : End Sub
Sub Kicker2_Hit : bsVLock.KickHit 2 : End Sub
Sub Trigger8_Hit : bsVLock.TrigHit ActiveBall, 3 : End Sub
Sub Trigger8_UnHit : bsVLock.TrigUnHit ActiveBall, 3 : End Sub
Sub Kicker3_Hit : bsVLock.KickHit 3 : End Sub
If you want to animate the lock post movement, change the SolCallback line.
CODE
SolCallBack(23) = "LockRelease"
Sub LockRelease(Enabled)
If Enabled Then
bsVLock.SolExit True
LockPostWall.IsDropped=1
Else
bsVLock.SolExit False
LockPostWall.IsDropped=0
End If
End Sub
Sub LockRelease(Enabled)
If Enabled Then
bsVLock.SolExit True
LockPostWall.IsDropped=1
Else
bsVLock.SolExit False
LockPostWall.IsDropped=0
End If
End Sub
You could also add a timer to delay the post from rising until after the ball has cleared the area, or uncheck the collidable box
for the lock post wall if it comes up with a ball on top of it. You can also modify the exit force from the lock. By default
the exit force is the table slope - so balls are freely rolling under gravity. If that is too slow, bsVLock.ExitForce= can manually
set a speed, bsVLock.KickForceVar= can vary the kick force value, and you can set a direction too with bsVLock.ExitDir=angle
The next tutorial will be on mechanics handlers ( TOYS! ) and it will take a lot of work to type up.
After that it'd be nice to have an easy one on shortcuts.




Top
Contributor








are all trademarks of VPFORUMS.