I am trying to program a reaction time experiment:
I want the card background to change colors, the color of the target + to change colors and the stimulus oval to change colors according to the colors set out in my field. I want the participants to press r, y, or b depending on the color of the oval and record the reaction times and export them to a data file. In addition, I want there to be 4 blocks, 25 trials per block but I am not sure how to do this.
Here's what I have so far, and I would attach the file but it won't accept .livecode extensions. I know many, if not all, could code this in about 5 minutes, but as I am a beginner, it has taken me several hours. This is my script for card 3
on keydown w
put tab & the milliseconds into rtime #The first thing we do is record the milliseconds into a variable
if w is in "r b y" then
put rtime & tab & return after field data of card 3 #if it is, we record the milliseconds into the data field, then include a return to start the next line
hide field tdisplay of card 3 #we immediately hide the target display field
wait 500 milliseconds
send mouseUp to button Begin #then, have the computer trigger the next trial by sending a click to the start button
end if
hide button Begin
end keydown
set "+" to target
set Oval to stimulus
set word 1 of each line in field bgcolorandtcolor of card 3 to backgroundColor
set word 2 of each line in field bgcolorandtcolor of card 3 to target color
set word 3 of each line in field bgcolorandtcolor of card 3 to stimulus color
put "+" in field tdisplay
wait 500 milliseconds
put Oval in field tdisplay
wait 500 milliseconds
hide Oval
repeat 4 times
sort lines of field bgcolorandtcolor by random(the number of lines in field bgcolorandtcolor)
put field bgcolorandtcolor & return after field trials of card 3
end repeat
on MouseUp
put the filename of this stack into fpath
set the itemdelimiter to "/"
delete the last item of fpath
put word 1 of field sname of card 1 into sname
put field data of card 3 into thedata
put thedata into url("file:"&fpath&"/data/"&sname&".txt")
end MouseUp
This is what's in my field bgcolorandtcolor
blue red blue
blue red yellow
blue red red
blue yellow yellow
red blue red
red blue blue
red blue yellow
red yellow yellow
yellow blue blue
yellow red red
yellow blue red
yellow blue blue
Thanks!
