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

#1 2013-04-25 20:34:03

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

Help making timer script URGENT!!!

I am making a quiz on stuff similar to the stroop effect (word is opposite of color, name the color). I have spent 2 hours trying to make a working script to time the user so that I can measure which is done fastest shapes with other colors etc. The object of this script is to add - to a list which records how long it took them to answer if they do not answer soon enough. I have tried using different combinations of if and forever loops but they do not work. The problem is that all that have started (I make one for each question) previously go off when only one of them is supposed to go off. Also at the end of the quiz all of them go off. I can get around that but if anyone could help with that also I would be grateful.
Here is the script that I have had the most success with

when I receive [1 v]
forever if <(timer) > [3.5] >
if <(timer) > [3.5] >
my answer scripts go here
stop script
end
I HAVE TO HAVE THIS FOR MY SCIENCE FAIR PROJECT. PLEASE HELP RESULTS ARE DUE NEXT WEEK!

Offline

 

#2 2013-04-25 23:22:39

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Help making timer script URGENT!!!

Mikestar wrote:

I am making a quiz on stuff similar to the stroop effect (word is opposite of color, name the color). I have spent 2 hours trying to make a working script to time the user so that I can measure which is done fastest shapes with other colors etc. The object of this script is to add - to a list which records how long it took them to answer if they do not answer soon enough. I have tried using different combinations of if and forever loops but they do not work. The problem is that all that have started (I make one for each question) previously go off when only one of them is supposed to go off. Also at the end of the quiz all of them go off. I can get around that but if anyone could help with that also I would be grateful.
Here is the script that I have had the most success with

when I receive [1 v]
forever if <(timer) > [3.5] >
if <(timer) > [3.5] >
my answer scripts go here
stop script
end
I HAVE TO HAVE THIS FOR MY SCIENCE FAIR PROJECT. PLEASE HELP RESULTS ARE DUE NEXT WEEK!

Okay, well why do you have two conditions exactly the same? Try removing the if statement inside the forever if loop.

Please clarify the problem a little more, I do not completely understand.

Regards,

CAA14

Offline

 

#3 2013-04-26 13:10:01

cauzality
New Scratcher
Registered: 2013-03-19
Posts: 44

Re: Help making timer script URGENT!!!

are you using broadcast AND WAIT? or just broadcast? if they are put in succession in the same stack, that will make a difference (with ... and wait, 2 will broadcast only after the stacks activated by 1 complete).

broadcast [1 v] and wait
broadcast [2 v] and wait
also, are you resetting the timer with each broadcast-transition?
reset timer
i'm also not sure if i understand but i think i might... i don't think you need to do the forever loop. If you just want to record the time it takes the user to answer if they take too long, look to suggestion 1 (no loop); if you want to intervene somehow after so much time has passed without a user response, suggestion 2 is a start (uses loop).

suggestion 1:
have something show the question and reset the timer (when the right broadcast is received). then if there are option sprites the user clicks to response to the question, give them each a stack like this:
when [Q1Option3Sprite] clicked
if < (timer) > [some number] >
  record (timer) in variable or list
end
broadcast [2 v]
suggestion 2:
Have scripts to set change a variable (selectionMade in this case) when the user makes their selection. Then use something like this:
when I receive [1 v]
show Q1
reset timer
set [selectionMade v] to [false]
forever
   if < (selectionMade) = [true] >
      broadcast [2 v]
      stop script
   else
      if < (timer) > [some number] >
         record (timer) in variable for list
      end
   end
this will just record the time it takes them. To make an intervention after some amount of time, add this after the blocks which record the timer value:
broadcast [intervene somehow v]
stop script
*******
good luck

Offline

 

Board footer