Jump to content



Photo
- - - - -

background music track selection


  • Please log in to reply
2 replies to this topic

#1 jimdigris

jimdigris

    Hobbyist

  • Members
  • PipPip
  • 21 posts

  • Flag: Australia

  • Favorite Pinball: Stern Dracula

Posted 07 December 2021 - 08:58 PM

I have a list of four different tracks I want to play when a new ball is ejected, I can make it randomly choose from those four but in my script once the track finishes it just stops unless I put "True" in the repeat parameter. What I want to do is make the script then choose another track from the case list, but not the same track unless all choices are exhausted (which would be an incredible length of ball achievement). How do I do that?

 

 
Dim BMusic
BMusic = Rnd(1) * 4 ' number of Cases
   Select Case (Int(BMusic))
Case 0: PlayMusic 5, "SWMetal1",False,.5 
Case 1: PlayMusic 5, "SWMetal2",False,.5 
Case 2: PlayMusic 5, "SWMetal3",False,.5 
Case 3: PlayMusic 5, "SWMetal4",False,.5 
 
End Select

Edited by jimdigris, 07 December 2021 - 10:37 PM.


#2 TerryRed

TerryRed

    Pinball Fan

  • Silver Supporter
  • 1,989 posts

  • Flag: Canada

  • Favorite Pinball: Too many to choose...

Contributor

Posted 07 December 2021 - 10:08 PM

Create a Timer called "Music_Timer" and when playing each music track set the Timer to the time of the music.

 

Dim BMusic
BMusic = Rnd(1) * 4 ' number of Cases

 

Sub Music_Timer_Expired

    Select Case (Int(BMusic))
        Case 0: PlayMusic 5, "SWMetal1",False,.5 : Music_Timer.set True, 2500
        Case 1: PlayMusic 5, "SWMetal2",False,.5 : Music_Timer.set True, 3500
        Case 2: PlayMusic 5, "SWMetal3",False,.5 : Music_Timer.set True, 1500
        Case 3: PlayMusic 5, "SWMetal4",False,.5 : Music_Timer.set True, 2200
    End Select

End Sub

 

 

Just change the time at the end of Music_Timer.set True, xxxx to the time of each music track.

 

Then you need to start the timer however you want to start the music.... and disable the timer if you end playing of that music.


Edited by TerryRed, 08 December 2021 - 03:37 AM.


#3 jimdigris

jimdigris

    Hobbyist

  • Members
  • PipPip
  • 21 posts

  • Flag: Australia

  • Favorite Pinball: Stern Dracula

Posted 08 December 2021 - 04:44 AM

thnx, that works for starting the next song