Author |
Message |
Mephi
|
Posted: Wed Jun 18, 2003 9:37 pm Post subject: 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 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Blade
|
Posted: Wed Jun 18, 2003 9:40 pm Post subject: (No subject) |
|
|
Quote: Syntax A quitStatement is:
quit [ guiltyParty ] [ : quitReason ]
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.
Example In the inputLines procedure, halt the program if end of file is encountered before the string "stop" is read. Note that a return statement in the procedure would terminate the procedure but not the entire program.
var line : array 1 .. 50 of string
procedure inputLines
var i : int := 0
loop
if eof then
put "Missing 'stop' in input"
quit % Halt entire program
end if
i := i + 1
get line ( i )
exit when line ( i ) = "stop"
end loop
end inputLines
inputLines
quote from the turing help file |
|
|
|
|
|
AsianSensation
|
Posted: Wed Jun 18, 2003 9:46 pm Post subject: (No subject) |
|
|
quit quits the entire program
however, return will work for processes and procedures |
|
|
|
|
|
Mephi
|
Posted: Wed Jun 18, 2003 9:46 pm Post subject: (No subject) |
|
|
duznt quit close the program? or can u do like
quit process
or sumthin |
|
|
|
|
|
Blade
|
Posted: Wed Jun 18, 2003 9:48 pm Post subject: (No subject) |
|
|
Quote: 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
|
Posted: Wed Jun 18, 2003 9:50 pm Post subject: (No subject) |
|
|
ok im confused heres my problem:
i have many music files, each is supposed to play at a specific time. it looks like this:
code: | process playMusic (music : string)
loop
Music.PlayFile (music)
end loop
end playMusic |
to change music i use
code: | 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
|
Posted: Wed Jun 18, 2003 9:51 pm Post subject: (No subject) |
|
|
code: | process Blah
blah blah blah
return
end Blah
|
this will work, return works the same way for processes as well as for procedures. |
|
|
|
|
|
Mephi
|
Posted: Wed Jun 18, 2003 10:02 pm Post subject: (No subject) |
|
|
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 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
AsianSensation
|
Posted: Thu Jun 19, 2003 9:11 am Post subject: (No subject) |
|
|
have a flag
code: |
var flagstop:=false
|
during the process:
code: | 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
|
Posted: Thu Jun 19, 2003 11:41 am Post subject: (No subject) |
|
|
why dont you use Music.PlayFileStop? it stops the currently playing file..
code: | 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
|
Posted: Thu Jun 19, 2003 6:16 pm Post subject: (No subject) |
|
|
does Music.PlayFileStop = Music.SoundOff? cuz i tried Music.SoundOff and it duznt work..still goes bak to the original music... |
|
|
|
|
|
Andy
|
Posted: Thu Jun 19, 2003 9:02 pm Post subject: (No subject) |
|
|
no u can't stop a music while its playing, i dun think |
|
|
|
|
|
Mephi
|
Posted: Thu Jun 19, 2003 9:25 pm Post subject: (No subject) |
|
|
Music.SoundOff stops music |
|
|
|
|
|
AsianSensation
|
Posted: Thu Jun 19, 2003 10:09 pm Post subject: (No subject) |
|
|
Quote: 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
|
Posted: Thu Jun 19, 2003 10:12 pm Post subject: (No subject) |
|
|
actually, don't need to use return at all, i was being stupid...
code: | 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 |
|
|
|
|
|
|
|