Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Trying to get backdrop to change when an question is answered in a quiz.
- Fossilman1
-
5 posts
Trying to get backdrop to change when an question is answered in a quiz.
Hi, I'm new to Scratch. Having lots of fun fiddling but now I'm getting frustrated with trying to work out this bit of code.
In my fossil quiz, The backdrop should change when a question is answered correctly. If not you get laughed at and the question asks again. But it only works on the first question. Then an answer either prompts no response, or both responses - the laugh and the backdrop change. I've checked and all of the scripts are the same for all of the questions, so not sure what to try next.
Thanks, Joe
P.S. I've taken a screen shot of the script but don't know how to post it on here.
In my fossil quiz, The backdrop should change when a question is answered correctly. If not you get laughed at and the question asks again. But it only works on the first question. Then an answer either prompts no response, or both responses - the laugh and the backdrop change. I've checked and all of the scripts are the same for all of the questions, so not sure what to try next.
Thanks, Joe
P.S. I've taken a screen shot of the script but don't know how to post it on here.
- Fossilman1
-
5 posts
Trying to get backdrop to change when an question is answered in a quiz.
- shanothe17th
-
13 posts
Trying to get backdrop to change when an question is answered in a quiz.
i'm having trouble with that too i don't know to work it.

- DealthEmitio
-
84 posts
Trying to get backdrop to change when an question is answered in a quiz.
- CodingComplexity
-
3 posts
Trying to get backdrop to change when an question is answered in a quiz.
Hi there! Yes DeathEmito answered the question but i'd like to give you a more deep detail answer. So you ask a question like when is Christmas, then you do a if then else. You would switch the backdrop if they got it correct, to the next question or you could broadcast but that takes forever! But it may be useful if you want to react without waiting for seconds. So you could switch to the loser back ground and then you could end all.
- Coding.
- Coding.
- InternetUser_005
-
100+ posts
Trying to get backdrop to change when an question is answered in a quiz.
I think the script that prompts with questions and switches backgrounds could all be done with one script that steps through a list of questions and increments the background with each correct answer.
If I get a chance I will play around with it later and post back.
Have a great day!
InternetUser
If I get a chance I will play around with it later and post back.
Have a great day!
InternetUser
- Fossilman1
-
5 posts
Trying to get backdrop to change when an question is answered in a quiz.
Interesting stuff!
Thanks guys!
Thanks guys!
- InternetUser_005
-
100+ posts
Trying to get backdrop to change when an question is answered in a quiz.
Hello,
I got playing around with this and couldn't leave it alone until I got it working. I was able to simplify the scripting quite a bit, however I wouldn't say it's dead simple.
I commented the scripts a bit with the hope that this will be helpful to your learning. If you have any questions about how any of it works please ask. The main portions of the script are now under sprite 1.
Link to the remix: http://scratch.mit.edu/projects/37952500/
Have a great day!
I got playing around with this and couldn't leave it alone until I got it working. I was able to simplify the scripting quite a bit, however I wouldn't say it's dead simple.

I commented the scripts a bit with the hope that this will be helpful to your learning. If you have any questions about how any of it works please ask. The main portions of the script are now under sprite 1.
Link to the remix: http://scratch.mit.edu/projects/37952500/
Have a great day!
Last edited by InternetUser_005 (Dec. 7, 2014 08:04:02)
- Fossilman1
-
5 posts
Trying to get backdrop to change when an question is answered in a quiz.
That's so great! I'll see what I can learn. Thanks so much, so happy to get it up and running. Any idea why my scripts didn't work? They seemed logical…
- InternetUser_005
-
100+ posts
Trying to get backdrop to change when an question is answered in a quiz.
That's so great! I'll see what I can learn. Thanks so much, so happy to get it up and running. Any idea why my scripts didn't work? They seemed logical…
Sorry. I never answered your actual question.

Looking at the scripts associated with the background; the ones that use the ask block and change the backdrops… I see a couple of problems. It looks like you accidentally used a “Switch Backdrop and Wait” block instead of just a “Switch Backdrop” on one script… Coral I think. I'm not positive this is really causing a problem, but it could.
The real bug here is the use of forever loops with no exit conditions. The way you have it now those repeats continue to run. If the users answers correctly the backdrop switches and another block of script is called to prompt for the next answer, but the user is still getting prompted for the first answer, because that script is still running. Use a Stop block to fix this, other languages will usually have an Exit Repeat, but in scratch its just Stop.
I am not sure exactly what behavior you want here. In my remix I assumed the user gets one shot at a correct answer then go on to the next slide. From your code I am thinking perhaps you want them to be able to try until they get it right. If you want that, do it like this:
If you want to go the one-try-and-move-on route do it like this:
Note the addition of a Stop This Script block after playing the laugh sound and switching the backdrop.
If you make these changes I think it will be basically working. I would fix say the first three and test it before you do all of them. I haven't actually tested this.

Have a great day!
IU5
- Fossilman1
-
5 posts
Trying to get backdrop to change when an question is answered in a quiz.
Thanks for all of your help IU5. Yes, I wanted to give them as many tries as they needed, but part of that was so that I didn't have to set up scores etc, which I haven't fully got my head round yet. So either way is great. I'll test out your fix asap and let you know how I get on.
All the best, Fossilman1
All the best, Fossilman1
- 50068739
-
1 post
Trying to get backdrop to change when an question is answered in a quiz.
When I try to make a code on a scratch background the code works but it goes to all the other backgrounds to so that the backgrounds all do the same thing. When I try to erase the code on one of the backgrounds it erases it on the others too. I can not do something to one background without it doing it to the others too.
- ConfusedBiscuit
-
1000+ posts
Trying to get backdrop to change when an question is answered in a quiz.
Hi there! It appears your new to scratch. This topic was resolved back in 2014, which means it's no longer relevant. When you post on an old, resolved topic, it's called necroposting. In the future, please refrain from necroposting. When I try to make a code on a scratch background the code works but it goes to all the other backgrounds to so that the backgrounds all do the same thing. When I try to erase the code on one of the backgrounds it erases it on the others too. I can not do something to one background without it doing it to the others too.

- deck26
-
1000+ posts
Trying to get backdrop to change when an question is answered in a quiz.
What @ConfusedBiscuit didn't say was the solution is to post your own new topic if you have a question.Hi there! It appears your new to scratch. This topic was resolved back in 2014, which means it's no longer relevant. When you post on an old, resolved topic, it's called necroposting. In the future, please refrain from necroposting. When I try to make a code on a scratch background the code works but it goes to all the other backgrounds to so that the backgrounds all do the same thing. When I try to erase the code on one of the backgrounds it erases it on the others too. I can not do something to one background without it doing it to the others too.
- ConfusedBiscuit
-
1000+ posts
Trying to get backdrop to change when an question is answered in a quiz.
Ah yes, Thank you!What @ConfusedBiscuit didn't say was the solution is to post your own new topic if you have a question.Hi there! It appears your new to scratch. This topic was resolved back in 2014, which means it's no longer relevant. When you post on an old, resolved topic, it's called necroposting. In the future, please refrain from necroposting. When I try to make a code on a scratch background the code works but it goes to all the other backgrounds to so that the backgrounds all do the same thing. When I try to erase the code on one of the backgrounds it erases it on the others too. I can not do something to one background without it doing it to the others too.
- Discussion Forums
- » Help with Scripts
-
» Trying to get backdrop to change when an question is answered in a quiz.