- This topic has 3 replies, 3 voices, and was last updated 3 years, 10 months ago by Tom.
-
AuthorPosts
-
October 21, 2020 at 10:23 pm #205957
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 SubYou need to login in order to like this post: click here
October 21, 2020 at 11:35 pm #205959Can’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 FunctionThen instead, for your select case RndNum(1,6)
You need to login in order to like this post: click here
1 user thanked author for this post.
October 22, 2020 at 2:18 am #205965your 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 Subsee a table you like help me find the resources so that I can finish it
https://www.dropbox.com/sh/7qtake9whi5ium2/AAB4K4W78oMVlqSxTzKtGHTHa?dl=0see a table you like help me find the resources so that I can finish it
https://www.dropbox.com/sh/7qtake9whi5ium2/AAB4K4W78oMVlqSxTzKtGHTHa?dl=0You need to login in order to like this post: click here
1 user thanked author for this post.
October 22, 2020 at 8:35 am #205983That makes sense, i am learning slowly but thanks for the help
You need to login in order to like this post: click here
-
AuthorPosts
Forums are currently locked.