How to capture response from keyboard?


Author
Message
kulajw
kulajw
Guru (5.9K reputation)Guru (5.9K reputation)Guru (5.9K reputation)Guru (5.9K reputation)Guru (5.9K reputation)Guru (5.9K reputation)Guru (5.9K reputation)Guru (5.9K reputation)Guru (5.9K reputation)
Group: Forum Members
Posts: 51, Visits: 256
Hi everyone,

I have some problems with capturing responses from keyboard.

I would like to create procedure when sequence of letters (random length) will be presented on the screen.
The participants must remember last letter and enter it from keyboard after letter presentation.

I figure out that I can capture last presented stimuli (letter) by refering to text.text_name.currentitem
e.g. text name in my case is "letter". Letter text element is used to present sequence of letters in trial letter presentation.

When I capture last presented letter then I can compare it with participant current response by refering to trial.trial_name.response
and using   iscorrectresponse  attribute:
iscorrectresponse = [trial.trial_name.response==text.text name.currentitem]

BUT the problem is that instead of letter pressed by participant trial.trial_name.response return letter scancode and conditional statement
trial.trial name.response==text.text_name.currentitem is always evalueted as FALSE because trial.trial name.response return scancode e.g. 30 instead of "A" and text.text_name.curentitem return last presented letter as a string "A"

The question is how can I convert scancode to a string values  or waht to do in this case?

I paste my script below

Thanks for any help:)

<item letters>
/1="A"
/2="B"
/3="X"
/4="Z"
</item>

<text letters>
/items = letters
</text>


<text test>
/items = ("remember the last letter in sequence
 by pressing appropriate key on keyboard")
</text>

<trial letter_presentation>
/stimulustimes = [0=letters]
/timeout=1000
</trial>

<trial test>
/stimulustimes = [0=test]
/timeout=10000
/iscorrectresponse = [trial.test.response==text.letters.currentitem]
/validrespon
/correctmessage = (good,800)
/errormessage = (error,800)
</trial>

<block letter_block>
/trials = [1-2=letter_presentation;3=test]
</block>

<text good>
/items = ("good")
</text>

<text error>
/items = ("Error")
</text>

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Reading This Topic

Explore
Messages
Mentions
Search