playing random music in fp

colinprout

Inserted Coin
Joined
Aug 17, 2011
Messages
2
Reaction score
0
Points
2
Favorite Pinball Machine
8balldeluxe
hello everyone,
I'm completely new to srcipting and was wondering if anyone could tell me how to play random tunes at the start of each ball.

cheers Colin
 
I would love to know as well if anyone can help. Or play certain music/sound files at any point during game????

Thanks in advance,
Wil
 
Hello Wil,

I gave up with future pinball due to too much crashing and games not working once they've been saved. I went back to visual pinball and worked out how to play random songs at the start of each ball. You may be able to adapt it for your own use in future pinball.

I added a invisible trigger just before the gate at the end of the plunger lane, calling it 'playtrack'. Next is the code to start a song playing with notes in square brackets to help:-

Sub playtrack_hit() [ball hits trigger]

Dim RndSound

RndSound = Rnd(1)*5 [ picks a random number between 0 and 5]
Select Case (Int(RndSound)) [This is the bit that chooses what to do with whatever number is picked]

Case 0: PlaySound "Trackname"[replace trackname with the song title]
Case 1: PlaySound "Trackname"
Case 2: PlaySound "Trackname"
Case 3: PlaySound "Trackname"
Case 4: PlaySound "Trackname"
Case 5: PlaySound "Trackname"
End Select
End Sub

Add another trigger at the drain and call it stopsongs, then code as follows

sub stopsongs_hit()

stopsound "0"
stopsound "1"
stopsound "2"
stopsound "3"
stopsound "4"
stopsound "5"
end sub

Probably not the best or right way to do it but it works, a random song plays at the start of each ball and stops when the ball is lost. I don't know how to play songs at any point during the game because you have to have an event to start the track playing.

Hope this helps
Colin.
 
Hello Wil,

I gave up with future pinball due to too much crashing and games not working once they've been saved. I went back to visual pinball and worked out how to play random songs at the start of each ball. You may be able to adapt it for your own use in future pinball.

I added a invisible trigger just before the gate at the end of the plunger lane, calling it 'playtrack'. Next is the code to start a song playing with notes in square brackets to help:-

Sub playtrack_hit() [ball hits trigger]

Dim RndSound

RndSound = Rnd(1)*5 [ picks a random number between 0 and 5]
Select Case (Int(RndSound)) [This is the bit that chooses what to do with whatever number is picked]

Case 0: PlaySound "Trackname"[replace trackname with the song title]
Case 1: PlaySound "Trackname"
Case 2: PlaySound "Trackname"
Case 3: PlaySound "Trackname"
Case 4: PlaySound "Trackname"
Case 5: PlaySound "Trackname"
End Select
End Sub

Add another trigger at the drain and call it stopsongs, then code as follows

sub stopsongs_hit()

stopsound "0"
stopsound "1"
stopsound "2"
stopsound "3"
stopsound "4"
stopsound "5"
end sub

Probably not the best or right way to do it but it works, a random song plays at the start of each ball and stops when the ball is lost. I don't know how to play songs at any point during the game because you have to have an event to start the track playing.

Hope this helps
Colin.


Thank you, Ill give this a go!
 
Forum activity
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
      Chat Bot Mibs Chat Bot Mibs: GotBrawndo is our newest member. Welcome!
      Back
      Top