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

#1 2011-11-26 21:54:48

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

I need help with "repeat until" blocks.

Here's what the script looks like:

when I recieve "_" repeat until answer = A or answer = B or answer = C ask "_" and wait

a.k.a

<when I receive[ ___
<repeat until> answer = A or answer = B or answer = C
ask ___ and wait
<end>

The player's character has to visit another character; that character will broadcast a message. When the stage recieves this message, it's supposed to make you answer "A" "B" or "C". Once you do, it disappears. The problem is, you can visit this character multiple times. I would like it to ask this question each time, but it only stores the answer once and considers the question repeated enough.

How do you make it ask the question each time the message is broadcasted?

Offline

 

#2 2011-11-26 22:22:46

SJRCS_011
Scratcher
Registered: 2011-02-07
Posts: 1000+

Re: I need help with "repeat until" blocks.

Take out the repeat until
Instead, do this:

When I receive message
ask _ and wait
if answer=a or b or c
rest of scripts
else
broadcast message

That should work


http://i.imgur.com/vQqtH.png
Learning to Program in a Nutshell:  "You're missing a closing parentheses" - LS97

Offline

 

#3 2011-11-26 22:24:23

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: I need help with "repeat until" blocks.

I'm not sure I understand, but the "answer" block is rewritten by each question, so you can ask as many questions as you want, just store each answer in a list or variable if you need to access it later.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2011-12-08 16:42:43

DewleafWolf
Scratcher
Registered: 2011-01-13
Posts: 100+

Re: I need help with "repeat until" blocks.

I found a way to make it work! Thanks anyway.  smile

Offline

 

Board footer