Music file won't end.
Author |
Message |
qmanjr5
|
Posted: Sun Dec 06, 2009 10:33 pm Post subject: Music file won't end. |
|
|
What is it you are trying to achieve?
Make a quiz
What is the problem you are having?
I start playing a music file, but can't seem to end it
Describe what you have tried to solve this problem
Tried processes, procedures, just the normal code. Asked friends.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
1. I'm sorry about all the "%"s, it's just a visual for me.
2. I know, it's not the best. There's probably a million things I did wrong and a million things I could do to improve it.
3. All I want to know is how to make it so the music file (thinking.mp3) will stop playing after each input is received for each question from the user.
Turing: |
Draw.FillBox (0, 0, maxx, maxy, black)
Text.Colour (brightgreen)
Text.ColourBack (black)
%Variables
var score : int
var answer1 : int
var answer2 : int
var answer3 : string
%variable values
score := 0
answer1 := 3
answer2 := 33000000
answer3 := "Barack Obama"
%Procedures
procedure correct
score + = 1
put "YAY! :) You got it right. Your score has been increased by 1"
end correct
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure incorrect
score - = 1
put "Oh no :( You got it wrong. Your score has been decreased by 1"
end incorrect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure currentscore
put "Your current score is ", score, ". Next question."
end currentscore
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure finished
put "CONGRATULATIONS! You've finished. Your final score was ", score, ". Good job."
end finished
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$
process thinking
Music.PlayFile ("thinking.MP3")
end thinking
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
process endthinking
Music.SoundOff
end endthinking
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%main code
put "Hello, welcome to my quiz."
put "First question"
put "What is 1+1? (ex. 3 [No letters])"
fork thinking
get answer1
fork endthinking
if answer1 = 2 then
correct
else
incorrect
end if
currentscore
put "Question two."
put "What is the population of Canada? (Ex. 1000000 [No comma's, or letters])"
get answer2
if answer2 = 33000000 then
correct
else
incorrect
end if
currentscore
put "Question 3"
put "Who is the president of the united states of america? (Case Sensitive [Full Name])"
get answer3 : *
if answer3 = "Barack Obama" then
correct
else
incorrect
end if
|
Please specify what version of Turing you are using
4.1.1 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
TheGuardian001
|
Posted: Sun Dec 06, 2009 10:57 pm Post subject: Re: Music file won't end. |
|
|
I believe the correct command to stop music is Music.PlayFileStop
I'm not sure what Music.SoundOff is actually doing but it's clearly not turning the sound off. |
|
|
|
|
|
qmanjr5
|
Posted: Sun Dec 06, 2009 10:59 pm Post subject: RE:Music file won\'t end. |
|
|
THANK YOU THEGUARDIAN001!!!!!!!! ily man
ha ha
i think Music.SoundOff is for when turing is making sounds? |
|
|
|
|
|
qmanjr5
|
Posted: Sun Dec 06, 2009 11:01 pm Post subject: RE:Music file won\'t end. |
|
|
Also, how would I make it so when, for example, they got a question right, it would play a sound file that is an applause, and then pause, then the user has to hit a key to continue. Then it would go back to playing the thinking music???? |
|
|
|
|
|
Tony
|
Posted: Mon Dec 07, 2009 12:04 am Post subject: RE:Music file won\'t end. |
|
|
That seems really specific. Is there a particular thing in that chain of events that you don't understand? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
qmanjr5
|
Posted: Mon Dec 07, 2009 3:11 pm Post subject: RE:Music file won\'t end. |
|
|
Erm, what do you mean Tony? |
|
|
|
|
|
Tony
|
Posted: Mon Dec 07, 2009 3:35 pm Post subject: RE:Music file won\'t end. |
|
|
You are describing a long sequence of events specific to your program. That is not an answerable question. I can also tell from the above code that you know how to do at least some of the steps already. So what's left? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Sponsor Sponsor
|
|
|
qmanjr5
|
Posted: Mon Dec 07, 2009 3:59 pm Post subject: RE:Music file won\'t end. |
|
|
Okay
How about this
I want file1 to play until action1 is done
I also wnat file1 to play for every input/action
I want file2 to play if action1 = true
and I want file3 to play if action1 = false
but, the problem is
when you're done action1, it goes to action2, without a pause
So, how would I add a pause between the end of action1, and the end of file1, to when file2 plays and when action1 = true
If you don't understand, well, I'm sorry D: you guys are supposed to be geniuses D: |
|
|
|
|
|
GalacticVenus
|
Posted: Mon Dec 07, 2009 4:33 pm Post subject: RE:Music file won\'t end. |
|
|
I'm no genius; on the contrary, I had to ask my teacher how I would use intstr in my situation, but in my opinon, a pause is possible by using the delay (x) command. |
|
|
|
|
|
qmanjr5
|
Posted: Mon Dec 07, 2009 4:35 pm Post subject: RE:Music file won\'t end. |
|
|
but, is it possible to do a delay until the user hits any button on his keyboard? |
|
|
|
|
|
andrew.
|
Posted: Mon Dec 07, 2009 4:37 pm Post subject: RE:Music file won\'t end. |
|
|
Or you can use Input.Pause so that they have to press a key to continue. |
|
|
|
|
|
qmanjr5
|
Posted: Mon Dec 07, 2009 4:39 pm Post subject: RE:Music file won\'t end. |
|
|
THANK YOU!!!
I'll probably post again with my next problem having to pertain to this issue, no doubt.
Thank you ALL |
|
|
|
|
|
|
|