play random sound effect when object or drain hit

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #205957
    Tom
    Participant
      @armyaviation
      MemberContributor

      I am trying to play random sounds when the drain is hit.  i am guessing here, what is wrong with this ?

      Sub DestroyBall_Hit:
      me.DestroyBall
      playsound “doh”
      Select Case RandomNumber(6)
      Case 1: Playsound “doh”
      Case 2: Playsound “okly”
      Case 3: Playsound “mchocola”
      Case 4: Playsound “krlaugh”
      Case 5: Playsound “Mr-Burns-pish-posh”
      Case 6: Playsound “hi-dily-hey”
      End Select
      End Sub

      #205959
      Thalamus
      Moderator
        @thalamus
        ContributorMemberModerator

        Can’t say, because you don’t show us RandomNumber funciton (maybe it is built in to vbs – I haven’t looked that one up and then I’m wrong). Example code – you could add this

        Function RndNum(min, max)
        RndNum = Int(Rnd() * (max-min + 1) ) + min ' Sets a random number between min and max
        End Function

        Then instead, for your select case RndNum(1,6)

        1 user thanked author for this post.
        Tom
        #205965
        32assassin
        Participant
          @32assassin
          Member

          your playsound “doh”,   is  going to play the sound doh its not going to call your case statements

           

          Sub DestroyBall_Hit: me.DestroyBall :  PlayDohSound : End sub

          Sub PlayDohSound ()
          Select Case Int(Rnd*6)+1
          Case 1: Playsound “doh”
          Case 2: Playsound “okly”
          Case 3: Playsound “mchocola”
          Case 4: Playsound “krlaugh”
          Case 5: Playsound “Mr-Burns-pish-posh”
          Case 6: Playsound “hi-dily-hey”
          End Select
          End Sub

          see a table you like help me find the resources so that I can finish it
          https://www.dropbox.com/sh/7qtake9whi5ium2/AAB4K4W78oMVlqSxTzKtGHTHa?dl=0

          1 user thanked author for this post.
          Tom
          #205983
          Tom
          Participant
            @armyaviation
            MemberContributor

            That makes sense, i am learning slowly but thanks for the help

          Viewing 4 posts - 1 through 4 (of 4 total)

          Forums are currently locked.

          ©2024 VPinBall.com

          Log in with your credentials

          Forgot your details?