

-----------------------------------

4sak3nX

Sun Mar 28, 2010 11:44 am


two questions

-----------------------------------

HEy all i got two questions for you all involving how to do something :D

first off i have a program that is a 5 question quiz. I want to add a couple of sound clips depending on how the user did. this leads me to the second point. How do i track how many questions the user got right and how many they didnt?

here is the program...



var a1 : string
var a2 : string
var a3 : string
var a4 : int
var a5 : string
var a6 : string

setscreen ("graphics")
colourback (black)

loop
    put "Welcome to THE QUIZ!"
    colour (yellow)
    put " Question 1. Who is the greatest person ever? " ..
    get a1
    if a1 = "Barney" then
        colour (green)
        put " "
        put "That is correct! Barney is the greatest person ever!"
    else
        colour (red)
        put " "
        put "Im sorry, Barney is the correct answer not ", a1
    end if

    colour (yellow)
    put " "
    put " Question 2. What is the name of the best band ever? " ..
    get a2
    if a2 = "GunsNRoses" then
        colour (green)
        put " "
        put "That is correct! Guns N Roses is the greatest band ever!"
    else
        colour (red)
        put " "
        put "Im Sorry, GunsNRoses is the correct answer, not ", a2
    end if

    colour (yellow)
    put " "
    put " Question 3. What Operating system do you use? " ..
    get a3
    if a3 = "vista" then
        colour (green)
        put " "
        put "Thats right! You use Vista! Join the club!"
    else
        colour (red)
        put " "
        put "No you use vista silly! Not ", a3
    end if

    colour (yellow)
    put " "
    put " Question 4. How old are you? You cant get this wrong! " ..
    get a4
    if a4 = 50 then 
put "you have passed the quiz."
Music.PlayFileReturn("the music you want to play")

elsif t1 < 50 then 
put "you have failled the quiz."
Music.PlayFileReturn("the music you want to play")


hope this helps  :D 
GL


-----------------------------------

livingheaven

Sun Mar 28, 2010 11:51 am


Re: two questions

-----------------------------------

sry ... forgot to end if 
 :D


-----------------------------------

4sak3nX

Sun Mar 28, 2010 11:53 am


RE:two questions

-----------------------------------

ok ill try this out and get back to you.


-----------------------------------

4sak3nX

Mon Mar 29, 2010 9:14 am


RE:two questions

-----------------------------------

ok the counting works fine but the sound wont play.

i put the sound name into the brackets under quotations but it wont play.


-----------------------------------

USEC_OFFICER

Mon Mar 29, 2010 11:49 am


RE:two questions

-----------------------------------

Are they in the same location?/The folder they are in is in the same location. That's very important. Did you try it with single/double quotations?


-----------------------------------

4sak3nX

Tue Mar 30, 2010 9:09 am


RE:two questions

-----------------------------------


var a1 : string
var a2 : string
var a3 : string
var a4 : int
var a5 : string
var a6 : string
var t1, t2, tt : int := 0

setscreen ("graphics")
colourback (black)

loop
    colour (yellow)
    put "Welcome to THE QUIZ!"
    colour (yellow)
    put " Question 1. Who is the greatest person ever? " ..
    get a1
    if a1 = "Barney" then
        colour (green)
        put " "
        put "That is correct! Barney is the greatest person ever!"
        t1 := t1 + 1
    else
        colour (red)
        put " "
        put "Im sorry, Barney is the correct answer not ", a1
        t2 := t2 + 1
    end if

    colour (yellow)
    put " "
    put " Question 2. What is the name of the best band ever? " ..
    get a2
    if a2 = "GunsNRoses" then
        colour (green)
        put " "
        put "That is correct! Guns N Roses is the greatest band ever!"
        t1 := t1 + 1
    else
        colour (red)
        put " "
        put "Im Sorry, GunsNRoses is the correct answer, not ", a2
        t2 := t2 + 1
    end if

    colour (yellow)
    put " "
    put " Question 3. What Operating system do you use? " ..
    get a3
    if a3 = "vista" then
        colour (green)
        put " "
        put "Thats right! You use Vista! Join the club!"
        t1 := t1 + 1
    else
        colour (red)
        put " "
        put "No you use vista silly! Not ", a3
        t2 := t2 + 1
    end if

    colour (yellow)
    put " "
    put " Question 4. How old are you? You cant get this wrong! " ..
    get a4
    if a4 