Author Topic: Need a little help ...  (Read 6535 times)

0 Members and 1 Guest are viewing this topic.

Offline Les73gTx

  • Toddler
  • Newbie
  • *
  • Posts: 17
  • Country: us
  • Karma: +0/-0
Need a little help ...
« on: August 07, 2014, 10:22:53 AM »
Hello all,

I am attempting to do a mod conversion to cabinet of a table that was already converted to VP 9.xx desktop. I have got it all up and running for the rotation and removing the score board from the backdrop and the B2S is already available and working great. The game plays ok but is a 2009 release of a 1978 ss table, so it does not have any of the newer VP9.9 stuff or lighting.
 What I am trying to do now is add ball rolling sounds to the script. I got the Ball rolling table from VPF here http://www.vpforums.org/index.php?app=tutorials&article=135 and pasted the needed script to the table. I had to remove some of it as it made all the sounds go away. then I added a trigger to the plunger lane and I think I named it right, but I am getting an error that now says "variable undefined: Sound Timer" and that is where I am lost  ... if I comment that out I do not get the error anymore but I have no rolling sounds yet ....
 I am a hardware guy and have ZERO scripting skills and it really confuses me to the point that I give up. I am a hands on or a show me one time type of learner ... reading stuff just doesn't stick to me for some reason. I am not looking for someone to do it for me as I want to learn this but I need some help.
 I am asking here because I was able to make the rotation and other minor adjustments from the tutorials that I found here.
 Just a warning; when I look at a script all I see is bla bla bla this then bla bla that then sub bla bla then end.  :Banghead:  and  :Cussing:

 Thank you for you time.

Online Itchigo

  • Victory is mine!!
  • Administrator
  • Pinball Wizard
  • *****
  • Posts: 1,423
  • Country: us
  • Karma: +10/-0
Re: Need a little help ...
« Reply #1 on: August 07, 2014, 04:29:17 PM »
Variable is undefined is you have a variable that's not "Dimmed" somewhere, or there's an incomplete sub.

All coding should be in blocks called subroutines.

Name of the sub with no spaces( if you're going to use a variable do it between these brackets)
If Score was not dimmed you'd get variable is undefined "score".

Dim Score
Sub Addscore(Score)

Do this
Do this
Do that

End Sub

What I would do if I were you is take out all coding you added about the ball rolling and start over. Add your triggers. Then add this:

Sub Trigger1_Hit()
Playsound "Roll1"
End Sub

For this I'm assuming this is for Trigger1, so it has to be named Trigger1. Do the same thing for all triggers you add for ball rolling at the very bottom of the script. I'm also assuming your sound clip is named Roll1.

Now if you wanted the sound to play when the ball LEAVES the trigger then do this:

Sub Trigger1_UnHit()     'Note UNHIT
Playsound "Roll1"
End Sub

That's good in a plungerlane.

Note: Adding at the bottom of the script isn't always the best way, but as long as you don't cut into another sub, it won't hurt you. Plus it's easy to find. It really doesn't slow vp much to have to look all over, people mainly keep things together for organization. Being SS the roms are doing most of the work for you. Doing it the way I showed you bypasses the roms, and it's easier to understand.

Hope that helps.
« Last Edit: August 07, 2014, 04:31:38 PM by Itchigo »
Tremble in fear! Behold my Bankai!


Offline Les73gTx

  • Toddler
  • Newbie
  • *
  • Posts: 17
  • Country: us
  • Karma: +0/-0
Re: Need a little help ...
« Reply #2 on: August 08, 2014, 01:15:54 AM »
I will have some more time to look at this again this weekend ... thank you Itchigo ... I do understand what you are saying so that will set me in the right direction and that is what I needed.
 The more I look at and make small changes and see the results the more I am understanding .... just going to take some time, time that I need to find....

Offline Les73gTx

  • Toddler
  • Newbie
  • *
  • Posts: 17
  • Country: us
  • Karma: +0/-0
Re: Need a little help ...
« Reply #3 on: August 08, 2014, 01:22:36 PM »
 I found some time today while the little ones are sleeping to play with this.
 Your routine works to play a sound that I have assigned to "roll1" and that is fine. The problem with that is the short sound byte does not really follow the ball and runs out and stops before the ball has another chance to hit another trigger unless I put triggers all over the table. The other Ball Rolling Table that I linked to is much more than just a simple sound file playing or not playing, and I would like to use that but I still have the same error going on.
'Ball-assignment
Sub SoundTrigger1_Hit                              'to be placed in the plunger lane, add similiar Triggers to all spots balls will be created (VUKs, holes etc.)
   Set SoundBall = Activeball
   SoundTimer.enabled = 1
   Flying = 1
   OnRamp = 1
   WireRamp = 1
End Sub

 It is that line in red that is giving me the trouble and error and I suspect it has something to do with the table script already there ... something is missing ???

Online Itchigo

  • Victory is mine!!
  • Administrator
  • Pinball Wizard
  • *****
  • Posts: 1,423
  • Country: us
  • Karma: +10/-0
Re: Need a little help ...
« Reply #4 on: August 08, 2014, 08:25:11 PM »
Soundtimer.Enabled is correct. That's the correct call to turn on a timer.

All your roll triggers should not be controlled by VPM. They should be scripted individually like that example.

For a short wav sound I'd either edit the sound clip, or get another one. But beware. Too many doesn't sound right either. Sounds like the ball is rolling and it drowns out other sounds, or takes your focus away from the game.

I usually use about 5 or 6 custom triggers in certain areas for ball rolling.

If you want to pm it to me, I'll take a look. :Smile:
Tremble in fear! Behold my Bankai!


Offline Les73gTx

  • Toddler
  • Newbie
  • *
  • Posts: 17
  • Country: us
  • Karma: +0/-0
Re: Need a little help ...
« Reply #5 on: August 09, 2014, 11:32:12 PM »
I have added triggers in 4 spots around the table and it seems to work very well actually... thank you for the advice and help. :Cool: I took some ball rolling sounds from a few other tables so I had a mix of short and long ones and I was able to get most of the table covered in the Fast areas with the appropriate wav file.  There seemed to be a lot of sounds missing from this table but I have added most of the ones back in using triggers ... I have one other question for you ... if I wanted to put a sound on a rubber post instead of putting a trigger down can I just name the post I want to have a sound?

 example .. lets call it post1

 Sub post1_Hit()
   PlaySound "rubberPostHit"
  End Sub

 I guess the big question is ... Is there a resource guide on how to write proper commands in VP editor script and not cause errors for dummies? :Study:

Online Itchigo

  • Victory is mine!!
  • Administrator
  • Pinball Wizard
  • *****
  • Posts: 1,423
  • Country: us
  • Karma: +10/-0
Re: Need a little help ...
« Reply #6 on: August 10, 2014, 03:41:29 AM »
For posts: What I do is make a wall that extends just beyond the post. Make that wall a little bigger than the post so the ball will hit this wall and NOT the post. Make this wall not visable (uncheck). Then call it as below. The reason for this is posts are usually made of MANY objects, it's really hard to have a hit event on an object with 100 parts.

I remember downloading some stuff from vpf in terms of guides, but honestly, I'm self taught- including windows. The best way I learned was taking apart old vp8 's (not vpm).

I'll give you some basic commands:

Slingshots:   Slingshot1_Slingshot()
Walls, Posts, etc:  Wall1_Hit()   NOTE: Collideable and has hit event have to be checked.
Triggers:  Trigger1_Hit()

Here's how to use the If statements:


Sub Trigger1_Hit()
If Tilt=False Then-------------------------------------------------------------------------------

If Light1.State=1 Then ---------------------
Addscore 100
Playsound "Bell100------------------------
Else
Addscore 10----------------------------------------------
Playsound "Bell10"
End If---------------------------------------------------

End If-----------------------------------------------------------------------------------------
End Sub


Now here's how to understand this:

Trigger1 has been hit.
If Light1 Is on Score 100 and the sound, if it isn't score 10 and the sound.
This will only happen if we are not tilted.


Think of it this way. Everything between If and End If is a rule. But there can be rules between rules and I showed above.

Download my table templates from here:
http://www.pinballnirvana.com/index.php?name=UpDownload&req=viewsdownload&sid=6&min=20&orderby=titleA&show=20

They will help a lot. The one's I have here are newer and more complex.

Tremble in fear! Behold my Bankai!


Offline Les73gTx

  • Toddler
  • Newbie
  • *
  • Posts: 17
  • Country: us
  • Karma: +0/-0
Re: Need a little help ...
« Reply #7 on: August 10, 2014, 06:35:56 PM »
Ok that is awesome ....I did the target before the post on a couple of these sound additions along with the other tip you gave me I believe I have something that I am proud of and want to share with the community
 Thanks so much for your help Itchigo!

Online Itchigo

  • Victory is mine!!
  • Administrator
  • Pinball Wizard
  • *****
  • Posts: 1,423
  • Country: us
  • Karma: +10/-0
Re: Need a little help ...
« Reply #8 on: August 10, 2014, 07:13:24 PM »
Awesome! Anytime. Maybe I should start a script page of all the basic commands? But most of them are in the templates already too.
Tremble in fear! Behold my Bankai!