
-----------------------------------
sakibur001
Mon May 29, 2017 12:12 pm

Need help to make a score system on turing
-----------------------------------
What is it you are trying to achieve?
I want to add a score system which shows up at the end of the program. Basically im creating a simple math quiz like  what is 1+1, I want it to display the number of questions the user got right out of the total questions like 14/16. How do I do that?




Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)



body proc playGame
    var ans : int
    Window.Hide (mainMenuWindow)
    playGameWin := Window.Open ("graphics:max;max")
    Window.SetActive (playGameWin)
    put ""
    put "THIS IS PLAY"
    put ""
    put "What is 1 + 1?"
    get ans
    if ans = 2 then
        put "Correct"
    elsif ans < 2 or ans > 2 then
        put "Wrong"
    end if
    put "What is 2 x 4?"
    get ans
    if ans = 8 then
        put "Correct"
    elsif ans < 8 or ans > 8 then
        put "U dumb"
    end if
    mainMenuButton := GUI.CreateButton (100, 100, 0, "Return to the Main Menu", mainMenu)
end playGame


this is just an example, not my full code



Please specify what version of Turing you are using
4.1

-----------------------------------
Insectoid
Mon May 29, 2017 12:13 pm

RE:Need help to make a score system on turing
-----------------------------------
What have you tried?

-----------------------------------
sakibur001
Mon May 29, 2017 12:16 pm

Re: RE:Need help to make a score system on turing
-----------------------------------
What have you tried?

Not much, I don't really know how to start cause I never did anything like a score system implemented into a game/program before.

-----------------------------------
Insectoid
Mon May 29, 2017 12:50 pm

RE:Need help to make a score system on turing
-----------------------------------
Can you describe in English when you want the score to change, and how you want it changed?

-----------------------------------
sakibur001
Mon May 29, 2017 9:02 pm

Re: RE:Need help to make a score system on turing
-----------------------------------
Can you describe in English when you want the score to change, and how you want it changed?
Describe in English?? What language am I talking in right now??? I want it to display the total score after all the questions have been answered. Man this help section isnt really any help tbh, especially from people like you.

-----------------------------------
Insectoid
Tue May 30, 2017 6:01 am

RE:Need help to make a score system on turing
-----------------------------------
If you describe to yourself exactly how you want it to behave, you might find the answer is *extremely obvious*. That is why I want you to do it. 

How do you display something? You know how, you've done it several times in the code you posted. What is a score? A number. How do you display a number?

The more trivial your problem is, the less help I'm willing to give you, and this is very nearly the most trivial problem you could possibly have.

-----------------------------------
sakibur001
Tue May 30, 2017 1:17 pm

Re: RE:Need help to make a score system on turing
-----------------------------------
If you describe to yourself exactly how you want it to behave, you might find the answer is *extremely obvious*. That is why I want you to do it. 

How do you display something? You know how, you've done it several times in the code you posted. What is a score? A number. How do you display a number?

The more trivial your problem is, the less help I'm willing to give you, and this is very nearly the most trivial problem you could possibly have.

Ok but I want something so that it can keep the score and display it at the end. What do I do so that if the user gets it correct it adds it to the scoring system.
Sorry but i'm not as "professional" as you

-----------------------------------
sakibur001
Tue May 30, 2017 1:23 pm

Re: RE:Need help to make a score system on turing
-----------------------------------
If you describe to yourself exactly how you want it to behave, you might find the answer is *extremely obvious*. That is why I want you to do it. 

How do you display something? You know how, you've done it several times in the code you posted. What is a score? A number. How do you display a number?

The more trivial your problem is, the less help I'm willing to give you, and this is very nearly the most trivial problem you could possibly have.

Yooo, nvm i think i found out how to do it. I did something like this

 var score : int := 0
    var ans : int
    Window.Hide (mainMenuWindow)
    playGameWin := Window.Open ("graphics:max;max")
    Window.SetActive (playGameWin)
    put ""
    put "THIS IS PLAY"
    put ""
    put "What is 1 + 1?"
    get ans
    if ans = 2 then
        put "Correct"
        score := score + 1
    elsif ans < 2 or ans > 2 then
        put "Wrong"
    end if
    put "What is 2 x 4?"
    get ans
    if ans = 8 then
        put "Correct"
        score := score + 1

    elsif ans < 8 or ans > 8 then
        put "U dumb"
    end if
    put "Score", score

-----------------------------------
Insectoid
Tue May 30, 2017 2:42 pm

RE:Need help to make a score system on turing
-----------------------------------
Awesome, I knew you could do it.
