Millisecond Forums

Response not reconized when responsekey is pressed

https://forums.millisecond.com/Topic30911.aspx

By Tylhi - 2/23/2021

Hi,

I'm currently working on a task, I'm stuck with a problem.
Indeed I have set the spacebar (57) as the responsekey and when I push on it to test my task nothing happen, it's not received neither recorded.

Could you help me to fix this issue ?

Best,
Margaux

Below parts of the script that could be the source of the problem.

<parameters>
/responseKey = 57
/responseKeyLabel = "space"
/fixationSize = 8%
/picSize = 100%
/pictureDuration = 200
/fixationDurationRandom = true
/fixationFixed = 500
/blankDuration = 1000
/XXXXXXXDuration = 50
/trialduration = 1250
</parameters>

.....

<defaults >
/ inputdevice = keyboard
/canvasaspectratio = (4,3)
/minimumversion = "6.3.5.0"
/ fontstyle = ("Courier New", 25pt, true)
/ screencolor = white
/ txcolor = black
/ txbgcolor = white
</defaults>

.....

#Practice#
<trial Go_P>
/ inputdevice=keyboard
/ ontrialbegin = [
  values.gotype = list.Go.nextvalue;
     values.trialcount+=1;
    
]

/ stimulustimes = [0 = Go; 200=XXXXXXX; 250=blank; 1250=clearscreen]
/ trialduration = parameters.trialduration
/ validresponse = (parameters.responseKey, noresponse)
/ correctresponse = (parameters.responseKey)

/ ontrialend = [
 list.accuracy_P.insertitem(trial.Go_P.correct, 1);
 list.accuracy_G_P.insertitem(trial.Go_P.correct, 1);
 
 if (trial.Go_P.correct)
                {
                    list.latencies_P.insertitem(trial.Go_P.latency, 1);
                    list.latencies_G_P.insertitem(trial.Go_P.latency, 1);
                };
    values.itempic = text.Go;
    trial.Go_P.resetstimulusframes();
]
/ branch = [if (trial.Go_P.response == 0) trial.overtime]
/ branch = [if (trial.Go_P.error) trial.wrong]
/ branch = [if (trial.Go_P.correct) trial.correct]
/ recorddata = true

</trial>

<trial NoGo_P>
/ inputdevice=keyboard
/ ontrialbegin = [
  values.gotype = list.NoGo.nextvalue;
     values.trialcount+=1;
    
]

/ stimulustimes = [0 = NoGo; 200=XXXXXXX; 250=blank; 1250=clearscreen]
/ trialduration = parameters.trialduration
/ validresponse = (parameters.responseKey, noresponse)
/ correctresponse = (0)

/ ontrialend = [
 list.accuracy_P.insertitem(trial.NoGo_P.correct, 1);
 list.accuracy_G_P.insertitem(trial.NoGo_P.correct, 1);
 
 if (trial.NoGo_P.correct)
                {
                    list.latencies_P.insertitem(trial.NoGo_P.latency, 1);
                    list.latencies_G_P.insertitem(trial.NoGo_P.latency, 1);
                };
    values.itempic = text.NoGo;
    trial.NoGo_P.resetstimulusframes();
]
/ branch = [if (trial.NoGo_P.error) trial.wrong]
/ branch = [if (trial.NoGo_P.response == 0) trial.correct]
/ recorddata = true


</trial>

<trial fixation>
/ ontrialbegin = [
    if (parameters.fixationDurationRandom == true){
        values.fixation = list.fixation.nextvalue;        
    } else {
        values.fixation = parameters.fixationFixed;
    };
    
]

/stimulustimes = [0=clearscreen, fixation]
/beginresponsetime = values.fixation
/responseinterrupt =trial
/responsemode = noresponse
</trial>
By Dave - 2/23/2021

Tylhi - 2/23/2021
Hi,

I'm currently working on a task, I'm stuck with a problem.
Indeed I have set the spacebar (57) as the responsekey and when I push on it to test my task nothing happen, it's not received neither recorded.

Could you help me to fix this issue ?

Best,
Margaux

Below parts of the script that could be the source of the problem.

<parameters>
/responseKey = 57
/responseKeyLabel = "space"
/fixationSize = 8%
/picSize = 100%
/pictureDuration = 200
/fixationDurationRandom = true
/fixationFixed = 500
/blankDuration = 1000
/XXXXXXXDuration = 50
/trialduration = 1250
</parameters>

.....

<defaults >
/ inputdevice = keyboard
/canvasaspectratio = (4,3)
/minimumversion = "6.3.5.0"
/ fontstyle = ("Courier New", 25pt, true)
/ screencolor = white
/ txcolor = black
/ txbgcolor = white
</defaults>

.....

#Practice#
<trial Go_P>
/ inputdevice=keyboard
/ ontrialbegin = [
  values.gotype = list.Go.nextvalue;
     values.trialcount+=1;
    
]

/ stimulustimes = [0 = Go; 200=XXXXXXX; 250=blank; 1250=clearscreen]
/ trialduration = parameters.trialduration
/ validresponse = (parameters.responseKey, noresponse)
/ correctresponse = (parameters.responseKey)

/ ontrialend = [
 list.accuracy_P.insertitem(trial.Go_P.correct, 1);
 list.accuracy_G_P.insertitem(trial.Go_P.correct, 1);
 
 if (trial.Go_P.correct)
                {
                    list.latencies_P.insertitem(trial.Go_P.latency, 1);
                    list.latencies_G_P.insertitem(trial.Go_P.latency, 1);
                };
    values.itempic = text.Go;
    trial.Go_P.resetstimulusframes();
]
/ branch = [if (trial.Go_P.response == 0) trial.overtime]
/ branch = [if (trial.Go_P.error) trial.wrong]
/ branch = [if (trial.Go_P.correct) trial.correct]
/ recorddata = true

</trial>

<trial NoGo_P>
/ inputdevice=keyboard
/ ontrialbegin = [
  values.gotype = list.NoGo.nextvalue;
     values.trialcount+=1;
    
]

/ stimulustimes = [0 = NoGo; 200=XXXXXXX; 250=blank; 1250=clearscreen]
/ trialduration = parameters.trialduration
/ validresponse = (parameters.responseKey, noresponse)
/ correctresponse = (0)

/ ontrialend = [
 list.accuracy_P.insertitem(trial.NoGo_P.correct, 1);
 list.accuracy_G_P.insertitem(trial.NoGo_P.correct, 1);
 
 if (trial.NoGo_P.correct)
                {
                    list.latencies_P.insertitem(trial.NoGo_P.latency, 1);
                    list.latencies_G_P.insertitem(trial.NoGo_P.latency, 1);
                };
    values.itempic = text.NoGo;
    trial.NoGo_P.resetstimulusframes();
]
/ branch = [if (trial.NoGo_P.error) trial.wrong]
/ branch = [if (trial.NoGo_P.response == 0) trial.correct]
/ recorddata = true


</trial>

<trial fixation>
/ ontrialbegin = [
    if (parameters.fixationDurationRandom == true){
        values.fixation = list.fixation.nextvalue;        
    } else {
        values.fixation = parameters.fixationFixed;
    };
    
]

/stimulustimes = [0=clearscreen, fixation]
/beginresponsetime = values.fixation
/responseinterrupt =trial
/responsemode = noresponse
</trial>

/ stimulustimes = [0 = NoGo; 200=XXXXXXX; 250=blank; 1250=clearscreen]
/ trialduration = parameters.trialduration

By default, the trial will not begin accepting responses until the last stimulus has been show (here: clearscreen at 1250ms). That is also the time where the trial effectively ends per your /trialduration. There is no time to submit any response. You need to use /beginresponsetime and, depending on how you want the trial to behave after having received a response, /responseinterrupt.

https://www.millisecond.com/support/docs/v6/html/language/attributes/beginresponsetime.htm
https://www.millisecond.com/support/docs/v6/html/language/attributes/responseinterrupt.htm

By Tylhi - 2/23/2021

Thanks a lot for your quick and very helpful answer :)

Best,
Margaux