Pinball Nirvana Home Page

Go Back   Pinball Nirvana Forums > VP/VPM Help and Support > VP/VPM General Information and First Aid Station

VP/VPM General Information and First Aid Station Request Help about Visual Pinball or Visual PinMAME.

Reply
 
Thread Tools Search this Thread
  #1  
Old 11-18-2019, 08:34 PM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Question add-a-ball script ? help

voici la table que j'utilise toujours comme base de départ .
j'aimerai ajouter un add-a-ball.


exemple 1 trigger et 2 kickers.
après 3 passages sur le trigger les 2 kickers relâchent 1 bille chacun.


here is the table I always use as a starting point.
I would like to add an add-a-ball.

example 1 trigger and 2 kickers.
after 3 passes on the trigger the 2 kickers release 1 ball each.





dim a


sub trigger1_hit()
a=a+1
if a=3 then
kicker1.createball:kicker1.kick 170,10
kicker2.createball:kicker2.kick 170,10
a=0
end if
end sub


comment programme t'on le add-a-ball pour que le décompte de billes soit correct ?
J'aimerai aussi qu'il n'y ait pas plus de 5 billes sur la PF.
Si quelqu'un pouvez insérer le code avec le script de table de départ...
merci.


how do you program add-a-ball so that the ball count is correct?
I would also like there to be no more than 5 balls on the PF.
If someone can insert the code with the starting table script ...
thank you.



my starting script (starter) :


Code:
Option Explicit 

Randomize


Dim Ball
Dim Balls
Dim Score
Dim ScoreToAdd
Dim InProgress: Inprogress=False
Dim Credits: Credits=0
Dim light
ball=0
balls=3
score=0

'**********KEYS DOWN**********

Sub Table1_KeyDown(ByVal keycode)

    If InProgress = True Then
    If keycode = LeftFlipperKey Then
        LeftFlipper.RotateToEnd
        PlaySound "flipperup"
    End If
    End If
    
    If InProgress = True Then
    If keycode = RightFlipperKey Then
        RightFlipper.RotateToEnd
        PlaySound "flipperup"
    End If
    End If

    If keycode = PlungerKey Then
        Plunger.PullBack
    End If
    
    If keycode = LeftTiltKey Then
        Nudge 90, 2
    End If
    
    If keycode = RightTiltKey Then
        Nudge 270, 2
    End If
    
    If keycode = CenterTiltKey Then
        Nudge 0, 2
    End If
    
    If keycode = AddCreditKey Then
         Credits=credits + 1
         CreditBox.Text=Credits
         If InProgress= False Then ScoreBox.Text = "Press Start"
         PlaySound "coin"
    End If
   
    If InProgress = False Then
    If Keycode = StartGameKey And Credits>0 Then  
        Credits=Credits-1
        CreditBox.Text=Credits
        NewGame     
        InProgress=True 
    End If
   End If
End Sub

'**********KEYS UP**********

Sub Table1_KeyUp(ByVal keycode)

    If keycode = PlungerKey Then
        Plunger.Fire
        PlaySound "plunger"
    End If
    
    If InProgress = True Then
    If keycode = LeftFlipperKey Then
        LeftFlipper.RotateToStart
        PlaySound "flipperdown"
    End If
    
    If keycode = RightFlipperKey Then
        RightFlipper.RotateToStart
        PlaySound "flipperdown"
    End If
    End If
End Sub

'**********NEW GAME**********

Sub NewGame
     InProgress=True
     DrainTimer.Interval=4000
     DrainTimer.Enabled = True
    ScoreBox.Text=""
    Score=0
    Ball=0
    BallBox.Text=Ball
    ScoreBox.Text=Score
    TextBox2.Text = "BALL"
End Sub




'**********SCORE**********

Sub AddScore(ScoreToAdd)
     Score=Score+ScoreToAdd
    ScoreBox.Text=Score    
End Sub

'**********TABLE INIT**********

Sub Table1_Init()
    Randomize
    TextBox2.Text = "BALL"
    BallBox.Text = ball
    Ball=0
    Balls=3
    score=0
    ScoreBox.Text = "Insert Coin"
End Sub

'**********DRAIN**********

Sub Drain_Hit()
     Drain.DestroyBall
     If Ball < Balls Then   ' Is ball played less than total Balls or is the Game Over
         DrainTimer.Interval=3000
        DrainTimer.Enabled = True    ' If not, then let's play another ball, but let's set the timer for a delay
          Else        ' Sorry, but the game is now over
          GameOver    ' Go to game over to finish up
        End If 
End Sub

Sub DrainTimer_Timer()
    DrainTimer.Enabled = False    ' When timer runs out we will do the stuff below
    Kicker1.CreateBall
    Kicker1.Kick 90,10
    PlaySound "ballrel"
    Ball = Ball + 1
    BallBox.Text=Ball
End Sub


'**********GAME OVER**********
Sub GameOver
        LeftFlipper.RotateToStart
        RightFlipper.RotateToStart
    TextBox2.Text = "BALL"
    BallBox.Text = 0
    InProgress=False
    ScoreBox.Text="Game Over"
End Sub



'****************RULES*****************

Sub Bumper001_hit()
addscore 1000
End Sub

Sub Bumper002_hit()
addscore 1000
End Sub

Sub Bumper003_hit()
addscore 1000
End Sub
Reply With Quote
  #2  
Old 11-22-2019, 02:28 PM
druadic's Avatar
druadic druadic is offline
Pinball Wizard
 

Join Date: Jun 2003
Posts: 884
Credits: 129,126.75
Thanks: 162
Thanked 109 Times in 93 Posts
Rep Power: 26
druadic will become famous soon enoughdruadic will become famous soon enough
Default

By using the proper variable in a DIM, you can manipulate those. I always use BALLS = BALLS (+1 or -1) depending on how you're using this statement and if you're counting up or down using them. Or you can even use the BIP = 0 or BIP = 1 (BIP = Ball In Play, 0 = none, 1 = 1 ball on the play field).


You can place this just about anywhere in your table and it will work. Just make sure if you're showing the correct balls on the screen you don't forget to add the proper text box statements.
__________________
RETIRED from VP on 2014.

UNRETIRED from VP as of 07/12/2019.
Reply With Quote
The Following User Says Thank You to druadic For This Useful Post:
Ike Savage (11-22-2019)
  #3  
Old 11-23-2019, 07:25 AM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Default

ok but how to block the creation of ball (plunger), as long as there is balls on the pf ?
Reply With Quote
  #4  
Old 11-23-2019, 11:29 AM
druadic's Avatar
druadic druadic is offline
Pinball Wizard
 

Join Date: Jun 2003
Posts: 884
Credits: 129,126.75
Thanks: 162
Thanked 109 Times in 93 Posts
Rep Power: 26
druadic will become famous soon enoughdruadic will become famous soon enough
Default

Dim Balls, BIP

Sub Table1_KeyDown(ByVal keycode)

Sub If keycode = plungerkey Then
Plunger.Pullback
PlaySound "plunger"
If keycode = plungerkey and BIP = 0 Then
Balls = Balls + 1:BIP = 1:Plunger.CreateBall:Plunger.Kick 90,7
End If
End Sub


Using the above, we call the plungerkey usage by the player. No matter when the player uses the plunger key, a sound can be made. If the player uses the plunger and BIP = 0 then the know another ball can be called up, so If keycode = plungerkey and BIP = 0 then allows a single ball into play and counts another ball using the Balls = Balls + 1. Everything using the statements above can be controlled anywhere within the script, and the more well placed the more realistic a table can be made.


So, the above shows that if BIP = 0 means placed at any drain or hole or placement within the table and is called, will allow the plunger to bring up another ball, hence BIP = 0. If BIP = 1 then that would mean a ball is currently in play and the plunger refuses to allow another onto the playfield because BIP = 1. But, the plunger still allows a sound to be played, blocking another ball to be made.


The Balls = Balls + 1 statement counts a ball one at a time to be counted if BIP = 0 ONLY, otherwise it will not count one to your ball counter and will not allow a player another ball into the play unless BIP = 1.
So, once the ball is created, the BIP = 1 statement is called and the plunger can no longer create ball until BIP = 0 once again which is called via the scripting.



There you go. ANY of the above statements can be called throughout the script at anytime for ball control.


Hope this helps.

PS: You may have to alter the plunger statement and place the above into a keypress, getting rid of the basic plunger statement within VP. I do this every time since it is useless and just used as a type of "crutch" for beginners to see how a ball is called to the plunger.


PPS: I realize all these DIM array statements and calls can be a bit confusing and daunting at first, but as you use VP you'll realize you just have to keep track of them and you'll get used to it quite quick.



Quote:
Originally Posted by fastdraw View Post
ok but how to block the creation of ball (plunger), as long as there is balls on the pf ?
__________________
RETIRED from VP on 2014.

UNRETIRED from VP as of 07/12/2019.

Last edited by druadic; 11-23-2019 at 11:46 AM.
Reply With Quote
The Following User Says Thank You to druadic For This Useful Post:
fastdraw (11-23-2019)
  #5  
Old 11-23-2019, 04:53 PM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Default

thank you Druadic , it work



but is the variable A is really re-initialized to zero. tr2 and tr3 = triggers


Code:
'*********ADD-A-BALL  +2 balls*************

dim a


sub tr2_hit()
a=a+1
if a=3 then
kicker2.createball:kicker2.kick 170,10
kicker3.createball:kicker3.kick 170,10
a=0
end if
end sub

sub tr3_hit()
a=a+1
if a=3 then
kicker2.createball:kicker2.kick 170,10
kicker3.createball:kicker3.kick 170,10
a=0
end if
  end sub
because the 2 kickers create lots of other balls...
how to limit the number of balls on the pf to 3.


should the triggers be disabled while there is more than 1 ball on the pf ?



lower the table
Attached Files
File Type: rar template.rar (4.50 MB, 2 views)

Last edited by fastdraw; 11-23-2019 at 05:12 PM.
Reply With Quote
The Following User Says Thank You to fastdraw For This Useful Post:
druadic (11-23-2019)
  #6  
Old 11-23-2019, 05:35 PM
druadic's Avatar
druadic druadic is offline
Pinball Wizard
 

Join Date: Jun 2003
Posts: 884
Credits: 129,126.75
Thanks: 162
Thanked 109 Times in 93 Posts
Rep Power: 26
druadic will become famous soon enoughdruadic will become famous soon enough
Default

The best thing to do is to mess around with the variables BUT, if you can control the ball count using triggers (which I have also done) then turn them off. You can always turn them back on in the script.


By using the enabled = false routine you can turn them off and by using the true statement you can turn them back on ANYTIME.


The one thing you have to watch is that visual pinball is famous turning on a trigger numerous times even though the ball passes over it once. Just FYI!


Kickers also are ALWAYS ENABLED unless you turn them off as well OR in the main visual pinball program, leave them unchecked for enabled. You can still use the kicker but no ball will be able to land into it!





Glad it worked for you and hope you're finding programming in visual basic a bit of fun. Some of it can be a challenge but overall I find it to be a puzzle I enjoy to figure out.


__________________
RETIRED from VP on 2014.

UNRETIRED from VP as of 07/12/2019.

Last edited by druadic; 11-23-2019 at 05:40 PM.
Reply With Quote
  #7  
Old 11-23-2019, 06:38 PM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Default

sorry, I thought it was working
but no. my plunger is timed at 3s, which is why I thought the plunger was neutralized.....so I still have the problem of ball creation during add-a-ball...
Reply With Quote
  #8  
Old 11-23-2019, 07:36 PM
druadic's Avatar
druadic druadic is offline
Pinball Wizard
 

Join Date: Jun 2003
Posts: 884
Credits: 129,126.75
Thanks: 162
Thanked 109 Times in 93 Posts
Rep Power: 26
druadic will become famous soon enoughdruadic will become famous soon enough
Default

The best way to add balls is via kicker to keep track of the BIP statements, using the kicker to create a new ball. Of course you can use the plunger but it requires more fiddling around with the scripting which I avoid usually like the plague. You can also use triggers to create a ball from a kicker, use the BIP = BIP + 1 statement, then kick a ball into the playfield.


Using a kicker, create a ball, add the BIP = BIP + 1 statement then kick the ball into the playfield or area you wish to add the ball.


Not much else really to do unless you're fiddling with tons of array statements.



Quote:
Originally Posted by fastdraw View Post
sorry, I thought it was working
but no. my plunger is timed at 3s, which is why I thought the plunger was neutralized.....so I still have the problem of ball creation during add-a-ball...
__________________
RETIRED from VP on 2014.

UNRETIRED from VP as of 07/12/2019.
Reply With Quote
The Following User Says Thank You to druadic For This Useful Post:
fastdraw (11-24-2019)
  #9  
Old 11-24-2019, 05:29 AM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Default

thank you for your patience
I'm going to try.


on my template , i have balls and ball. balls :number of balls per game and ball : number of ball on the playfield.


so ball = BIP (for you) ?
Reply With Quote
  #10  
Old 11-24-2019, 05:46 AM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Default

Quote:
Originally Posted by druadic View Post
. Of course you can use the plunger .

oh no!!!
my plunger, creates only the balls of the game (3 or 5) of start.
it's already complicated enough like this....


I will use the same notation (bip),otherwise it creates confusion.
at first, I thought that bip was a pre-coded script. ready to use.

Last edited by fastdraw; 11-24-2019 at 05:58 AM.
Reply With Quote
  #11  
Old 11-25-2019, 12:41 AM
druadic's Avatar
druadic druadic is offline
Pinball Wizard
 

Join Date: Jun 2003
Posts: 884
Credits: 129,126.75
Thanks: 162
Thanked 109 Times in 93 Posts
Rep Power: 26
druadic will become famous soon enoughdruadic will become famous soon enough
Default

I use the DIM array statement of BIP for "balls in play" and BALLS for balls during play. I also use other statements if I have one or more balls that are "live" on the play field to keep track of each and every ball during a game, I use another DIM array statement such as BL to keep track of those after a game and when they drain.


Yes, this can be confusing and trust me sometimes I get over my head with them because if you don't keep track of them you'll know it. Sorry for the confusion.


DIM array statements can be used anyway you wish by using a non command under the visual basic script. You can use whatever you want actually, I just find using BIP a bit easier to deal with. Sorry about that, I thought you may have understood me but it's just using DIM array statements that can make the entire process of table making much easier and you can keep track of everything all at once.



Quote:
Originally Posted by fastdraw View Post
oh no!!!
my plunger, creates only the balls of the game (3 or 5) of start.
it's already complicated enough like this....


I will use the same notation (bip),otherwise it creates confusion.
at first, I thought that bip was a pre-coded script. ready to use.
__________________
RETIRED from VP on 2014.

UNRETIRED from VP as of 07/12/2019.
Reply With Quote
  #12  
Old 11-26-2019, 12:18 PM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Default

it's ok now

well understood the process


thank you druadic
Reply With Quote
The Following User Says Thank You to fastdraw For This Useful Post:
druadic (11-29-2019)
  #13  
Old 11-29-2019, 03:38 PM
druadic's Avatar
druadic druadic is offline
Pinball Wizard
 

Join Date: Jun 2003
Posts: 884
Credits: 129,126.75
Thanks: 162
Thanked 109 Times in 93 Posts
Rep Power: 26
druadic will become famous soon enoughdruadic will become famous soon enough
Default

Glad you figured it out. It can take time to juggle all the DIM arrays you have but in the long run it can really solve many problems when you're keeping track of things.
__________________
RETIRED from VP on 2014.

UNRETIRED from VP as of 07/12/2019.
Reply With Quote
  #14  
Old 11-29-2019, 04:25 PM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Default

en résumé drain_hit() : bip=bip-1
kicker.createball : bib=bip=bip+1
kicker.destroyball : bip=bip-1


if kicker1_destroyball : kicker2.createball ?? çà annule le bip ou bien il faut mettre bip=bip-1:bip=bip+1 ??!!!


j'ai posté une table vpx houdini , j'ai suivi la procédure et pourtant le pinball s'emballe , tu pourrais jeter un œil , pour voir ce qu'il ne va pas ?


trad. google :
I posted a vpx houdini table, I followed the procedure and yet the pinball is racing, you could take a look, to see what's wrong?


would you like to be my table coder (script basic with 3/4 multiball) because modern table

Last edited by fastdraw; 11-30-2019 at 10:57 AM.
Reply With Quote
  #15  
Old 11-30-2019, 06:55 AM
druadic's Avatar
druadic druadic is offline
Pinball Wizard
 

Join Date: Jun 2003
Posts: 884
Credits: 129,126.75
Thanks: 162
Thanked 109 Times in 93 Posts
Rep Power: 26
druadic will become famous soon enoughdruadic will become famous soon enough
Default

First off, I can see via the screenshot you have BIP = - 1 so somewhere in your code you are going below the normal zero (or 0).


In your code somewhere you're counting BIP = BIP - 1 TWICE OR you're missing this code in the starting point of your table during initialization. I've had this problem a LOT and it's not fun to find the issue, but I'll download the table and check it out. Who knows, it may be just a basic line or added piece of code that could be been over missed. I've done this. I usually only use BIP when the ball is kicked out to the plunger and nowhere else unless you have multiball which you do have. Your BIP would not go above the amount of balls on the play field that are moving and live.


As for a coder, I'm really not great at it at all so I keep to the flipperless tables that require very little amounts of it but I can always look at your tables. Not an issue BUT - I can talk with a few folks in the VP author world who would more than likely would be your table coder. Let me know.


Like I said, I'll look at your script and see what is up.


As for the ball "racing" I have no idea what that is but if you could explain a little more in detail I will look into it.
__________________
RETIRED from VP on 2014.

UNRETIRED from VP as of 07/12/2019.

Last edited by druadic; 11-30-2019 at 07:01 AM.
Reply With Quote
The Following User Says Thank You to druadic For This Useful Post:
fastdraw (11-30-2019)
  #16  
Old 11-30-2019, 10:37 AM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Default

euh best traduction google maybe pinball is racing ==> the pinball get carried away ))


and ok if you can talk with a few folks in the VP author world who would more than likely would be your table coder


bip -1 is magic , the magic houdini ))
Reply With Quote
  #17  
Old 12-06-2019, 09:14 PM
druadic's Avatar
druadic druadic is offline
Pinball Wizard
 

Join Date: Jun 2003
Posts: 884
Credits: 129,126.75
Thanks: 162
Thanked 109 Times in 93 Posts
Rep Power: 26
druadic will become famous soon enoughdruadic will become famous soon enough
Default

Sorry I have not responded as I'm on a bunch of pills for my health, but I TRIED to get this table to run but was bombarded with numerous "scripting" errors. I don't use VPM if this table uses it and I never have. If it does, please let me know. I can't even get the table to load so I must be doing something really wrong on my end.
__________________
RETIRED from VP on 2014.

UNRETIRED from VP as of 07/12/2019.
Reply With Quote
  #18  
Old 12-07-2019, 04:05 AM
fastdraw fastdraw is offline
Inserted Coin
 

Join Date: Dec 2015
Posts: 26
Credits: 848.26
Thanks: 11
Thanked 5 Times in 5 Posts
Rep Power: 0
fastdraw is on a distinguished road
Default

no vpm
only vpx 10.6
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:21 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Template-Modifications by TMS
Credits System provided by vBCredits II Deluxe (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Shoutbox provided by vBShout v6.2.15 (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.