coding for correct answers with key press


Author
Message
raynae
raynae
Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)
Group: Forum Members
Posts: 13, Visits: 52
Hello, 

I'm looking for help on how to code for /iscorrectresponse. 

In my study I prefer for participants to respond using a keyboard press which corresponds to the location of the stimulus. e.g, "1" for left and "2" for right. 

However, I want to randomise the presentation of the stimulus location of which I'm doing using a counter. Is there a way to code for if the position is 40% then the correct response ==  "1" keypress but if position is 60% then correct response == "2" keypress

thank you 
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 89K
raynae - 1/23/2023
Hello, 

I'm looking for help on how to code for /iscorrectresponse. 

In my study I prefer for participants to respond using a keyboard press which corresponds to the location of the stimulus. e.g, "1" for left and "2" for right. 

However, I want to randomise the presentation of the stimulus location of which I'm doing using a counter. Is there a way to code for if the position is 40% then the correct response ==  "1" keypress but if position is 60% then correct response == "2" keypress

thank you 

Sure.

<values>
/ x = 0%
/ cresp = " "
</values>

<list xpos>
/ items = (40%, 60%)
/ poolsize = 4
</list>

<text stimulus>
/ items = ("A", "B", "C", "D")
/ hposition = values.x
</text>

<trial mytrial>
/ ontrialbegin = [
    values.x = list.xpos.nextvalue;
    if (values.x == 40%) {
        values.cresp = "1";
    } else {
        values.cresp = "2";
    }
]
/ stimulusframes = [1=stimulus]
/ validresponse = ("1", "2")
/ correctresponse = (values.cresp)
</trial>

<block myblock>
/ trials = [1-4 = mytrial]
</block>


raynae
raynae
Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)Associate Member (53 reputation)
Group: Forum Members
Posts: 13, Visits: 52
Thank you!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search