I've been working on a table recently, and the general layout is almost to my satisfaction. As such, I have started to dive into coding. I've taken 3 classes for this topic in college (two for Visual Basic, one for C++) and yet despite coming out with high grades, I can't really write code to save someone's life.
So I've tried to find what I like in other machines, and emulate and modify the examples I find in their scripts for use as needed in my own project. My current problem lies in a randomly played sound effect when I lose a ball in the sink.
Here's the random number generator:
function RandomNumber(ByVal max) RandomNumber = Int(max * Rnd+1) end function
Here's the event that keeps giving me problems:
Sub EndOfBall() Dim BonusDelayTime 'AddDebugText "EndOfBall" Select Case RandomNumber(2) Case 1: PlaySound 3, "vo_HeSucked", TRUE, SoundVolume Case 2: PlaySound 3, "vo_KeepUp", TRUE, SoundVolume End Select
I get the error message Wrong Number of Arguments or Invalid Property Assignment: 'PlaySound'
If I remove: ,TRUE, SoundVolume
Then it results in the message Type Mismatch: 'PlaySound'
If I remove the 3 after PlaySound, then it tells me Argument not Optional: 'PlaySound'
I don't understand what is going on here, or what I'm doing wrong. The initial format, PlaySound 3, "vo_HeSucked", TRUE, SoundVolume has worked everywhere else in the code. Is it a problem with my random number generator?





Top


Contributor








are all trademarks of VPFORUMS.