Author |
Message |
DVL_IAC
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Sat Feb 12, 2005 11:48 pm Post subject: (No subject) |
|
|
you could build out if - elsif - else structure. |
|
|
|
|
|
1337_brad
|
Posted: Sun Feb 13, 2005 12:21 am Post subject: You could also use processes |
|
|
you could use a process so that the music starts playing, and it starts to ask the user if he wants to change songs...
[/code] |
|
|
|
|
|
DVL_IAC
|
Posted: Sun Feb 13, 2005 10:32 pm Post subject: (No subject) |
|
|
tony wrote: you could build out if - elsif - else structure.
i clicked the link and read and im confused.
i put
code: | var choice : string
put "do you want to listen to music? (y or n)"
get choice
if choice = "y" then
put "ok"
delay (1000)
var i : int := 0
Music.PlayFileLoop ("PhobosAnomaly.mid")
delay (10000)
put "do you want to change songs (y or n)?"
get choice
if choice = "y" then
put "changing..."
delay (1000)
var j : int := 0
Music.PlayFileLoop ("VictorEndofEpisode.mid")
elsif choice = "n" then
put "kk"
else
put "Fine then!" ..
delay (1000)
put "Be that way!"
delay (10000)
end if
end if |
and when the person puts n as the answer to the first question the program just stops and doesnt say "Fine Then! Be that way!"
i'm guessing im not understanding the if - elsif - else thing right |
|
|
|
|
|
cycro1234
|
Posted: Mon Feb 14, 2005 8:26 am Post subject: (No subject) |
|
|
You could also try declaring each choice as a variable at the beginning of ur program. So like:
var choice1, choice2, choice3 : string
Then using each on individually in ur program. This way the program remembers what the value of choice1 is, and so on. |
|
|
|
|
|
Tony
|
Posted: Mon Feb 14, 2005 10:31 am Post subject: (No subject) |
|
|
DVL_IAC wrote: i'm guessing im not understanding the if - elsif - else thing right
it understands it alright - computers don't make mistakes. You just wrote it down wrong
Use F2 to indent your code and take a look at your structure closely. Try to follow it through in your head. |
|
|
|
|
|
DVL_IAC
|
Posted: Mon Feb 14, 2005 5:30 pm Post subject: (No subject) |
|
|
cycro1234 wrote: You could also try declaring each choice as a variable at the beginning of ur program. So like:
var choice1, choice2, choice3 : string
Then using each on individually in ur program. This way the program remembers what the value of choice1 is, and so on.
hmm like this
code: |
var choice1, choice2 : string
put "do you want to listen to music? (y or n)"
get choice1
if choice1 = "y" then
put "ok"
delay (1000)
var i : int := 0
Music.PlayFileLoop ("PhobosAnomaly.mid")
delay (10000)
put "do you want to change songs (y or n)?"
get choice2
if choice2 = "y" then
put "changing..."
delay (1000)
var j : int := 0
Music.PlayFileLoop ("VictorEndofEpisode.mid")
elsif choice2 = "n" then
put "kk"
elsif choice1 = "n" then
put "Fine then!" ..
delay (1000)
put "Be that way!"
delay (10000)
end if
end if
|
?
or like this
code: |
var choice1, choice2 : string
put "do you want to listen to music? (y or n)"
get choice1
if choice1 = "y" then
put "ok"
delay (1000)
var i : int := 0
Music.PlayFileLoop ("PhobosAnomaly.mid")
delay (10000)
put "do you want to change songs (y or n)?"
get choice2
if choice2 = "y" then
put "changing..."
delay (1000)
var j : int := 0
Music.PlayFileLoop ("VictorEndofEpisode.mid")
if choice2 = "n" then
put "kk"
if choice1 = "n" then
put "Fine then!" ..
delay (1000)
put "Be that way!"
delay (10000)
end if
end if
end if
end if |
?
hmm both ways it still finishes the program when you put n as the answer to the first question.
Tony wrote:
Use F2 to indent your code and take a look at your structure closely. Try to follow it through in your head.
I did and it seams fine to me... |
|
|
|
|
|
Bacchus
|
Posted: Mon Feb 14, 2005 5:39 pm Post subject: (No subject) |
|
|
put one end if right after the if chioce2="n" then kk thing and remove one at the end right now ur checking to see if chioce1 in "n" in the check to see if chioce1="y" |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DVL_IAC
|
|
|
|
|
ssr
|
Posted: Tue Feb 15, 2005 9:17 pm Post subject: (No subject) |
|
|
use instead of or
put the ifs inside another if
I think thats called nested ifs
lol
gl |
|
|
|
|
|
ssr
|
|
|
|
|
ssr
|
Posted: Tue Feb 15, 2005 9:23 pm Post subject: (No subject) |
|
|
Or I know that people say is evil
but I do suggest using it in a music file
so u can get the input while the music is playing
Check out the tutorial if u dont know what a is.
Im sure there are better ways to do it.
Good Luck With It 8) |
|
|
|
|
|
DVL_IAC
|
|
|
|
|
DVL_IAC
|
Posted: Tue Feb 15, 2005 10:25 pm Post subject: (No subject) |
|
|
Now 1 more question and i think i should be good for a bit can you make like a go back button... like if u asked what do u want to do and they select play games which brings up a list of games they can play and 1 option would be go back to main menu... is there a code to go back one step?
[edit]
woah regular users can double post! in the forums i usually hang around at only staff and admins can double post. if regular users could double post the forums would get majorly spammed up |
|
|
|
|
|
ssr
|
Posted: Wed Feb 16, 2005 12:20 pm Post subject: (No subject) |
|
|
yes sure u can
put the code in a and after the programis finished, get the input from the user, use if statement again to check if they want to continue...I think thats it.
Quote: woah regular users can double post! in the forums i usually hang around at only staff and admins can double post. if regular users could double post the forums would get majorly spammed up
As for that yaya we all should be greatful for that
lol |
|
|
|
|
|
|