Getting a response pad to work with PVT?


Author
Message
drtb
drtb
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 16, Visits: 37
Hello all,

We recently acquired a Cedrus RB-740 for use with the Perceptual Vigilance Task (https://www.millisecond.com/download/library/perceptualvigilancetask/). The (main) problem is that the test is really set up for either a mouse or touchscreen - hence the first "click/tap here to begin" button that appears at the very beginning. 

I've tried putting in "inputdevice = XID" where appropriate, but no button presses on the response pad will advance the intro screen to the actual test. The computer seems to recognize the device as a Lumina keyboard, so we don't think it's necessarily a hardware issue (for now).

Is there a way to get the test to recognize the response pad? Would it be better for us to use the Psychomotor Vigilance Task (https://www.millisecond.com/download/library/psychomotorvigilancetest/) instead? Will/should all of the buttons allow input, or can/should we allow input on only one button?

We are aiming to use the response pad with the N-back as well, so hopefully the same fix will apply.

Thanks in advance!
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: 98K
drtb - Monday, February 25, 2019
Hello all,

We recently acquired a Cedrus RB-740 for use with the Perceptual Vigilance Task (https://www.millisecond.com/download/library/perceptualvigilancetask/). The (main) problem is that the test is really set up for either a mouse or touchscreen - hence the first "click/tap here to begin" button that appears at the very beginning. 

I've tried putting in "inputdevice = XID" where appropriate, but no button presses on the response pad will advance the intro screen to the actual test. The computer seems to recognize the device as a Lumina keyboard, so we don't think it's necessarily a hardware issue (for now).

Is there a way to get the test to recognize the response pad? Would it be better for us to use the Psychomotor Vigilance Task (https://www.millisecond.com/download/library/psychomotorvigilancetest/) instead? Will/should all of the buttons allow input, or can/should we allow input on only one button?

We are aiming to use the response pad with the N-back as well, so hopefully the same fix will apply.

Thanks in advance!

To adapt the script for response pad input, you'll have to change the /inputdevice settings AND modify the /validresponse in <trial start> and <trial USRT> accordingly. Your response pad will send some numerical code upon button a specific button press. The first thing is to figure out the numerical codes for the keys you wish to use. You should be able to run the "Cedrus Lumina and RB Series Response Devices" script available at https://www.millisecond.com/download/library/cedrus/ to figure those codes out (make sure the pad is set to XID-mode; https://www.millisecond.com/support/docs/v5/html/howto/cedrusresponse.htm ).

Alternatively, set up a simple script that just does something like

<block example>
/ trials = [1-5 = exampletrial]
</block>

<trial exampletrial>
/ pretrialpause = 500
/ posttrialpause = 500
/ stimulusframes = [1=exampletext]
/ inputdevice = XID
/ validresponse = (anyresponse)
</trial>

<text exampletext>
/ items = ("Press the button on the response pad")
</text>

The "response" column in the resulting data file should hold the numerical code of interest.

Once you have that code, setting <trial start> and <trial USRT> to something like

<trial start>
/stimulusframes = [1 = targetcircle]
/ isvalidresponse = [trial.start.response == TheNumericalCode]
/ recorddata = false
</trial>

and

<trial USRT>
/ontrialbegin = [
values.trialStart = script.elapsedtime;
values.EarlyResponse = 0;
values.rt = "too early";
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};

values.lastCircleTimestamp = shape.targetcircle.timestamp;
values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ isvalidresponse = [trial.USRT.response == TheNumericalCode]
/ isvalidresponse = [
values.rt_elapsed = script.elapsedtime;
1==1;
]
/ontrialend = [
if (shape.targetcircle.timestamp <= values.lastCircleTimestamp){
values.EarlyResponse = 1;
values.countEarlyResponses += 1;
values.countResponses += 1;
} else {
values.rt = values.rt_elapsed - shape.targetcircle.timestamp;
list.latencies.appenditem(values.rt);
values.countResponses += 1;
};
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>

where TheNumericalCode is the value for the respective key on your response pad (e.g. 12).

drtb
drtb
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 16, Visits: 37
Dave - Monday, February 25, 2019
drtb - Monday, February 25, 2019
Hello all,

We recently acquired a Cedrus RB-740 for use with the Perceptual Vigilance Task (https://www.millisecond.com/download/library/perceptualvigilancetask/). The (main) problem is that the test is really set up for either a mouse or touchscreen - hence the first "click/tap here to begin" button that appears at the very beginning. 

I've tried putting in "inputdevice = XID" where appropriate, but no button presses on the response pad will advance the intro screen to the actual test. The computer seems to recognize the device as a Lumina keyboard, so we don't think it's necessarily a hardware issue (for now).

Is there a way to get the test to recognize the response pad? Would it be better for us to use the Psychomotor Vigilance Task (https://www.millisecond.com/download/library/psychomotorvigilancetest/) instead? Will/should all of the buttons allow input, or can/should we allow input on only one button?

We are aiming to use the response pad with the N-back as well, so hopefully the same fix will apply.

Thanks in advance!

To adapt the script for response pad input, you'll have to change the /inputdevice settings AND modify the /validresponse in <trial start> and <trial USRT> accordingly. Your response pad will send some numerical code upon button a specific button press. The first thing is to figure out the numerical codes for the keys you wish to use. You should be able to run the "Cedrus Lumina and RB Series Response Devices" script available at https://www.millisecond.com/download/library/cedrus/ to figure those codes out (make sure the pad is set to XID-mode; https://www.millisecond.com/support/docs/v5/html/howto/cedrusresponse.htm ).

Alternatively, set up a simple script that just does something like

<block example>
/ trials = [1-5 = exampletrial]
</block>

<trial exampletrial>
/ pretrialpause = 500
/ posttrialpause = 500
/ stimulusframes = [1=exampletext]
/ inputdevice = XID
/ validresponse = (anyresponse)
</trial>

<text exampletext>
/ items = ("Press the button on the response pad")
</text>

The "response" column in the resulting data file should hold the numerical code of interest.

Once you have that code, setting <trial start> and <trial USRT> to something like

<trial start>
/stimulusframes = [1 = targetcircle]
/ isvalidresponse = [trial.start.response == TheNumericalCode]
/ recorddata = false
</trial>

and

<trial USRT>
/ontrialbegin = [
values.trialStart = script.elapsedtime;
values.EarlyResponse = 0;
values.rt = "too early";
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};

values.lastCircleTimestamp = shape.targetcircle.timestamp;
values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ isvalidresponse = [trial.USRT.response == TheNumericalCode]
/ isvalidresponse = [
values.rt_elapsed = script.elapsedtime;
1==1;
]
/ontrialend = [
if (shape.targetcircle.timestamp <= values.lastCircleTimestamp){
values.EarlyResponse = 1;
values.countEarlyResponses += 1;
values.countResponses += 1;
} else {
values.rt = values.rt_elapsed - shape.targetcircle.timestamp;
list.latencies.appenditem(values.rt);
values.countResponses += 1;
};
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>

where TheNumericalCode is the value for the respective key on your response pad (e.g. 12).

Hi Dave,

Thank you very much for your helpful response! As suggested I downloaded the response device script, no issues there - all the buttons seemed to be registering and I was able to see the button presses / response times and whatnot. However, after adjusting the code to how you have it, I still cannot get past the initial screen to move on to the actual PVT test. Any suggestions? I've copy and pasted the code I'm using below.


**************************************************************************************************************
**************************************************************************************************************
EDITABLE PARAMETERS: change editable parameters here
**************************************************************************************************************
**************************************************************************************************************

<parameters>
/targetcolor = red
/targetsize = 5%
/targetx = 50%
/targety = 50%
/screencolor = white
/feedbackheight = 5%
/fixed = 1

/testduration = 600000
/presenttrialfeedback = false
/rtfeedback_duration = 500
</parameters>

**************************************************************************************************************
**************************************************************************************************************
EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************

<instruct>
/ inputdevice = XID
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

Note:
Change instructions to suit your experiment

<page instruct>

^^^In this exercise you will see a circle flash on the screen at random times.

^^^Your task is to press the button as soon as possible once you see the circle.

^^^The exercise will take <%parameters.testduration/1000/60%> minutes to complete.

^^^Whenever you're ready, press the button on the "Continue" button below to start.
</page>

<page feedback>
Exercise complete!
^^
^^Your average/mean response time was: <%expressions.meanRT%> ms
^^Your fastest response time was: <%expressions.minRT%> ms
^^Your slowest response time was : <%expressions.maxRT%> ms
</page>


****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/buttoninstruct1 = {"click your mouse button";}
</expressions>

**************************************************************************************************************
**************************************************************************************************************
EDITABLE LISTS: change editable lists here
**************************************************************************************************************
**************************************************************************************************************

Note:
List.stimulusinterval randomly selects with replacement the amount of time that the focus stimulus will be shown before
presenting the target. (suggested intervals: 1s-10s)

<list stimulusinterval>
/ items = (1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000)
/ replace = true
/ selectionrate = trial
</list>

**************************************************************************************************************
!!!REMAINING CODE: Customize after careful consideration only!!!
**************************************************************************************************************


**************************************************************************************************************
**************************************************************************************************************
DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.0.0 or higher

<defaults>
/canvasaspectratio = (4,3)
/minimumversion = "5.0.0.0"
/inputdevice = XID
/validresponse = (anyresponse)
/ fontstyle = ("Arial", 3.5%)
/ screencolor = white
/ txbgcolor = black
/ txcolor = white
</defaults>

*******************************************************************************************************************
*******************************************************************************************************************
DATA: this section contains data file information
*******************************************************************************************************************
*******************************************************************************************************************

*************************
raw data
*************************
<data>
/ columns = (build, computer.platform, time, subject, blockcode, trialcode, trialnum, parameters.testduration,
parameters.targetcolor, parameters.targetsize, parameters.fixed, parameters.targetx, parameters.targety,
values.stiminterval, response, values.rt)
/ separatefiles = true
</data>


***********************
Summary Data
***********************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed,
parameters.testduration, parameters.targetcolor, parameters.targetsize, parameters.fixed, parameters.targetx, parameters.targety,
expressions.meanRT, expressions.Std, expressions.medianRT, expressions.minRT, expressions.maxRT)
/ separatefiles = true
</summarydata>

*******************************************************************************************************************
*******************************************************************************************************************
VALUES: automatically updated
*******************************************************************************************************************
*******************************************************************************************************************

/completed:0 = script was not completed; 1 = script was completed (all conditions run)

/stiminterval:determines how long the focus stimulus is shown before the target stimulus is presented
/rt:stores the current response latency

<values>
/completed = 0
/stiminterval = 0
/rt = 0
</values>

*******************************************************************************************************************
*******************************************************************************************************************
EXPRESSIONS
*******************************************************************************************************************
*******************************************************************************************************************
/meanRT:calculates the mean response latency (for trials that were responded to)
/StD:calculates the standard deviation of the response latencies (for trials that were responded to)
/medianRT:calculates the median latency (for trials that were responded to)
/minrt:stores the minimum response latency
/maxrt:stores the maximum response latency
Note: list.latencies is used to retrieve all descriptive statistics

<expressions>
/meanRT = list.latencies.mean
/medianRT = list.latencies.median
/Std = list.latencies.standarddeviation
/minRT = list.latencies.minimum
/maxRT = list.latencies.maximum
</expressions>

*******************************************************************************************************************
*******************************************************************************************************************
STIMULI
*******************************************************************************************************************
*******************************************************************************************************************

<shape targetcircle>
/ shape = circle
/ position = (parameters.targetx, parameters.targety)
/ color = red
/ size = (parameters.targetsize*0.75, parameters.targetsize)
</shape>

<text RT_feedback>
/items = ("<%values.rt%>")
/ fontstyle = ("Arial", parameters.feedbackheight, false, false, false, false, 5, 1)
/ txcolor = black
/txbgcolor = white
/ position = (50%, 50%)
</text>

*******************************************************************************************************************
*******************************************************************************************************************
LISTS
*******************************************************************************************************************
*******************************************************************************************************************
Note:
list.targetposition selects randomly an x-coordinate and a y-coordinate, so that the target can appear in 9 different screen locations

<list targetposition>
/items = (5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 55%, 60%, 65%, 70%, 75%, 80%, 85%, 90%, 95%)
/replace = true
/ selectionrate = always
</list>

Data list: stores latencies of all trials that are responded to (fills during runtime).
-> used for descriptive statistics
<list latencies>
</list>

*******************************************************************************************************************
*******************************************************************************************************************
TRIALS
*******************************************************************************************************************
*******************************************************************************************************************

Note: presents the targetcircle and waits for mouse click input to start the test
<trial start>
/stimulusframes = [1 = targetcircle]
/isvalidresponse = [trial.start.response == 2]
/recorddata = false
</trial>

Note:
Main trial: presents the fixationcross and the stimulus (either in a fixed position or randomly) and waits for mouse click
<trial USRT>
/ontrialbegin = [
values.rt = 0;
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};

values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ isvalidresponse = [trial.USRT.response == 2]
/ontrialend = [
if (trial.USRT.response == 2) {
values.rt = trial.USRT.latency - values.stiminterval;
list.latencies.insertitem(values.rt, 1);
}
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>

Note: presents latency feedback for parameters.rtfeedback_duration (editable value)
<trial RT_feedback>
/stimulusframes = [1 = RT_feedback]
/trialduration = parameters.rtfeedback_duration
/recorddata = false
/branch = [trial.usrt]
</trial>

*******************************************************************************************************************
*******************************************************************************************************************
BLOCKS
*******************************************************************************************************************
*******************************************************************************************************************

Note: this is the main block provided. It runs a specified amount of time with either a fixed or a
random position for the target.

<block USRTblock>
/ trials = [1 = start; 2 = USRT]
/ onblockbegin = [block.USRTblock.screencolor = parameters.screencolor]
/timeout = parameters.testduration
</block>

*******************************************************************************************************************
*******************************************************************************************************************
EXPERIMENT
*******************************************************************************************************************
*******************************************************************************************************************
Note: Main script, change according to your needs.

<expt>
/ preinstructions = (instruct)
/ postinstructions = (feedback)
/ blocks = [1=USRTblock]
/onexptend = [values.completed = 1]
</expt>

<monkey>
/ latencydistribution = normal(300, 40)
</monkey>

*******************************************************************************************************************
End of File
*******************************************************************************************************************

drtb
drtb
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 16, Visits: 37
drtb - Thursday, February 28, 2019
Dave - Monday, February 25, 2019
drtb - Monday, February 25, 2019
Hello all,

We recently acquired a Cedrus RB-740 for use with the Perceptual Vigilance Task (https://www.millisecond.com/download/library/perceptualvigilancetask/). The (main) problem is that the test is really set up for either a mouse or touchscreen - hence the first "click/tap here to begin" button that appears at the very beginning. 

I've tried putting in "inputdevice = XID" where appropriate, but no button presses on the response pad will advance the intro screen to the actual test. The computer seems to recognize the device as a Lumina keyboard, so we don't think it's necessarily a hardware issue (for now).

Is there a way to get the test to recognize the response pad? Would it be better for us to use the Psychomotor Vigilance Task (https://www.millisecond.com/download/library/psychomotorvigilancetest/) instead? Will/should all of the buttons allow input, or can/should we allow input on only one button?

We are aiming to use the response pad with the N-back as well, so hopefully the same fix will apply.

Thanks in advance!

To adapt the script for response pad input, you'll have to change the /inputdevice settings AND modify the /validresponse in <trial start> and <trial USRT> accordingly. Your response pad will send some numerical code upon button a specific button press. The first thing is to figure out the numerical codes for the keys you wish to use. You should be able to run the "Cedrus Lumina and RB Series Response Devices" script available at https://www.millisecond.com/download/library/cedrus/ to figure those codes out (make sure the pad is set to XID-mode; https://www.millisecond.com/support/docs/v5/html/howto/cedrusresponse.htm ).

Alternatively, set up a simple script that just does something like

<block example>
/ trials = [1-5 = exampletrial]
</block>

<trial exampletrial>
/ pretrialpause = 500
/ posttrialpause = 500
/ stimulusframes = [1=exampletext]
/ inputdevice = XID
/ validresponse = (anyresponse)
</trial>

<text exampletext>
/ items = ("Press the button on the response pad")
</text>

The "response" column in the resulting data file should hold the numerical code of interest.

Once you have that code, setting <trial start> and <trial USRT> to something like

<trial start>
/stimulusframes = [1 = targetcircle]
/ isvalidresponse = [trial.start.response == TheNumericalCode]
/ recorddata = false
</trial>

and

<trial USRT>
/ontrialbegin = [
values.trialStart = script.elapsedtime;
values.EarlyResponse = 0;
values.rt = "too early";
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};

values.lastCircleTimestamp = shape.targetcircle.timestamp;
values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ isvalidresponse = [trial.USRT.response == TheNumericalCode]
/ isvalidresponse = [
values.rt_elapsed = script.elapsedtime;
1==1;
]
/ontrialend = [
if (shape.targetcircle.timestamp <= values.lastCircleTimestamp){
values.EarlyResponse = 1;
values.countEarlyResponses += 1;
values.countResponses += 1;
} else {
values.rt = values.rt_elapsed - shape.targetcircle.timestamp;
list.latencies.appenditem(values.rt);
values.countResponses += 1;
};
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>

where TheNumericalCode is the value for the respective key on your response pad (e.g. 12).

Hi Dave,

Thank you very much for your helpful response! As suggested I downloaded the response device script, no issues there - all the buttons seemed to be registering and I was able to see the button presses / response times and whatnot. However, after adjusting the code to how you have it, I still cannot get past the initial screen to move on to the actual PVT test. Any suggestions? I've copy and pasted the code I'm using below.


**************************************************************************************************************
**************************************************************************************************************
EDITABLE PARAMETERS: change editable parameters here
**************************************************************************************************************
**************************************************************************************************************

<parameters>
/targetcolor = red
/targetsize = 5%
/targetx = 50%
/targety = 50%
/screencolor = white
/feedbackheight = 5%
/fixed = 1

/testduration = 600000
/presenttrialfeedback = false
/rtfeedback_duration = 500
</parameters>

**************************************************************************************************************
**************************************************************************************************************
EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************

<instruct>
/ inputdevice = XID
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

Note:
Change instructions to suit your experiment

<page instruct>

^^^In this exercise you will see a circle flash on the screen at random times.

^^^Your task is to press the button as soon as possible once you see the circle.

^^^The exercise will take <%parameters.testduration/1000/60%> minutes to complete.

^^^Whenever you're ready, press the button on the "Continue" button below to start.
</page>

<page feedback>
Exercise complete!
^^
^^Your average/mean response time was: <%expressions.meanRT%> ms
^^Your fastest response time was: <%expressions.minRT%> ms
^^Your slowest response time was : <%expressions.maxRT%> ms
</page>


****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/buttoninstruct1 = {"click your mouse button";}
</expressions>

**************************************************************************************************************
**************************************************************************************************************
EDITABLE LISTS: change editable lists here
**************************************************************************************************************
**************************************************************************************************************

Note:
List.stimulusinterval randomly selects with replacement the amount of time that the focus stimulus will be shown before
presenting the target. (suggested intervals: 1s-10s)

<list stimulusinterval>
/ items = (1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000)
/ replace = true
/ selectionrate = trial
</list>

**************************************************************************************************************
!!!REMAINING CODE: Customize after careful consideration only!!!
**************************************************************************************************************


**************************************************************************************************************
**************************************************************************************************************
DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.0.0 or higher

<defaults>
/canvasaspectratio = (4,3)
/minimumversion = "5.0.0.0"
/inputdevice = XID
/validresponse = (anyresponse)
/ fontstyle = ("Arial", 3.5%)
/ screencolor = white
/ txbgcolor = black
/ txcolor = white
</defaults>

*******************************************************************************************************************
*******************************************************************************************************************
DATA: this section contains data file information
*******************************************************************************************************************
*******************************************************************************************************************

*************************
raw data
*************************
<data>
/ columns = (build, computer.platform, time, subject, blockcode, trialcode, trialnum, parameters.testduration,
parameters.targetcolor, parameters.targetsize, parameters.fixed, parameters.targetx, parameters.targety,
values.stiminterval, response, values.rt)
/ separatefiles = true
</data>


***********************
Summary Data
***********************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed,
parameters.testduration, parameters.targetcolor, parameters.targetsize, parameters.fixed, parameters.targetx, parameters.targety,
expressions.meanRT, expressions.Std, expressions.medianRT, expressions.minRT, expressions.maxRT)
/ separatefiles = true
</summarydata>

*******************************************************************************************************************
*******************************************************************************************************************
VALUES: automatically updated
*******************************************************************************************************************
*******************************************************************************************************************

/completed:0 = script was not completed; 1 = script was completed (all conditions run)

/stiminterval:determines how long the focus stimulus is shown before the target stimulus is presented
/rt:stores the current response latency

<values>
/completed = 0
/stiminterval = 0
/rt = 0
</values>

*******************************************************************************************************************
*******************************************************************************************************************
EXPRESSIONS
*******************************************************************************************************************
*******************************************************************************************************************
/meanRT:calculates the mean response latency (for trials that were responded to)
/StD:calculates the standard deviation of the response latencies (for trials that were responded to)
/medianRT:calculates the median latency (for trials that were responded to)
/minrt:stores the minimum response latency
/maxrt:stores the maximum response latency
Note: list.latencies is used to retrieve all descriptive statistics

<expressions>
/meanRT = list.latencies.mean
/medianRT = list.latencies.median
/Std = list.latencies.standarddeviation
/minRT = list.latencies.minimum
/maxRT = list.latencies.maximum
</expressions>

*******************************************************************************************************************
*******************************************************************************************************************
STIMULI
*******************************************************************************************************************
*******************************************************************************************************************

<shape targetcircle>
/ shape = circle
/ position = (parameters.targetx, parameters.targety)
/ color = red
/ size = (parameters.targetsize*0.75, parameters.targetsize)
</shape>

<text RT_feedback>
/items = ("<%values.rt%>")
/ fontstyle = ("Arial", parameters.feedbackheight, false, false, false, false, 5, 1)
/ txcolor = black
/txbgcolor = white
/ position = (50%, 50%)
</text>

*******************************************************************************************************************
*******************************************************************************************************************
LISTS
*******************************************************************************************************************
*******************************************************************************************************************
Note:
list.targetposition selects randomly an x-coordinate and a y-coordinate, so that the target can appear in 9 different screen locations

<list targetposition>
/items = (5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 55%, 60%, 65%, 70%, 75%, 80%, 85%, 90%, 95%)
/replace = true
/ selectionrate = always
</list>

Data list: stores latencies of all trials that are responded to (fills during runtime).
-> used for descriptive statistics
<list latencies>
</list>

*******************************************************************************************************************
*******************************************************************************************************************
TRIALS
*******************************************************************************************************************
*******************************************************************************************************************

Note: presents the targetcircle and waits for mouse click input to start the test
<trial start>
/stimulusframes = [1 = targetcircle]
/isvalidresponse = [trial.start.response == 2]
/recorddata = false
</trial>

Note:
Main trial: presents the fixationcross and the stimulus (either in a fixed position or randomly) and waits for mouse click
<trial USRT>
/ontrialbegin = [
values.rt = 0;
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};

values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ isvalidresponse = [trial.USRT.response == 2]
/ontrialend = [
if (trial.USRT.response == 2) {
values.rt = trial.USRT.latency - values.stiminterval;
list.latencies.insertitem(values.rt, 1);
}
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>

Note: presents latency feedback for parameters.rtfeedback_duration (editable value)
<trial RT_feedback>
/stimulusframes = [1 = RT_feedback]
/trialduration = parameters.rtfeedback_duration
/recorddata = false
/branch = [trial.usrt]
</trial>

*******************************************************************************************************************
*******************************************************************************************************************
BLOCKS
*******************************************************************************************************************
*******************************************************************************************************************

Note: this is the main block provided. It runs a specified amount of time with either a fixed or a
random position for the target.

<block USRTblock>
/ trials = [1 = start; 2 = USRT]
/ onblockbegin = [block.USRTblock.screencolor = parameters.screencolor]
/timeout = parameters.testduration
</block>

*******************************************************************************************************************
*******************************************************************************************************************
EXPERIMENT
*******************************************************************************************************************
*******************************************************************************************************************
Note: Main script, change according to your needs.

<expt>
/ preinstructions = (instruct)
/ postinstructions = (feedback)
/ blocks = [1=USRTblock]
/onexptend = [values.completed = 1]
</expt>

<monkey>
/ latencydistribution = normal(300, 40)
</monkey>

*******************************************************************************************************************
End of File
*******************************************************************************************************************

Quick addendum - even if I delete the "preinstructions" portion of the experiment script and have the program launch straight into the start trial, none of the button presses on the response box will register / make the red circle disappear. I have a keyboard and mouse attached to the same computer - not sure if I'm confusing the PVT script by having multiple "potential" input devices hooked up?
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: 98K
drtb - Thursday, February 28, 2019

Quick addendum - even if I delete the "preinstructions" portion of the experiment script and have the program launch straight into the start trial, none of the button presses on the response box will register / make the red circle disappear. I have a keyboard and mouse attached to the same computer - not sure if I'm confusing the PVT script by having multiple "potential" input devices hooked up?

Let's try with the following change / addition in <trial start> and <trial USRT>:


<trial start>
/stimulusframes = [1 = targetcircle]
/ validresponse = (anyresponse)
/ isvalidresponse = [trial.start.response == 2]
/recorddata = false
</trial>

<trial USRT>
/ontrialbegin = [
values.rt = 0;
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};

values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ validresponse = (anyresponse)
/ isvalidresponse = [trial.USRT.response == 2]
/ontrialend = [
if (trial.USRT.response == 2) {
values.rt = trial.USRT.latency - values.stiminterval;
list.latencies.insertitem(values.rt, 1);
}
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>



Edited 5 Years Ago by Dave
drtb
drtb
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 16, Visits: 37
Dave - Thursday, February 28, 2019
drtb - Thursday, February 28, 2019

Quick addendum - even if I delete the "preinstructions" portion of the experiment script and have the program launch straight into the start trial, none of the button presses on the response box will register / make the red circle disappear. I have a keyboard and mouse attached to the same computer - not sure if I'm confusing the PVT script by having multiple "potential" input devices hooked up?

Let's try with the following change / addition in <trial start> and <trial USRT>:


<trial start>
/stimulusframes = [1 = targetcircle]
/ validresponse = (anyresponse)
/ isvalidresponse = [trial.start.response == 2]
/recorddata = false
</trial>

<trial USRT>
/ontrialbegin = [
values.rt = 0;
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};

values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ validresponse = (anyresponse)
/ isvalidresponse = [trial.USRT.response == 2]
/ontrialend = [
if (trial.USRT.response == 2) {
values.rt = trial.USRT.latency - values.stiminterval;
list.latencies.insertitem(values.rt, 1);
}
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>



OK awesome - that mostly worked. When I deleted the /preinstructions and /postinstructions, I was able to get it to recognize the appropriate button press from the response box. Thanks! Only problem now is that adding back in the /preinstructions still results in that opening screen which I still can't move past. I even tried changing the "instruct" portion by adding the following (in bold):

<instruct>
/ inputdevice = XID
/ validresponse = (anyresponse)
/ isvalidresponse = [instruct.response == 80]

/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

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: 98K
drtb - Thursday, February 28, 2019
Dave - Thursday, February 28, 2019
drtb - Thursday, February 28, 2019

Quick addendum - even if I delete the "preinstructions" portion of the experiment script and have the program launch straight into the start trial, none of the button presses on the response box will register / make the red circle disappear. I have a keyboard and mouse attached to the same computer - not sure if I'm confusing the PVT script by having multiple "potential" input devices hooked up?

Let's try with the following change / addition in <trial start> and <trial USRT>:


<trial start>
/stimulusframes = [1 = targetcircle]
/ validresponse = (anyresponse)
/ isvalidresponse = [trial.start.response == 2]
/recorddata = false
</trial>

<trial USRT>
/ontrialbegin = [
values.rt = 0;
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};

values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ validresponse = (anyresponse)
/ isvalidresponse = [trial.USRT.response == 2]
/ontrialend = [
if (trial.USRT.response == 2) {
values.rt = trial.USRT.latency - values.stiminterval;
list.latencies.insertitem(values.rt, 1);
}
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>



OK awesome - that mostly worked. When I deleted the /preinstructions and /postinstructions, I was able to get it to recognize the appropriate button press from the response box. Thanks! Only problem now is that adding back in the /preinstructions still results in that opening screen which I still can't move past. I even tried changing the "instruct" portion by adding the following (in bold):

<instruct>
/ inputdevice = XID
/ validresponse = (anyresponse)
/ isvalidresponse = [instruct.response == 80]

/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

Syntax in the <instruct> element works somewhat differently. It has no /validresponse or /isvalidresponse attributes. You would need to define /nextkey if you want to accept response box input for instruction pages:

<instruct>
...
/ inputdevice = xid
/ nextkey = (80)

</instruct>

https://www.millisecond.com/support/docs/v5/html/language/elements/instruct.htm

Alternatively, you can either use the mouse or keyboard for navigating instructions (set /inputdevice accordingly), or -- if you prefer -- you can forego <page> elements entirely and set up a simple <trial> and <block> to display instructions and navigate through that using the response box.

drtb
drtb
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 16, Visits: 37
Dave - Thursday, February 28, 2019
drtb - Thursday, February 28, 2019
Dave - Thursday, February 28, 2019
drtb - Thursday, February 28, 2019

Quick addendum - even if I delete the "preinstructions" portion of the experiment script and have the program launch straight into the start trial, none of the button presses on the response box will register / make the red circle disappear. I have a keyboard and mouse attached to the same computer - not sure if I'm confusing the PVT script by having multiple "potential" input devices hooked up?

Let's try with the following change / addition in <trial start> and <trial USRT>:


<trial start>
/stimulusframes = [1 = targetcircle]
/ validresponse = (anyresponse)
/ isvalidresponse = [trial.start.response == 2]
/recorddata = false
</trial>

<trial USRT>
/ontrialbegin = [
values.rt = 0;
if (parameters.fixed == 1)
{parameters.targetx = list.targetposition.nextvalue;
parameters.targety= list.targetposition.nextvalue};

values.stiminterval = list.stimulusinterval.nextvalue;
trial.USRT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ontrialend = [trial.USRT.resetstimulusframes()]
/responseinterrupt = immediate
/beginresponsetime = 0
/ validresponse = (anyresponse)
/ isvalidresponse = [trial.USRT.response == 2]
/ontrialend = [
if (trial.USRT.response == 2) {
values.rt = trial.USRT.latency - values.stiminterval;
list.latencies.insertitem(values.rt, 1);
}
]
/ branch = [if (parameters.presenttrialfeedback == true) trial.rt_feedback else trial.usrt]
</trial>



OK awesome - that mostly worked. When I deleted the /preinstructions and /postinstructions, I was able to get it to recognize the appropriate button press from the response box. Thanks! Only problem now is that adding back in the /preinstructions still results in that opening screen which I still can't move past. I even tried changing the "instruct" portion by adding the following (in bold):

<instruct>
/ inputdevice = XID
/ validresponse = (anyresponse)
/ isvalidresponse = [instruct.response == 80]

/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

Syntax in the <instruct> element works somewhat differently. It has no /validresponse or /isvalidresponse attributes. You would need to define /nextkey if you want to accept response box input for instruction pages:

<instruct>
...
/ inputdevice = xid
/ nextkey = (80)

</instruct>

https://www.millisecond.com/support/docs/v5/html/language/elements/instruct.htm

Alternatively, you can either use the mouse or keyboard for navigating instructions (set /inputdevice accordingly), or -- if you prefer -- you can forego <page> elements entirely and set up a simple <trial> and <block> to display instructions and navigate through that using the response box.

That worked!!! You're the best! 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