| 09-07-2007, 05:41 AM | #1 |
I have a JASS trigger that works just how can I make this wait so it playes the next sound right after the other one finished? Basically: I have these lines in a function - call start(1,udg_MIDI_Sound,100,0.818,0) call start(1,udg_MIDI_Sound,100,0.545,0) I want the 2nd line to wait for the first line to finish before it starts :/ JASS:function Stoptimer1 takes nothing returns nothing local timer T = GetExpiredTimer() call PauseTimer(T) call ReleaseTimer(T) call StopSoundBJ( udg_Sound[1], false ) endfunction function Stoptimer2 takes nothing returns nothing local timer T = GetExpiredTimer() call PauseTimer(T) call ReleaseTimer(T) call StopSoundBJ( udg_Sound[2], false ) endfunction function Stoptimer3 takes nothing returns nothing local timer T = GetExpiredTimer() call PauseTimer(T) call ReleaseTimer(T) call StopSoundBJ( udg_Sound[3], false ) endfunction function Stoptimer4 takes nothing returns nothing local timer T = GetExpiredTimer() call PauseTimer(T) call ReleaseTimer(T) call StopSoundBJ( udg_Sound[4], false ) endfunction function Stoptimer5 takes nothing returns nothing local timer T = GetExpiredTimer() call PauseTimer(T) call ReleaseTimer(T) call StopSoundBJ( udg_Sound[5], false ) endfunction function start takes integer track, sound S, real V, real time, real pitch returns nothing local timer T = NewTimer() call PlaySoundBJ(S) set udg_Sound[track] = S if track == 1 then call TimerStart(T, time, true, function Stoptimer1) elseif track == 2then call TimerStart(T, time, true, function Stoptimer2) elseif track == 3then call TimerStart(T, time, true, function Stoptimer3) elseif track == 4then call TimerStart(T, time, true, function Stoptimer4) elseif track == 5then call TimerStart(T, time, true, function Stoptimer5) endif set T = null endfunction function Track_1 takes nothing returns nothing call start(1,udg_MIDI_Sound,100,1.090,0) call start(1,udg_MIDI_Sound,100,2.732,0) call start(1,udg_MIDI_Sound,100,0.818,0) call start(1,udg_MIDI_Sound,100,0.545,0) call start(1,udg_MIDI_Sound,100,2.730,0) call start(1,udg_MIDI_Sound,100,0.545,0) call start(1,udg_MIDI_Sound,100,1.090,0) call start(1,udg_MIDI_Sound,100,2.730,0) call start(1,udg_MIDI_Sound,100,0.545,0) call start(1,udg_MIDI_Sound,100,1.090,0) call start(1,udg_MIDI_Sound,100,2.730,0) call start(1,udg_MIDI_Sound,100,1.090,0) call start(1,udg_MIDI_Sound,100,0.545,0) call start(1,udg_MIDI_Sound,100,2.730,0) call start(1,udg_MIDI_Sound,100,1.090,0) call start(1,udg_MIDI_Sound,100,2.732,0) call start(1,udg_MIDI_Sound,100,1.090,0) call start(1,udg_MIDI_Sound,100,0.818,0) call start(1,udg_MIDI_Sound,100,2.730,0) call start(1,udg_MIDI_Sound,100,1.090,0) call start(1,udg_MIDI_Sound,100,0.818,0) call start(1,udg_MIDI_Sound,100,2.730,0) call start(1,udg_MIDI_Sound,100,1.636,0) call start(1,udg_MIDI_Sound,100,2.730,0) endfunction function Track_2 takes nothing returns nothing endfunction function Track_3 takes nothing returns nothing endfunction function Track_4 takes nothing returns nothing endfunction function Track_5 takes nothing returns nothing endfunction function Trig_Song_001_Actions takes nothing returns nothing call ExecuteFunc("Track_1") call ExecuteFunc("Track_2") call ExecuteFunc("Track_3") call ExecuteFunc("Track_4") call ExecuteFunc("Track_5") endfunction //=========================================================================== function InitTrig_Song_001 takes nothing returns nothing set gg_trg_Song_001 = CreateTrigger( ) call TriggerRegisterTimerEventSingle( gg_trg_Song_001, 5 ) call TriggerAddAction( gg_trg_Song_001, function Trig_Song_001_Actions ) endfunction //You will need to import the following notes for this song: // |
| 09-07-2007, 09:15 AM | #2 |
triggersleepaction... |
| 09-07-2007, 09:20 AM | #3 |
triggersleepaction is not accurate enough :/ I may need a wait under .1 also... |
| 09-07-2007, 11:27 AM | #4 |
Timers? Make a timer that runs for precisely the amount of time sound A runs, and make the timer call a function which makes sound B run. |
| 09-07-2007, 01:34 PM | #5 |
will never work too well since sounds keep being played when the game is paused, but timers/waits don't. |
| 09-07-2007, 04:07 PM | #6 |
I get that it may bug up when the game is paused but I don't see that being a big problem (only game I have ever seen paused really is Jurassic park so ppl can cheat) @darkwulfv how would that work I have thousands or sounds and length of the trigger has been a problem so I need to condense it as much as possible |
| 09-07-2007, 04:33 PM | #7 |
you can use struct to solve this. By storing the next song to each struct, to create a queue, and u just continue in the queue. |
| 09-07-2007, 04:47 PM | #8 |
<--- On a MAC... any ideas that I can use that don't require special programs? NOTE: I can live with a .01 sec or whatever delay between notes just it note A is playing when note B tries to start note B wont play at all... |
