This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-10-30 14:49:36

Zangooser
Scratcher
Registered: 2012-03-18
Posts: 1000+

Questions self-answering :P

Currently I am making a little quiz in Scratch, and I'm having trouble with the answer selection. Let me summarize as non-confusingly as I can: There's a little intro in the beginning when I explain how the quiz works, but I don't think that has anything to do with my problem. Anyway, once the instructions are finished, the Scratchcat comes out and starts asking questions. Right now, I only have the first question programmed to be answered, and I've found a problem with when you try to click on an answer. Allow me to elaborate. There are twelve questions total, with four answer choices per question: choice A, B, C, and D. Whenever one of the answers is chosen, the corresponding Choice variable would switch to "true" for .05 seconds, and then revert back to "false" (basically, if I chose answer B, it would set variable B true for a short period, and then false again). Here's how the question-answer thing works: the Scratchcat will ask a question using the "say" script like this:

repeat until <(Question#) = [12]>
say (QuestionString)
wait until <<(A) = [true]> or <<(B) = [true]> or <<(C) = [true]> or <(D) = [true]>>>>
wait (0.1) secs //this may be superfluous
change [Question# v] by [1]
...and just so you know, I've made it like this only because I don't want to have a long script going like "if the question# is 3, say this, if the question# is 4, say this..." ...et cetera. The stage changes the QuestionString to match the Question#. That isn't the problem. The problem is that when I testrun the program and select answer A (because that's the only choice I've programmed yet), it cycles through the rest of the A answers, as well as the questions, until it's at the last question and the program is done. What? I clicked it once and then it auto-selects my answers for me! It's weird, I can't figure out why that is. Anyway, there are two scripts that I think may be wrong somewhere and therefore causing the bug: the script I posted above, and the script I posted just below this paragraph. (The first one is from the Scratchcat - aka, the asker- and the one below is from choice A, which is one of the answers)
when [A] clicked
forever
if <(A) = [false]>
if <(Question#) = [1]>
change [Result 1 v] by [1]//this is what effects quiz results, prob. doesn't matter
end
if <(Question#) = [2]>
change [Result 2 v] by [1]//same as above, this goes on 'til Question#=12
end
set [A v] to [true]
wait [0.05] secs
set [A v] to [false]
If you need an example of the bug (believe me, I am not very good at explaining things, so this may be the case), I am going to upload a test project that shows you what I mean. XP
Thanks so much in advance!


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/O0efo.png&amp;link2=http://i.imgur.com/B1KzK.png

Offline

 

#2 2012-10-30 15:27:51

Zangooser
Scratcher
Registered: 2012-03-18
Posts: 1000+

Re: Questions self-answering :P

I've posted an example of the bug here


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/O0efo.png&amp;link2=http://i.imgur.com/B1KzK.png

Offline

 

#3 2012-10-30 15:37:10

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Questions self-answering :P

You didn't need that huge text wall and you also didn't need to post your project. Anyway, the problem I see is that you put a forever block in answer A and that's probably what's causing all of this. Remove it and your project should work better.

I hope that this helps!

Last edited by ErnieParke (2012-10-30 15:39:41)


http://i46.tinypic.com/35ismmc.png

Offline

 

#4 2012-10-30 15:58:03

Zangooser
Scratcher
Registered: 2012-03-18
Posts: 1000+

Re: Questions self-answering :P

ErnieParke wrote:

You didn't need that huge text wall and you also didn't need to post your project. Anyway, the problem I see is that you put a forever block in answer A and that's probably what's causing all of this. Remove it and your project should work better.

I hope that this helps!

You get a cookie. For being so darn smart. :P
Thank you so much!


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/O0efo.png&amp;link2=http://i.imgur.com/B1KzK.png

Offline

 

#5 2012-10-30 16:26:51

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Questions self-answering :P

Closed by request of the topic owner.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

Board footer