
-----------------------------------
Mephi
Wed Jun 18, 2003 9:37 pm

Ending a process
-----------------------------------
how do you stop a process?  im sure this has been posted before, but theres 14 pages of threads and theres no way im gonna search em all:P theres just too many! plz help

-----------------------------------
Blade
Wed Jun 18, 2003 9:40 pm


-----------------------------------
Syntax   A quitStatement is:
  quit 
 quote from the turing help file

-----------------------------------
AsianSensation
Wed Jun 18, 2003 9:46 pm


-----------------------------------
quit quits the entire program

however, return will work for processes and procedures

-----------------------------------
Mephi
Wed Jun 18, 2003 9:46 pm


-----------------------------------
duznt quit close the program?  or can u do like 
quit process
or sumthin

-----------------------------------
Blade
Wed Jun 18, 2003 9:48 pm


-----------------------------------
Description   The quit statement causes a program (or concurrent process) to fail. The failure (called an exception) either aborts the program (or process) or causes control to be passed to an exception handler. 

quote again from the turing help file... causes the program (or concurrent process) to fail.

-----------------------------------
Mephi
Wed Jun 18, 2003 9:50 pm


-----------------------------------
ok im confused heres my problem:
i have many music files, each is supposed to play at a specific time. it looks like this:
process playMusic (music : string)
    loop
        Music.PlayFile (music)
    end loop
end playMusic

to change music i use 

Music.SoundOff
    fork playMusic ("World.MID")
however, when that music ends, it goes back to the old one.  basically, it plays once then reverts bak to the old music. how do i stop this

-----------------------------------
AsianSensation
Wed Jun 18, 2003 9:51 pm


-----------------------------------
process Blah
blah blah blah
return
end Blah


this will work, return works the same way for processes as well as for procedures.

-----------------------------------
Mephi
Wed Jun 18, 2003 10:02 pm


-----------------------------------
but its looped music....so it cant end when its done...cuz itsa loop....and i want it to play more than once....just to end when i want the music to change

-----------------------------------
AsianSensation
Thu Jun 19, 2003 9:11 am


-----------------------------------
have a flag

var flagstop:=false

during the process:

process Music
loop
if flagstop=true then
return
end if
Music.PlayFile("music.mp3")
end loop


so when you want to exit the process sometimes in your program, turn flagstop true, and then it should stop.

-----------------------------------
Blade
Thu Jun 19, 2003 11:41 am


-----------------------------------
why dont you use Music.PlayFileStop? it stops the currently playing file..
process play1
    loop
        Music.PlayFile ("fileone")
    end loop
end play1

process play2
    loop
        Music.PlayFile ("filetwo")
    end loop
end play2

fork play1
%do yer stuff then when you get to the second sound
Music.PlayFileStop
fork play2

-----------------------------------
Mephi
Thu Jun 19, 2003 6:16 pm


-----------------------------------
does Music.PlayFileStop = Music.SoundOff? cuz i tried Music.SoundOff and it duznt work..still goes bak to the original music...

-----------------------------------
Andy
Thu Jun 19, 2003 9:02 pm


-----------------------------------
no u can't stop a music while its playing, i dun think

-----------------------------------
Mephi
Thu Jun 19, 2003 9:25 pm


-----------------------------------
Music.SoundOff stops music

-----------------------------------
AsianSensation
Thu Jun 19, 2003 10:09 pm


-----------------------------------
The Music.PlayFileStop procedure is used to to stop all music files currently playing.

straight from the help thingie

anyways, i agree with blade, use Music.PlayFileStop. have the flag triggers the Music.PlayFilewStop command.

-----------------------------------
AsianSensation
Thu Jun 19, 2003 10:12 pm


-----------------------------------
actually, don't need to use return at all, i was being stupid...

var flag := false

process BackMusic
    loop
        exit when flag = true
        Music.PlayFile ("music.mp3")
    end loop
end BackMusic

fork BackMusic

blah, blah, blah

flag := true
Music.PlayFileStop

-----------------------------------
Andy
Fri Jun 20, 2003 9:39 am


-----------------------------------
what's with the exit when flag= true? that's completely useless since that statement only get ran when the music finishes and replays itself

-----------------------------------
Mazer
Fri Jun 20, 2003 10:06 am


-----------------------------------
that's for when you music.playfilestop right before setting flag to true

-----------------------------------
AsianSensation
Mon Jun 23, 2003 9:58 pm


-----------------------------------
Music.PlayFile only stops all currently playing music, it doesnt prevent future playing of music. Having the exit when flag will ensure that the music doesn't start playing again.

-----------------------------------
Andy
Tue Jun 24, 2003 10:35 am


-----------------------------------
ooo ic, kk but that stops all the music from playing, is it possible to stop only one? without using Time.Elapse to check how long the other music have been playing then stop all the music then play the rest from where u left off?
