I am trying to create a reaction time experiment.
Right now I have a button that begins the experiment, coded to display a fixation cross, picture, and word.
I have codes that control what each keyDown response does on the card.
After the button displays the word, I would like it to wait to continue until a keyDown response has been recorded. Is there a way to do this?
Thanks!
Wait for keyDown response
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Wait for keyDown response
Hi.
Not sure I see the problem. Yet.
1- You show several objects, as you say. Finished, done.
2- Then you want the user to press a key that does something. Certain keys are handled, I assume in a keyDown (or up) handler in the card script. Or wherever.
So the system is already "waiting" if you see what I mean. That is, the keydown message is a separate event, independent of anything that went before. There is no process "wait" required in this case; I see no connection between the two.
Or do I have this wrong?
Craig Newman
Not sure I see the problem. Yet.
1- You show several objects, as you say. Finished, done.
2- Then you want the user to press a key that does something. Certain keys are handled, I assume in a keyDown (or up) handler in the card script. Or wherever.
So the system is already "waiting" if you see what I mean. That is, the keydown message is a separate event, independent of anything that went before. There is no process "wait" required in this case; I see no connection between the two.
Or do I have this wrong?
Craig Newman
-
- Posts: 23
- Joined: Wed Jul 09, 2014 2:35 pm
Re: Wait for keyDown response
Craig,
That makes sense! I managed to fix the issue. This originally didn't work because I had the "waiting" within a repeat loop, so it didn't actually wait.
Thanks!
That makes sense! I managed to fix the issue. This originally didn't work because I had the "waiting" within a repeat loop, so it didn't actually wait.
Thanks!
-
- Posts: 23
- Joined: Wed Jul 09, 2014 2:35 pm
Re: Wait for keyDown response
Now I just have to figure out how to make sure only the specific keys work, and no others.
Thanks!
Thanks!
Re: Wait for keyDown response
Good going.
The "keyDown" message takes a single parameter. You would do something like:
This will only process the keys you are interested in. But be careful, you will have trapped a very important message. If this is in the card script, for example, you will not be able to type into a field. Can you make the above handler more robust on your own? If so, fine. If not, look up the "pass" control structure before asking here.
Craig
The "keyDown" message takes a single parameter. You would do something like:
Code: Select all
on keyDown tKey
if tKey = thisKey then doSomething
if tKey = thatKey then doSomethingElse
end keyDown
Craig