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

#1 2013-04-20 20:35:40

Mikestar
New Scratcher
Registered: 2013-04-04
Posts: 13

Need help with timer script

Hello,
I am somewhat new to scratch and need help with a script. My project involves timing users and recording their answer on questions that are supposed to confuse the brain like Blue text red. My project's time script goes when
green flag is clicked
reset timer
forever if timer is greater than 3.5
if timer is greater than 3.5
add 0 to answers
say try to be faster next time
add - to time
stop script
(end of loops)

Offline

 

#2 2013-04-20 20:38:50

Mikestar
New Scratcher
Registered: 2013-04-04
Posts: 13

Re: Need help with timer script

Sorry accidentally hit enter here is the rest
when I end my quiz all of the scripts automatically go off so I have 5 minuses and zeros on my lists. Also if they miss a question in the middle all time scripts that have already started go off. I am using variables for the later questions time scripts.
Any help would be appreciated
Thanks

Offline

 

#3 2013-04-21 10:49:08

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Need help with timer script

Don't suppose you could upload it?

Otherwise at first glance I see a few problems with your scripts, the biggest seems to be that it looks like you are time syncing the questions which is a bad idea.

I'd recommend asking the question in the same script as the timer bit is in and use broadcast and wait followed by reset timer to start the question.

Example using plain text questions instead of costumes (I know this isn't what you want but its just an example of how to get the timer to work right with it):

when gf clicked
set [QuestionCounter v] to [0]
repeat <length of [Questions v]>
reset timer
ask <item (QuestionCounter) of [Questions v]> and wait
if <(timer) > [3.5]>
wrong
else
if <(answer) = <item (QuestionCounter) of [Answers v]>>
change [CorrectAnswers v] by [1]
end
end


http://i50.tinypic.com/ded8m.png

Offline

 

#4 2013-04-21 11:13:26

Mikestar
New Scratcher
Registered: 2013-04-04
Posts: 13

Re: Need help with timer script

when gf clicked
reset timer
forever if <(timer) > [3.5] >
if <(timer) > [3.5] >
add [0] to [answers v]
say [try to be faster next time!] for (2) secs
add [-] to [time v]
stop script
end
here is the script that I am currently using for my time if you want to see my question script also I can upload it. By the way do you mean using something that works off of the length of ___ block?

Offline

 

#5 2013-04-21 12:28:25

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Need help with timer script

Uploading it would help me a lot I think, if you don't mind.

Also your script won't work because the reset timer block is never reset at the start of a question (unless this is done in question script in which case I definitely would like you to upload). Also remove the stop script block.


http://i50.tinypic.com/ded8m.png

Offline

 

Board footer