Millisecond Forums

Sending Signals to Serial Port Using StimulusTimes on Go/No-Go

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

By neuromech - 3/12/2024

I am currently working with the published Go/No-Go Task template provided for Inquisit. I am trying to figure out how to send signals to a serial port with different stimuli presentations, but am having trouble structuring my script given the use of /stimulustimes and varied presentations of stimuli after the fixation in the task. 

I've attached a snippet of the script below for a vertical cue + go stimulus presentation. Say I have already designed four different signals earlier in the script:
port.verticalcue
port.verticalgo
port.correct
port.incorrect


How would I edit the script below so that the signals above are presented at the following time:
port.verticalcue -> when picture.verticalcue is displayed
port.verticalgo -> when picture.verticalgo is displayed
port.correct -> When the participant correctly responds
port.incorrect -> When the participant incorrectly responds

I understand that the task overall has 4 different trial blocks. But I am hoping the responses I receive here will help me reconfigure the other 3 trials.

<trial verticalcue_go>
/ ontrialbegin = [
    values.cuetype = 1;
    values.targettype = 1;
    values.soa=list.soa_verticalcue_go.nextvalue;
    values.trialcount+=1;

    trial.verticalcue_go.insertstimulustime(shape.blankscreen, parameters.fixationduration);
    trial.verticalcue_go.insertstimulustime(picture.verticalcue,(parameters.fixationduration+parameters.cue_delay));
    trial.verticalcue_go.insertstimulustime(picture.verticalgotarget,(parameters.fixationduration+parameters.cue_delay+values.soa));
]

/ stimulustimes = [0=blankscreen,fixation]
/ beginresponsetime = parameters.fixationduration + parameters.cue_delay + values.soa
/ responseinterrupt = immediate
/ validresponse = (" ", noresponse)
/ correctresponse = (" ")
/ response = timeout(parameters.responsetimeout)
/ ontrialend = [
    list.accuracy.appenditem(trial.verticalcue_go.correct);
    list.accuracy_G.appenditem(trial.verticalcue_go.correct);
    list.accuracy_v.appenditem(trial.verticalcue_go.correct);    
    list.accuracy_vG.appenditem(trial.verticalcue_go.correct);
    if (trial.verticalcue_go.correct) {
        list.latencies_G.appenditem(trial.verticalcue_go.latency);
        list.latencies_vG.appenditem(trial.verticalcue_go.latency);
    };
    values.cuepic = picture.verticalcue.currentitem;
    values.targetpic = picture.verticalgotarget.currentitem;
    trial.verticalcue_go.resetstimulusframes();
]
/ recorddata = true
/ posttrialpause = parameters.iti
</trial>
By Dave - 3/12/2024

neuromech - 3/12/2024
I am currently working with the published Go/No-Go Task template provided for Inquisit. I am trying to figure out how to send signals to a serial port with different stimuli presentations, but am having trouble structuring my script given the use of /stimulustimes and varied presentations of stimuli after the fixation in the task. 

I've attached a snippet of the script below for a vertical cue + go stimulus presentation. Say I have already designed four different signals earlier in the script:
port.verticalcue
port.verticalgo
port.correct
port.incorrect


How would I edit the script below so that the signals above are presented at the following time:
port.verticalcue -> when picture.verticalcue is displayed
port.verticalgo -> when picture.verticalgo is displayed
port.correct -> When the participant correctly responds
port.incorrect -> When the participant incorrectly responds

I understand that the task overall has 4 different trial blocks. But I am hoping the responses I receive here will help me reconfigure the other 3 trials.

<trial verticalcue_go>
/ ontrialbegin = [
    values.cuetype = 1;
    values.targettype = 1;
    values.soa=list.soa_verticalcue_go.nextvalue;
    values.trialcount+=1;

    trial.verticalcue_go.insertstimulustime(shape.blankscreen, parameters.fixationduration);
    trial.verticalcue_go.insertstimulustime(picture.verticalcue,(parameters.fixationduration+parameters.cue_delay));
    trial.verticalcue_go.insertstimulustime(picture.verticalgotarget,(parameters.fixationduration+parameters.cue_delay+values.soa));
]

/ stimulustimes = [0=blankscreen,fixation]
/ beginresponsetime = parameters.fixationduration + parameters.cue_delay + values.soa
/ responseinterrupt = immediate
/ validresponse = (" ", noresponse)
/ correctresponse = (" ")
/ response = timeout(parameters.responsetimeout)
/ ontrialend = [
    list.accuracy.appenditem(trial.verticalcue_go.correct);
    list.accuracy_G.appenditem(trial.verticalcue_go.correct);
    list.accuracy_v.appenditem(trial.verticalcue_go.correct);    
    list.accuracy_vG.appenditem(trial.verticalcue_go.correct);
    if (trial.verticalcue_go.correct) {
        list.latencies_G.appenditem(trial.verticalcue_go.latency);
        list.latencies_vG.appenditem(trial.verticalcue_go.latency);
    };
    values.cuepic = picture.verticalcue.currentitem;
    values.targetpic = picture.verticalgotarget.currentitem;
    trial.verticalcue_go.resetstimulusframes();
]
/ recorddata = true
/ posttrialpause = parameters.iti
</trial>

A <port> element is a stimulus element just like <text>, <picture>, etc. You treat it in exactly the same way.

Use insertstimulustime to display the port stimulus at the same time as the relevent picture element.

Use /correctmessage to display the relevant port stimulus upon a correct response.
Use /errormessage to display the relevant port stimulus upon an incorrect response.