An Interesting Find

tiltjlp

PN co-founder
A few days ago I found images for something I never even thought existed, a payout/trade stimulator bagatelle. The only reason I know this is that I also have an image of the rules lable on back of the game. So, what I'll need, and haven't started trying to figure out, is the ability to place a ball randomly in one of 10 payout cups on the playfield at the start of the game, and if deactivating the other payout cups. Hopefully someone better at coding than I am will have some ideas on how to do this. Screenshot to follow.
 

druadic

Pinball Wizard
A few days ago I found images for something I never even thought existed, a payout/trade stimulator bagatelle. The only reason I know this is that I also have an image of the rules lable on back of the game. So, what I'll need, and haven't started trying to figure out, is the ability to place a ball randomly in one of 10 payout cups on the playfield at the start of the game, and if deactivating the other payout cups. Hopefully someone better at coding than I am will have some ideas on how to do this. Screenshot to follow.
John;

Randomization is VERY EASY in VP. I use randomizing on my new "plunger" I have made. It's quite easy really.

TRY THIS:

DIM B (This goes at the TOP of your script with the other DIM array statements)

Sub Random
Randomize
B = Int(Rnd * 10) + 0

The above three bottom lines will randomize a number for the variable of B. B can be used for the "balls" that will be randomized. A DIM array statement (top line) allows B to be used with the randomizer. Make sure at the start of the table script when it first loads that it will go to the Sub Random area. You can name this anything you wish of course, just make sure it goes immediately to that area when your table loads.

Then you can do the following:

DIM B (at top of your script)

Sub Random (The following lines can be added to any lower part of your script)
Randomize
B = Int(Rnd * 10) + 0
If B = 1 Then
Kicker1.CreateBall
Kicker2.Active=False:Kicker3.Active=False:Kicker4.Active=False:Kicker5.Active=False
Kicker6.Active=False:Kicker7.Active=False:Kicker8.Active=False:Kicker9.Active=False:Kicker10.Active=False
End If
If B = 2 Then
Kicker2.CreateBall
(add lines to deactivate other kickers here just as above but omit kicker 2)
End If
If B = 3 Then
Kicker3.CreateBall
(add lines to deactivate other kickers here just as above but omit kicker 3)
End If
If B = 4 Then
Kicker4.CreateBall
(add lines to deactivate other kickers here just as above but omit kicker 4)
End If
If B = 5 Then
Kicker5.CreateBall
(add lines to deactivate other kickers here just as above but omit kicker 5)
End If
If B = 6 Then
Kicker6.CreateBall
(add lines to deactivate other kickers here just as above but omit kicker 6)
End If
If B = 7 Then
Kicker7.CreateBall
(add lines to deactivate other kickers here just as above but omit kicker 7)
End If
If B = 8 Then
Kicker8.CreateBall
(add lines to deactivate other kickers here just as above but omit kicker 8 )
End If
If B = 9 Then
Kicker9.CreateBall
(add lines to deactivate other kickers here just as above but omit kicker 9)
End If
If B = 10 Then
Kicker10.CreateBall
(add lines to deactivate other kickers here just as above but omit kicker 10)
End If
End Sub

Each time you start a game, have the above randomize the ball in a specific kicker :) and the other kickers are NOT ACTIVE.

Hope this helps you :) It's VERY simple coding and simple enough to understand. Nothing fancy. I know that you know some of this stuff, but thought this may help you.

If I can be of further help, you know my email. I'll answer as soon as I can :)

Will aka druadic

Int is the integer and Rnd is the rounded off number it is equal to. The integer is only allowed to be rounded off (Rnd) to the number assigned to the integer. So when the number is picked randomly, the integer is allowed to only go to the number that it is rounded (Rnd) off to which in the above case is 10. This number can be changed to go lower or higher depending on what you need it for :)
 
Last edited:

tiltjlp

PN co-founder
Thanks Will. I know about Randomize, but didn't realize it could be used for balls too. I'll give it a try & see how it works. And I will e-mail you if I run into any problems.
 

druadic

Pinball Wizard
John;

Of course when I first start a table and it needs something like this, I always start out just below the DIM array statments:

Sub Table1_Init()
(add whatever you want here to start or use)
Random (tells VP to go the Sub Random area at startup)
End Sub

OR

After your DIM statments just below on a separate line you can put:

Random

This tells VP to go right to the Sub Random area.

Either the above will allow the table to go to the Sub Random area and load immediately when the table starts. Of course you'll have to tell it once each time you start a new game when a keypress has been pressed.

Hope this helps :)

Will

Of course I've used both ways on my tables as I've learned how to use VP. Keeping a Table_Init() can keep things tidy but uses a little more lines. Otherwise use the other way :)
 

sleepy

Pinball Wizard
Site Supporters
You can use If/Then or Select Case statements.
Dim B

Select Case B 'Calls the Dim B and checks its value

Case 1 'Checks to see if B = 1. If B = 1 then
Kicker1.CreateBall

Case 2 'When B = 1 then B does not = 2, so Kicker2.CreateBall is cancelled
Kicker2.CreateBall

Case 3
Kicker3.CreateBall

End Select
In the line Select Case B, B is the name of the Dim being called by the program
and each Case (number or word) is then checked for the same value contained in Dim B.
Let's say that B = 1
When Case 1 is read by the program, it then checks for the same value in Dim B and when both match, then the command, Kicker1.CreateBall, is executed.
When the values do not match, for instance when B = 2 and Case 1 is being read by the program,
the values do not match and so the Case 1 command, Kicker1.CreateBall is then ignored.
As a side note, when Case 1 does not equal the Dim B, Case 1 is then = False, and this can also be used for other purposes.

Select Case means typing less code, which is why I use it.
 
Last edited:

druadic

Pinball Wizard
You can use If/Then or Select Case statements.


In the line Select Case B, B is the name of the Dim being called by the program
and each Case (number or word) is then checked for the same value contained in Dim B.
Let's say that B = 1
When Case 1 is read by the program, it then checks for the same value in Dim B and when both match, then the command, Kicker1.CreateBall, is executed.
When the values do not match, for instance when B = 2 and Case 1 is being read by the program,
the values do not match and so the Case 1 command, Kicker1.CreateBall is then ignored.
As a side note, when Case 1 does not equal the Dim B, Case 1 is then = False, and this can also be used for other purposes.

Select Case means typing less code, which is why I use it.
Clever! Never thought of this. Of course there are NUMEROUS ways to make any script in VP work to your liking :) I like this. Glad you brought that up! Thanks Sleepy!

Will

The above I told John to use, I know of another way to make it even shorter without what you typed here Sleepy. No matter, as long as it works, it works I say ;) Personally, I like it as simple and easy enough for me to keep track of everything.
 

sleepy

Pinball Wizard
Site Supporters
Oh, don't get me wrong.
I had a devil of a time understanding Select Case because I was misinterpreting the examples

Case 1
bla-bla

Case 2
bla-bla

as an enumeration of the method, like it was a line number instead of what it is, which is the search for a matching value of 1 or 2, etc. between the Dim and the Case, like arguing the Case for a match between the two.

That's why I'm sleepy, though there are other interpretations out there.
 

sleepy

Pinball Wizard
Site Supporters
About shorter methods, are you referring to loading the objects, Kickers, in an Array or using the Table > Collection Manager feature (the Collection Manager is an automated Array creator) and changing the name of the Collection to a short Dim name like B?
 

druadic

Pinball Wizard
About shorter methods, are you referring to loading the objects, Kickers, in an Array or using the Table > Collection Manager feature (the Collection Manager is an automated Array creator) and changing the name of the Collection to a short Dim name like B?
Either way sleepy. It would work. Also allowing ALL the kickers to be disabled at once BEFORE the randomization lines would kick in would shorten the scripting as well :)

w

LIKE THIS:

DIM B (at top of your script)

Sub Random
Kicker1.Active=False:Kicker2.Active=False:Kicker3.Active=False:Kicker4.Active=False:Kicker5.Active=False
Kicker6.Active=False:Kicker7.Active=False:Kicker8.Active=False:Kicker9.Active=False:Kicker10.Active=False
Randomize
B = Int(Rnd * 10) + 0
If B = 1 Then:Kicker1.CreateBall:End If
If B = 2 Then:Kicker2.CreateBall:End If
If B = 3 Then:Kicker3.CreateBall:End If
If B = 4 Then:Kicker4.CreateBall:End If
If B = 5 Then:Kicker5.CreateBall:End If
If B = 6 Then:Kicker6.CreateBall:End If
If B = 7 Then:Kicker7.CreateBall:End If
If B = 8 Then:Kicker8.CreateBall:End If
If B = 9 Then:Kicker9.CreateBall:End If
If B = 10 Then:Kicker10.CreateBall:End If
End Sub

:)

I wonder if this could be used:

DIM B (at top of your script)

Sub Random
Kicker1.Active=False:Kicker2.Active=False:Kicker3. Active=False:Kicker4.Active=False:Kicker5.Active=F alse
Kicker6.Active=False:Kicker7.Active=False:Kicker8. Active=False:Kicker9.Active=False:Kicker10.Active= False
Randomize
B = Int(Rnd * 10) + 0
Kicker(B).CreateBall <-----use this line instead of all the separate kicker createball lines????
End Sub

Maybe??? Takes the integer # and places it where the kicker is. That integer is the kicker number you want a ball to be placed in. The randomized number would be the kicker number! ???????
 
Last edited:

tiltjlp

PN co-founder
I'll probably use something like Will posted, because I don't understand Case at all. The odd thing is that I'll have 2 sets of kickers on the table, the ones for the random payout ball, and then the regular set for scoring the game. Of course there are more scoring kicker than there will be payout kickers. Should be an interesting game to make, but I have so many projects I'm working on now, it may take a while to finish it.
 
Top