Jump to content



Photo
* * * * * 1 votes

Alice In Wonderland (Original 2023) (WIP)

Original WIP work in progress VPX

  • Please log in to reply
100 replies to this topic

#101 Sir Random

Sir Random

    Enthusiast

  • Members
  • PipPipPip
  • 133 posts
  • Location:Ireland

  • Flag: Ireland

  • Favorite Pinball: Jubilee, Eight Ball, Super Mario Bros

Posted 13 November 2023 - 04:51 PM

thank you, it was a good start, but i modified it a bit:

I have a timer named MusicTimer set to 1000ms, that is disabled and will be enabled when the wizard mode starts.

 

Dim counter
counter = 0
 
Sub MusicTimer_Timer
    counter = (counter + 1000)
    Select Case counter
        Case 10000
            ' Do something at 10 seconds
            light032.State = 2
        Case 20000
            ' Do something at 20 seconds
            light032.State = 0
        Case 30000
            ' Stop the timer at 30 seconds
            MusicTimer.enabled = 0
            counter = 0
            scoretext.text = "timer stopped" 'for testing purposes
        Case Else
            ' Do nothing for other cases
    End Select
End Sub

 

This works, but maybe somebody can tell me if this isn't the best approach. By using the select case method i find it easier to specify exactly when i want events to happen. I am trying to create a light, flasher, and DOF show that will sync with the music for the final wizard mode. also by using Milliseconds in the script, i can fine tune the timing better

I use Select Case extensively for the timing of events. 

 

It might help you get a 'mental image' of the logic if you just use 1 as your counter increment. There's no need to use 1,000 as it's not about milliseconds, and it may end up confusing you.

 

Sub MusicTimer_Timer
    counter = (counter + 1)
    Select Case counter
        Case 10
            ' Do something at 10 seconds
            light032.State = 2
        Case 20
            ' Do something at 20 seconds
            light032.State = 0
        Case 30
            ' Stop the timer at 30 seconds
            MusicTimer.enabled = 0
            counter = 0
            scoretext.text = "timer stopped" 'for testing purposes
        Case Else
            ' Do nothing for other cases
    End Select
End Sub
 
If you want to be more precise with timing, you'll need to adjust your MusicTimer.Interval down to 100 or 10 (or even 1 ) and then adjust the 'counter' values accordingly. 
 
EDIT\
 
I use a slightly different control method for my MusicTimer, because there's no need to have a counter incrementing over and over (calling Timer every second) when you know the exact length of your music.
 
I use the Timer's interval to specify the gap between calls, so the Timer only gets called once per song:
 
Sub MusicTimer_Timer()
  CurrentMusicNum = CurrentMusicNum + 1
  Select Case CurrentMusicNum
    Case 1
      CurrentMusic = "XL5_Theme"
      MusicTimer.Interval = 123000
    Case 2
      CurrentMusic = "XL5_J90A"
      MusicTimer.Interval = 85000
    Case 3
      CurrentMusic = "XL5_ZeroG"
      MusicTimer.Interval = 134000
    Case 4
      CurrentMusic = "XL5_Jazz2"
      MusicTimer.Interval = 88500
    Case 5
      CurrentMusic = "XL5_ThemeInstr"
      MusicTimer.Interval = 68000
    Case 6
      CurrentMusic = "XL5_Incidental_1min"
      MusicTimer.Interval = 60000 
      CurrentMusicNum = 0
  End Select
  PlaySound CurrentMusic, 0.99
End Sub

 

 

This way, the Timer is only called 6 times in 10 minutes (instead of 600 times)

Also, you can stop whatever music is playing with this:

 

StopSound CurrentMusic

 

 

You can select a particular song number (x) with:

 

CurrentMusicNum = x-1  ' (x gets incremented in the Music sub, so I subtract 1 before calling)

MusicTimer_Timer


Edited by Sir Random, 14 November 2023 - 02:44 PM.






Also tagged with one or more of these keywords: Original, WIP, work in progress, VPX