Im working on a project for school and im making a quiz type animation i have 3 lists
answer,questions,responses it already asks a random question and stores the answer but i need it to be able to tell what question is asked and what answer is put in to know what response to use based on the question and answer
Offline
Try a script like this inside a "repeat" or "forever" loop
Offline
There was an image of some Scratch blocks in my last post This one:
Offline
hey arent displaying and if i try to open the image by its self it has this error
The requested URL could not be retrieved
While trying to retrieve the URL: N/A
The following error was encountered:
Connection Lifetime Expired
Footprint has terminated the request because it has exceeded the maximum connection lifetime.
Footprint 4.6/FPMCP
Generated Thu, 22 Jul 2010 19:28:33 GMT by 205.128.91.126 (Footprint 4.6/FPMCP)
Offline
Hmm... that's odd... I'll try uploading it in a project for you
Here's the project: http://scratch.mit.edu/projects/blueshadow/1206911
That should work now
Offline
ok that was almost perfect this is what i have so far http://koenfam.co.cc/update.sb
I need it to ask a question from the list
check the answer with the answer list
and respond with something out of the responses list based on a right or wrong answer
Offline
Put this in place of "Hmm... that's not right!" in Wolfie1996's script:
[blocks]item <pick random( 1 )to( length of Responses )) of Responses [/blocks]
(the "item () of Responses" and "length of Responses" are list blocks and Responses is a list)
Last edited by meowmeow55 (2010-07-22 17:23:19)
Offline
meowmeow55 wrote:
Put this in place of "Hmm... that's not right!" in Wolfie1996's script:
[blocks]item <pick random( 1 )to( length of Responses )) of Responses [/blocks]
(the "item () of Responses" and "length of Responses" are list blocks and Responses is a list)
Actually, you can achieve the same effect with the <item (any) of responses> block.
Offline
Oh yeah, I forgot that "any" chooses a random item. (Actually, I forgot about the whole drop-down list there! )
Offline
this is working great so far thanks again for all the help but let me ask you this when it askes what you age is it gives a right or wrong answer is there anyway around this to say maybe store the age they put in and be able to say something like wow your getting up there or wow your a youngin or so on im really new to scratch and programming
Offline
Make a variable called "Age" that is set with this script:
[blocks]ask "What's you're age?" and wait
<set{ Age }to( answer [/blocks]
And is used with this script:
[blocks]<if><( <{ Age }> <>> something )>
<say[ blah blah blah ]for( some )secs>
<end>[/blocks]
Duplicate the if as many times as you want, changing the values in "something" and "blah blah blah" each time. You can also change the "greater than" to a "less than" on some duplicates.
Offline
adamk8875 wrote:
ok i think this is the last question when you run the code it picks the question at random but some times it will pick the same one 2 or 3 times any fix for this? or should i just add more questions to the list
Adding more questions to the list will reduce the frequency at which the questions will get chosen, but you would need to rework your project a bit to completely eliminate the possibility. Do you want me to show you how to do that? You should be fine as is, though.
Offline
It's okay. Just have it delete item counter of each list. That should work.
Offline
adamk8875 wrote:
this is what i have right now http://koenfam.co.cc/new.jpg
ok i cant post images so there is the link to the image
That looks good - but it'll still repeat questions. You could do as MaxTheWierdo suggested and simply delete the item from the list, but then the project will still be lacking those questions when it restarts.
I'd suggest something like this:
Make a list called askedQuestions. Place this block just below the first "set counter to" block in the script:
add (counter) to [askedQuestions]
Before that block that I just gave you, put this in:
repeat until <not <askedQuestions contains (counter)>> set counter to (pick random (1) to (length of [questions])) ==
Then, just below the hat block of "When I recieve [quiz]," put this script:
delete (all) of [askedQuestions]
That should work like a charm; if it doesn't, post here and I'll help you out.
Offline