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

Username:   Password: 
 RegisterRegister   
 Ending Music
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BigBear




PostPosted: Fri Feb 15, 2008 5:23 pm   Post subject: Ending Music

I have a game i am working on and is almost finished I had music in it using Music.PlayFile but now I want it to be old school and have retro music using Sound or Turing's Play commands. However I used to Music.PlayFileStop and that worked fine but now I really need help ending the game music when I return to the main menu.
code:

var done := false
var word : string
var ans : string (1)
process DoMusic
    loop
        Music.Play ("cdefgabcbagfedg")
        Music.Play ("cdefgabcbagfedg")
        Music.Play ("cdefgabcbagfedg")
        Music.Play ("cdefgabcbagfedg")
        Music.Play ("cdefgabcbagfedg")
        if done = true then
            Music.SoundOff
        end if
        exit when done = true
    end loop
end DoMusic

proc Play
    fork DoMusic
    loop
        put "Enter q to quit"
        put "Enter a word : " ..
        get word
        put word, " is a good word."
        exit when word = "q"
    end loop
    Music.SoundOff

    done := true
end Play

proc main
    loop
        put "Enter 1 to play"
        put "1  Play"

        getch (ans)
        if ans = "1" then
            Play
        end if
        exit when ans = "q"
    end loop
end main
main


I made this program to demonstrate my problem. This would work if I had one Play command but I am wondering if there is another way? And when I put all my Play commands in one an error says "String literal is too large"
Sponsor
Sponsor
Sponsor
sponsor
BigBear




PostPosted: Sat Feb 16, 2008 11:32 am   Post subject: Re: Ending Music

I have made most of my music on one line but still need a solution. Any Idea's
Clayton




PostPosted: Sat Feb 16, 2008 12:40 pm   Post subject: RE:Ending Music

BigBear wrote:
"String literal is too large"


This means that the string you are trying to pass to Music.Play() is over the maximum allowable length of 255 characters. So why not just:

Turing:
for i : 1 .. 5
    Music.Play ("cdefgabcbagfedg")
end for
?
BigBear




PostPosted: Sat Feb 16, 2008 1:05 pm   Post subject: Re: Ending Music

Yes that would work but I do not want to repeat the same line. The music I want is over 255 characters.

Why doesn't ending multiple lines like that work?

I guess I will just use a mid file, but then the music isn't done by me. O well.
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: