Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Loop Exit Help...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Leftover




PostPosted: Thu Jan 13, 2005 7:08 pm   Post subject: Loop Exit Help...

Well, here I am again Smile. Working on my final, trying to learn and stay away from here but it's impossible Very Happy

What I know how to do: Exit a loop by pressing a key and hitting enter, Ex.
code:
loop
Music.PlayFile (%systemroot/whatever/intro.wav)
exit when word = "victory is mine"
end loop

which will essentially end the loop when I type in victory is mine... Only problem, it's not exactily what I want it to do, and for me (I'm using it for playing intro theme song for my final) it doesn't stop the music, it waits for it to finish then stops.

What I want to do: Be able to exit the loop and stop the song wherever it is once a menu object is selected with the keyboard and "Enter" is pressed to advance on to the next menu, Ex.
code:
loop
Music.PlayFile (%systemroot/whatever/intro.wav
kill music and exit when keydown = "Enter"
end loop

(( Or something like that, I don't know the keydown commands much yet but I'm sure I'll be learning soon ))

If I am attacking this wrong (by using loops or whatever) feel free to shoot me down. Any help is aprecieated and will be put too good use Smile Thanks in advanced, L.O.
Sponsor
Sponsor
Sponsor
sponsor
Jonny Tight Lips




PostPosted: Thu Jan 13, 2005 7:51 pm   Post subject: (No subject)

You need Music.PlayFileStop and/or Music.SoundOff. Look them up in the turing help file then if you need more help come back.
Leftover




PostPosted: Thu Jan 13, 2005 8:24 pm   Post subject: (No subject)

Okay I got that far Smile. Using Music.PlayFileLoop instead of the loop then Music.PlayFile, and I know how to kill it with Music.SoundOff, but not sure how to make it do that command when enter, or ascii 10 is pressed.
Leftover




PostPosted: Thu Jan 13, 2005 9:11 pm   Post subject: (No subject)

Okay I got it from there, thanks Jonny.

I used:

code:

Music.PlayFile (%systemroot/blah/whatever.wav)

...

loop
    if hasch then
        move := getchar
        if move = chr (10) then
            Music.PlayFileStop
        end if
    end if
end loop
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: