Discuss Scratch

KoriFee
New to Scratch
8 posts

Quiz with multiple answers which all have to be correct in order to go to the next question

I am assembling a learning game for a school project and decided to create a quiz. So far so good. Doing Questions with one answer isnt the problem.

I also watched videos, with storing answers in a list. (but those were also for Questions with one answer)

My problem is now, i want a Question with 5 answers to choose from and 3 of them are correct and in order to have the whole question correct all 3 answers have to be correct (clicked).

I would like to do them with buttons if possible, checkboxes would be perfect too.

I didnt find anything on google nor youtube and now i hope some of u might help me.

thanks in advanced

regards Kori

Last edited by KoriFee (May 15, 2020 19:20:20)

Oumuamua
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

Hi, it has been around forty-seven minutes since you created this topic and no one responded you, may be you should share the project, just an advice.
Greets.

Last edited by Oumuamua (May 15, 2020 23:35:11)



KoriFee
New to Scratch
8 posts

Quiz with multiple answers which all have to be correct in order to go to the next question

Was my explanation not good enough ? All i need is a way to have a Question with 5 possible answers , where i have to guess the right answers (more than one) to successfuly go to the next question, why is my project needed for that ?

Last edited by KoriFee (May 15, 2020 20:21:25)

KoriFee
New to Scratch
8 posts

Quiz with multiple answers which all have to be correct in order to go to the next question

I shared my project, but i dont see the point why thats neccessary I hope someone can help me regardless.

regards
deck26
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

Too late on a Friday night for me to help right now but a variable counting right answers should be all you need. Wrong answers need to count against the total.
Oumuamua
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

Oumuamua wrote:

Hi, it has been around forty-seven minutes since you created this topic and no one responded you, may be you should share the project, just an advice.
Greets.

Sorry if I haven't helped you. Don't worry, some other helpful Scratcher will.

Last edited by Oumuamua (May 15, 2020 23:59:11)



Scratch-Minion
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

Maybe have an instruction on the screen, “click all the correct answers then click the Done button”.
The Done button is an extra button on the screen that they only click after selecting all their answers.

The costumes of the buttons 1-5 could change when clicked so that the player can see that they have been selected.
You could use variables to record whether each answer has been selected.
eg. Answer 1 Selected = 1 if selected or 0 if not selected.
They could then click again on any costume to deselect it.

When they are happy with their answer, they click the “Done” button.

When they click the Done button, check if they are right.
Suppose that 1 and 3 are the correct answers:

if <<(Answer 1 Selected) = [1]> and <<(Answer 2 Selected) = [0]> and <<(Answer 3 Selected) = [1]> and <<(Answer 4 Selected) = [0]> and <(Answer 5 Selected) = [0]>>>>> then 



else

end
KoriFee
New to Scratch
8 posts

Quiz with multiple answers which all have to be correct in order to go to the next question

yeah i did something similiar so far, greated 5 buttons a - e and a yes and no button, because some questions require a yes and no answer. My issue now is, i have around 80 Questions, do i have to repeat that process for each question, or is there a more elegant way ?


And whats a better way to display the questions and possible answers ? via sprite or background ?

Last edited by KoriFee (May 16, 2020 07:57:17)

deck26
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

So my suggestion of a total count of right/wrong answers surely works?
KoriFee
New to Scratch
8 posts

Quiz with multiple answers which all have to be correct in order to go to the next question

I guess counting is the least problem (for me). I have an issue now on how to best compare the correct/incorrect answer given to the question.

So far i created 20 Backdrops with (18 for now) 20 different questions displayed on it and also possible answer choices from a - e and 1 question with a yes and no.

I also successfuly created a random list, so when the game gets to that point in the game, everytime the questions have a new order, so once i sucessfully compared correct answer with the question. then i can say “switch backdrop to item 2 of questionlist” (and so on , up to 20) and i dont have the problem with repeating a question.

I have to add, the buttons a - e and yes, no have a varible on it, u can click them and they are highlighted and variable set to 1 for that specific button and to 0 when clicked again.

The idea now is. I created a done button, when i press that done button, he has to compare backdrop with the right answer to that specific backdrop and if they are correct , maybe a little sound and a counter for answering one question correct and if incorrect the same, other sound, other counter.

I would created a nested if function, where he compares all backdrops to each other - for for example IF backdropquestion = backdropquestion 1 and button a = 1 and button c = 1 then correct / sound / next backdrop and broadcast the same one the done button got, so he restarts the script (at least thats what i believe would work) and if not, then i go to the next backdropquestion , follows like this If backdropquestion = backdropquestion 2 and button d = 1 and button e = 1 then correct and so on, until i reach question 20..

now that seems to be really tedious and not so elegant. so i would like to know a way, where i can set up a list with possible answers to each backdrop, so i can just compare them, but i have no clue

I hope i could clarify some things and thanks so far for the help.

My Project is shared, but the language of the text ingame is german, So far i worked on “LERNFELD 4” the other 2 are not touched yet, if u want to try and see what i did so far and if u come up with a more clever and elegant approche

regards
deck26
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

Shouldn't be hard to do this.

Click on an answer sprite. It can identify the backdrop number so use that as the index to a list item which tells you what the correct answer is for that question. No need for multiple if/else blocks to check different combinations of backdrop/answer.

If a question has multiple answers the lise can reflect this - eg 126 might indicate that 1, 2 and 6 are the correct answers.

So outline method is

show backdrop
accept answers
check answers and update score
repeat
KoriFee
New to Scratch
8 posts

Quiz with multiple answers which all have to be correct in order to go to the next question

I dont understand exactly what u mean. I wanted the player to check or uncheck a - e or yes, no, in case there is a missclick or he realized something late.


So for example:

Questionlist creates a random pattern -> show item 1 on that list -> backdrop 15 (for example, can be 1-20) -> and then i can check or uncheck all the buttons, and once im “done” i press that button and scratch should check -> backdrop + the right buttons = correct -> if correct sound and then next question from that random pattern from the beginning (i have not figured out, how to do that) and there again, repeat.

Big issue is now an answer list for each backdrop, how and where i can set that up and also how to go to the next background on the created random pattern questionlist
deck26
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

If b is selected it checks if it is a valid answer and either changes the counter by 1 or -1 accordingly. If it is unclicked it does the reverse. Really quite simple!

If you want to show the backdrops in random order that's fine, each still has its ‘backdrop number’ within the project and you can use that as a reference for the list. So it doesn't matter if you show backdrop 5 first the correct answers for that are still in item 5 of your list.

You know the answers for each backdrop so you manually put those in the list.

Randomising the order of backdrops is easy - start with a list of numbers 1 to n where n is the last one and randomly swap items in that list. You then work through that list in the new order.

If you don't understand that share what you have please.
deck26
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

Even easier, just use T and F for correct and wrong costume names for the answer sprites. You can look at the first letter of the costume name so T1, T2, T3 are correct answers in one sprite. The numbers have no meaning but you can't have two names the same so you need to add something. No need for a list of answers then, each costume knows already if it is right or wrong.
KoriFee
New to Scratch
8 posts

Quiz with multiple answers which all have to be correct in order to go to the next question

Yeah but having 80 questions in the end with double that amount of sprites, isnt that a bit much ? But i guess in the end, if i dont find out how to get it to work, i have to go to that
deck26
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

KoriFee wrote:

Yeah but having 80 questions in the end with double that amount of sprites, isnt that a bit much ? But i guess in the end, if i dont find out how to get it to work, i have to go to that
You don't need separate sprites for every question! Use costumes.

Here's a basic example - https://scratch.mit.edu/projects/396049918/

If you have lots of questions with variable numbers of answers create a list showing how many answers there are for each one. Then a sprite only shows if the current backdrop has at least that many answers. You can even vary the spacing according to the number of answers.
Scratch-Minion
Scratcher
1000+ posts

Quiz with multiple answers which all have to be correct in order to go to the next question

You need a list (or lists) with the correct answers for each backdrop (as you have one question in each backdrop).

If there are 80 backdrops/questions, there would be 80 entries in the list.
Each entry would be 7 numbers each being 0 or 1 corresponding to the answers ABCDE Ja or Nein

eg. If the correct answers to Q1 are A,D then its entry might be 1001000
If the correct answer to Q2 is E then its entry might be 0000100
If the correct answer to Q3 is Nein then its entry might be 0000001

You must write a list entry with the answers for each question.

** Note that you cannot then change the order of the backdrops!
We will identify each backdrop by its backdrop number.

(If you want to be able to change the order of the backdrops, then name them 1,2,3,…80 and identify each backdrop by its backdrop name rather than its backdrop number).

Your code would then look as follows:
Remember that Answer A Selected is a variable that is 1 or 0 depending on whether answer A has been selected,
Answer B Selected is a variable that is 1 or 0 depending on whether answer B has been selected,
Answer C Selected is a variable that is 1 or 0 depending on whether answer C has been selected,
Answer D Selected is a variable that is 1 or 0 depending on whether answer D has been selected,
Answer E Selected is a variable that is 1 or 0 depending on whether answer E has been selected,
Answer Ja Selected is a variable that is 1 or 0 depending on whether answer Ja has been selected,
Answer Nein Selected is a variable that is 1 or 0 depending on whether answer Nein has been selected.
Also item(backdrop number) of Answer List are the answers for that backdrop number eg. 1011000


if <<(Answer A Selected) = (letter (1) of (item (backdrop #) of [Answer List v] :: list))> and <<(Answer B Selected) = (letter (2) of (item (backdrop #) of [Answer List v] :: list))> and <<(Answer C Selected) = (letter (3) of (item (backdrop #) of [Answer List v] :: list))> and <<> and <<> and <<> and <>>>>>>> then 

else

end

I see that the second and third tests already do not fit on the screen above:
They are: Answer B Selected = letter (2) of item (backdrop #) of Answer List
and: Answer C Selected = letter (3) of item (backdrop #) of Answer List

I have not typed the above line fully, but add letter 4,5,6,7 for D,E,Ja and Nein answers.
Note that I have typed “backdrop #” used in Scratch 2 rather than “backdrop number” used in Scratch 3.

Last edited by Scratch-Minion (May 16, 2020 23:58:27)

KoriFee
New to Scratch
8 posts

Quiz with multiple answers which all have to be correct in order to go to the next question

Yeah i did that now. Thanks I have some minor Logic problems and also i am missing some answers, since this is a school project and my project member gave me some worng answers or not suited for the quiz so i have to wait now.

But so far im happy. Thanks for the great help.

Powered by DjangoBB