Interleave scripts during memory delay


Author
Message
CogNeurotic
CogNeurotic
Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)
Group: Forum Members
Posts: 4, Visits: 38
Hi all,
I'm hoping to run a study in which I string together several pre-programmed Inquisit experiments, which I am currently doing via a batch script (see below). The tricky part is that some of the experiments are memory tasks with a timed delay (e.g., 30 minutes for the FNAME paradigm, link to the manual below), and I want to fill this delay with other experiments (e.g., srtvisual.iqx, msletternumbersequencingtest_auditory.iqx, etc.). I've done this by splitting FNAME into two parts: the part before the delay ("cog.battery.2021.iqx") and the part after the delay ("facenamepart2.iqx"), and calling on the other studies in between. However, it's important that the post-delay script ("facenamepart2.iqx") is as close to 30 minutes as possible. Is there a way to call on the last script based on the amount of time that has passed since the first script ended? I envision having "cog.battery.2021.iqx" run, then the other in-between tasks (which will total around 25-28 minutes run-time), and then having it hang onto a message "take a short break" until the remainder of the 30 minutes has elapsed. I'm not sure where to begin with this--any help is much appreciated.
Thanks!

<batch>
/file= "cog.battery.2021.iqx"
/file= "srtvisual.iqx"
/file= "msletternumbersequencingtest_auditory.iqx"
/file= "digitsymbolsubstitutiontask_test1.iqx"
/file= "facenamepart2.iqx"
</batch>


Tags
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: 13K, Visits: 104K
CogNeurotic - 2/9/2021
Hi all,
I'm hoping to run a study in which I string together several pre-programmed Inquisit experiments, which I am currently doing via a batch script (see below). The tricky part is that some of the experiments are memory tasks with a timed delay (e.g., 30 minutes for the FNAME paradigm, link to the manual below), and I want to fill this delay with other experiments (e.g., srtvisual.iqx, msletternumbersequencingtest_auditory.iqx, etc.). I've done this by splitting FNAME into two parts: the part before the delay ("cog.battery.2021.iqx") and the part after the delay ("facenamepart2.iqx"), and calling on the other studies in between. However, it's important that the post-delay script ("facenamepart2.iqx") is as close to 30 minutes as possible. Is there a way to call on the last script based on the amount of time that has passed since the first script ended? I envision having "cog.battery.2021.iqx" run, then the other in-between tasks (which will total around 25-28 minutes run-time), and then having it hang onto a message "take a short break" until the remainder of the 30 minutes has elapsed. I'm not sure where to begin with this--any help is much appreciated.
Thanks!

<batch>
/file= "cog.battery.2021.iqx"
/file= "srtvisual.iqx"
/file= "msletternumbersequencingtest_auditory.iqx"
/file= "digitsymbolsubstitutiontask_test1.iqx"
/file= "facenamepart2.iqx"
</batch>


You might be able to do something with batch values and parameters ( https://www.millisecond.com/support/docs/v6/html/howto/batchparameters.htm ), summing up the intervening scripts' script.elapsedtime and then setting the duration of a wait trial at the start of the facename part 2 script dynamically based on that value.

CogNeurotic
CogNeurotic
Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)
Group: Forum Members
Posts: 4, Visits: 38
Hi,
Thanks for this, I get the logic and am working on executing it. My programming skills are rusty, and this is my first time using Inquisit, so I really appreciate your help.  

I believe I have successfully edited my "script A" (srtvisualA.iqx), but I'm running into trouble in the batch script. I get the error: 'batch.currentscript' Expression contains an invalid identifier. (Element: "batch.1", attribute: onscriptend; script: batch.cogbattery2.iqx
Could you take a look and see where the issue is?
I've inserted the code for each below; one after the other, and attached the files. One note: for the purposes of running through the script, I've futzed around with srtvisualA.iqx to show me the elapsed time and to only run one trial for each block.) 

Thanks again for your help,
D

* Here we define the batch parameters *
<parameters>
/ StartElapsedDelayTime = 0
</parameters>

* Here we defined the batch values *
<values>
/ TotalTimeA = 0
</values>

<batch>
/ file= "srtvisualA.iqx"
/ onscriptend = [
  if (batch.currentscript == "srtvisualA.iqx")
  {
   parameters.StartElapsedDelayTime = values.TotalTimeA;
  }
]
</batch>

<usermanual>
___________________________________________________________________________________________________________________    

                                    SIMPLE REACTION TIME TASK - visual
___________________________________________________________________________________________________________________

Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
last updated: 01-26-2016 by K.Borchert (katjab@millisecond.com) for Millisecond Software LLC

last updated: 03-11-2020 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright © 03-11-2020 Millisecond Software

___________________________________________________________________________________________________________________
BACKGROUND INFO     
___________________________________________________________________________________________________________________    

This script runs a simple visual reaction time task.

___________________________________________________________________________________________________________________
TASK DESCRIPTION    
___________________________________________________________________________________________________________________    
The participant gets presented a fixation cross that is followed after variable time intervals
by a visual target stimulus (here: circle). The participant's task is to press the spacebar as soon as the
target stimulus appears on the screen. Latency, mean latency, and latency standard deviation
are recorded in the data file.

___________________________________________________________________________________________________________________    
DURATION
___________________________________________________________________________________________________________________    
the default set-up of the script takes appr. 4 minutes to complete

___________________________________________________________________________________________________________________    
DATA FILE INFORMATION
___________________________________________________________________________________________________________________    
The default data stored in the data files are:

(1) Raw data file: 'srtvisual_raw*.iqdat' (a separate file for each participant)

build:                                The specific Inquisit version used (the 'build') that was run
computer.platform:                    the platform the script was run on (win/mac/ios/android)
date, time,                         date and time script was run
subject, group,                     with the current subject/groupnumber
script.sessionid:                    with the current session id

blockcode, blocknum:                the name and number of the current block (built-in Inquisit variable)
trialcode, trialnum:                 the name and number of the currently recorded trial (built-in Inquisit variable)
                                        Note: trialnum is a built-in Inquisit variable; it counts all trials run; even those
                                        that do not store data to the data file.
                                        
stimulusitem:                        the first presented stimulus (=fixation cross)
parameters.focusx:                    the x-coordinate of the fixation cross
parameters.focusy:                    the y-coordinate of the fixation cross
parameters.focuscolor:                the color of the fixation cross
parameters.focussize:                the size of the fixation cross
stimulusitem:                        the second presented stimulus (=target)
parameters.targetcolor:                the current color of the target circle
parameters.targetsize:                the current color of the target circle
parameters.targetx:                    the x-coordinate of the target circle
parameters.targety:                    the y-coordinate of the target circle
parameters.fixed:                    0= fixed position of target; 1 = random position of target
parameters.maxtrialnumber:            the number of trials in a block
trials.SRTT.count    :                counts the SRTT trials run in a given block
values.stiminterval:                the current stimulus interval
latency:                            the latency of the response (in ms)
trial.SRTT.meanlatency:                the mean latency in the current block (in ms)
trial.SRTT.medianlatency:            the median latency in the current block (in ms)
trial.SRTT.minlatency:                the fastest response in the current block (in ms)
trial.SRTT.maxlatency:                the slowest response in the current block (in ms)
trial.SRTT.sdlatency:                the standard deviation of the latency responses in the current block
trial.SRTT.varlatency:                the variance of the latency responses in the current block
trial.SRTT.totalmeanlatency:        the mean latency across all trials.SRTT (in ms)
trial.SRTT.totalmedianlatency:        the median latency across all trials.SRTT (in ms)
trial.SRTT.totalminlatency:            the fastest response across all trials SRTT (in ms)
trial.SRTT.totalmaxlatency:            the slowest response across all trials SRTT (in ms)
trial.SRTT.totalsdlatency:            the the standard deviation of the latency responses across all trials SRTT
trial.SRTT.totalvarlatency:            the variance of the latency responses across all trials SRTT


(2) Summary data file: 'srtvisual_summary*.iqdat' (a separate file for each participant)

computer.platform:                    the platform the script was run on (win/mac/ios/android)
script.startdate:                    date script was run
script.starttime:                    time script was started
script.subjectid:                    assigned subject id number
script.groupid:                        assigned group id number
script.sessionid:                    assigned session id number
script.elapsedtime:                    time it took to run script (in ms); measured from onset to offset of script
script.completed:                    0 = script was not completed (prematurely aborted);
                                    1 = script was completed (all conditions run)
                                    
trial.SRTT.totalmeanlatency:        the mean latency across all trials.SRTT (in ms)
trial.SRTT.totalmedianlatency:        the median latency across all trials.SRTT (in ms)
trial.SRTT.totalminlatency:            the fastest response across all trials SRTT (in ms)
trial.SRTT.totalmaxlatency:            the slowest response across all trials SRTT (in ms)
trial.SRTT.totalsdlatency:            the the standard deviation of the latency responses across all trials SRTT
trial.SRTT.totalvarlatency:            the variance of the latency responses across all trials SRTT


___________________________________________________________________________________________________________________    
EXPERIMENTAL SET-UP
___________________________________________________________________________________________________________________    
* By default, the script runs 2 blocks of 20 trials each
* By default, the fixation cross as well as the target stimuli appear in the center of the screen. Changes can be made under
section Editable Parameter, including changing the script so that the target stimuli appear randomly in one of 9 screen positions.
* By default, the time intervals are randomly chosen from 2000ms, 3000ms, 4000ms, 5000ms, 6000ms, 7000ms, 8000ms
* By default, the fixation cross is black.
* By default, the color of the circle is red.
* By default, the color of the screen background is white.

___________________________________________________________________________________________________________________    
INSTRUCTIONS
___________________________________________________________________________________________________________________
see section Editable Instructions

___________________________________________________________________________________________________________________    
EDITABLE CODE
___________________________________________________________________________________________________________________    
check below for (relatively) easily editable parameters, stimuli, instructions etc.
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code
to further customize your experiment.

The parameters you can change are:

targetcolor:                            sets the color of the circle; the default is red
targetsize:                                sets the size of the circle; the default is 10% of the vertical screen
targetx:                                sets the x-coordinate of the target circle ; the default is the center (50%)
targety:                                sets the y-coordinate of the target circle , the default is the center (50%)
focusx:                                    sets the x-coordinate of the focus stimulus; the default is the center (50%)
focusy:                                    sets the y-coordinate of the focus stimulus; the default is the center (50%)
focuscolor:                                sets the color of the focus stimulus; the default is black
focussize:                                sets the size of the focus stimulus
maxtrialnumber:                            sets the number of trials that should be run in a block; the default is 20
screencolor:                            sets the background color of the screen
fixed:                                    determines whether to use the fixed coordinates for the target stimulus (= 0) or to select
                                        randomly from 9 different screen positions (=1) ; default is 0

</usermanual>


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

<parameters>
/targetcolor = red
/targetsize = 10%
/targetx = 50%
/targety = 50%
/focusx = 50%
/focusy = 50%
/focuscolor = black
/focussize = 10%
/maxtrialnumber = 1
/screencolor = white
/fixed = 0
</parameters>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************
<instruct>
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

Note:
Change instructions to suit your experiment

<page instruct>
<h1>Simple Reaction Time Task</h1><hr><br>
In this test you will be presented with a fixation cross, followed by a red circle.<br>
<br>Your task is to<br>
(1) concentrate on the fixation cross<br>
(2) press the SPACEBAR as soon as possible once the red circle is presented.<br>
<br><br>Press the Spacebar to start.
</page>

<page feedback>
<h1>Thank you!</h1><hr><br>
<br>Your average response time was: <%trial.SRTT.meanlatency%> ms
<br>Your fastest response time was: <%trial.SRTT.minlatency%> ms
<br>Your slowest response time was : <%trial.SRTT.maxlatency%> ms<br>
<% script.elapsedtime %>
</text>
<br><br>Press the Spacebar to exit.
</page>


****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************



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

**************************************************************
STIMULUS PRESENTATION INTERVAL LIST
**************************************************************
Note:
List.stimulusinterval randomly selects with replacement the amount of time that the focus stimulus will be shown before
presenting the target.

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

**************************************************************
RANDOM TARGET POSITIONS LIST
**************************************************************
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 = (25%, 50%, 75%)
/replace = true
/ selectionrate = always
</list>

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


**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 6.1.0.0 or higher

<defaults>
/ fontstyle = ("Arial", 3.5%)
/ screencolor = (white)
/ txbgcolor = (0,0,0)
/ txcolor = (255, 255, 255)
/ minimumversion = "6.1.0.0"
/canvasaspectratio = (4,3)
</defaults>

**************************************************************************************************************
**************************************************************************************************************
    DATA
**************************************************************************************************************
**************************************************************************************************************

Note: data file explanations under User Manual Information at the top

*************************
raw data
*************************
<data>
/ columns = (build, computer.platform, date, time, subject, group, script.sessionid,
blockcode, blocknum, trialcode, trialnum,
                    stimulusitem, parameters.focusx, parameters.focusy, parameters.focuscolor,
                    stimulusitem, parameters.targetcolor, parameters.targetsize, parameters.fixed, parameters.targetx, parameters.targety,
                    parameters.maxtrialnumber, trial.SRTT.count, values.stiminterval, response, correct, latency,
                    trial.SRTT.meanlatency, trial.SRTT.medianlatency, trial.SRTT.minlatency, trial.SRTT.maxlatency, trial.SRTT.sdlatency, trial.SRTT.varlatency,
                    trial.SRTT.totalmeanlatency, trial.SRTT.totalmedianlatency, trial.SRTT.totalminlatency, trial.SRTT.totalmaxlatency,
                    trial.SRTT.totalsdlatency, trial.SRTT.totalvarlatency)
</data>


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

<summarydata>
/ columns = (computer.platform, script.startdate, script.starttime, script.subjectid, script.groupid, script.sessionid,
script.elapsedtime, script.completed
            trial.SRTT.totalmeanlatency, trial.SRTT.totalmedianlatency,
            trial.SRTT.totalminlatency, trial.SRTT.totalmaxlatency,
            trial.SRTT.totalsdlatency, trial.SRTT.totalvarlatency)
</summarydata>

**************************************************************************************************************
**************************************************************************************************************
    VALUES: automatically updated
**************************************************************************************************************
**************************************************************************************************************
            
stiminterval:                        determines how long the focus stimulus is shown before the target stimulus is presented

<values>
/stiminterval = 0
/TotalTimeA = 0
</values>

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

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


***FOCUSSTIMULUS:
<text focus>
/ items = ("+")
/position = (parameters.focusx, parameters.focusy)
/ fontstyle = ("Arial", parameters.focussize, true, false, false, false, 5, 0)
/ txcolor = black
/ txbgcolor = white
/erase = false
</text>

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

Note:
trial.SRTT presents the fixationcross and the stimulus (either in a fixed position or randomly) and waits for pressing the spacebar.

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

    values.stiminterval = list.stimulusinterval.nextvalue;
    trial.SRTT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ stimulustimes = [0 = focus]
/ beginresponsetime = values.stiminterval
/ validresponse = (" ")
/ correctresponse = (" ")
/ ontrialend = [trial.SRTT.resetstimulusframes()]
/ branch = [return trial.SRTT;]
/ ontrialend = [
   values.TotalTimeA += script.elapsedtime;
]
</trial>

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

Note: block.SRTTblock runs the specified number of trials with either a fixed or a random position for the target circles.
If a separate block is needed for random target positions, copy the code below, rename the block, and add the line
/ ontrialbegin = [parameters.fixed = 1].

<block SRTTblock>
/ onblockbegin = [
    shape.targetcircle.color = parameters.targetcolor;
    text.focus.textcolor = parameters.focuscolor;
    text.focus.textbgcolor = parameters.screencolor;
]

/ trials = [1 = SRTT]
/ onblockbegin = [block.SRTTblock.screencolor = parameters.screencolor]
/ preinstructions = (instruct)
/ postinstructions = (feedback)
/ stop = [trial.SRTT.count == parameters.maxtrialnumber]
</block>

**************************************************************************************************************
**************************************************************************************************************
    EXPERIMENT
**************************************************************************************************************
**************************************************************************************************************

Note: Main script, change according to your needs.
<expt>
/ blocks = [1-2=SRTTblock]
</expt>

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

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

Attachments
batch.cogbattery2.iqx (266 views, 359 bytes)
srtvisualA.iqx (279 views, 19.00 KB)
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: 13K, Visits: 104K
CogNeurotic - 2/11/2021
Hi,
Thanks for this, I get the logic and am working on executing it. My programming skills are rusty, and this is my first time using Inquisit, so I really appreciate your help.  

I believe I have successfully edited my "script A" (srtvisualA.iqx), but I'm running into trouble in the batch script. I get the error: 'batch.currentscript' Expression contains an invalid identifier. (Element: "batch.1", attribute: onscriptend; script: batch.cogbattery2.iqx
Could you take a look and see where the issue is?
I've inserted the code for each below; one after the other, and attached the files. One note: for the purposes of running through the script, I've futzed around with srtvisualA.iqx to show me the elapsed time and to only run one trial for each block.) 

Thanks again for your help,
D

* Here we define the batch parameters *
<parameters>
/ StartElapsedDelayTime = 0
</parameters>

* Here we defined the batch values *
<values>
/ TotalTimeA = 0
</values>

<batch>
/ file= "srtvisualA.iqx"
/ onscriptend = [
  if (batch.currentscript == "srtvisualA.iqx")
  {
   parameters.StartElapsedDelayTime = values.TotalTimeA;
  }
]
</batch>

<usermanual>
___________________________________________________________________________________________________________________    

                                    SIMPLE REACTION TIME TASK - visual
___________________________________________________________________________________________________________________

Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
last updated: 01-26-2016 by K.Borchert (katjab@millisecond.com) for Millisecond Software LLC

last updated: 03-11-2020 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright © 03-11-2020 Millisecond Software

___________________________________________________________________________________________________________________
BACKGROUND INFO     
___________________________________________________________________________________________________________________    

This script runs a simple visual reaction time task.

___________________________________________________________________________________________________________________
TASK DESCRIPTION    
___________________________________________________________________________________________________________________    
The participant gets presented a fixation cross that is followed after variable time intervals
by a visual target stimulus (here: circle). The participant's task is to press the spacebar as soon as the
target stimulus appears on the screen. Latency, mean latency, and latency standard deviation
are recorded in the data file.

___________________________________________________________________________________________________________________    
DURATION
___________________________________________________________________________________________________________________    
the default set-up of the script takes appr. 4 minutes to complete

___________________________________________________________________________________________________________________    
DATA FILE INFORMATION
___________________________________________________________________________________________________________________    
The default data stored in the data files are:

(1) Raw data file: 'srtvisual_raw*.iqdat' (a separate file for each participant)

build:                                The specific Inquisit version used (the 'build') that was run
computer.platform:                    the platform the script was run on (win/mac/ios/android)
date, time,                         date and time script was run
subject, group,                     with the current subject/groupnumber
script.sessionid:                    with the current session id

blockcode, blocknum:                the name and number of the current block (built-in Inquisit variable)
trialcode, trialnum:                 the name and number of the currently recorded trial (built-in Inquisit variable)
                                        Note: trialnum is a built-in Inquisit variable; it counts all trials run; even those
                                        that do not store data to the data file.
                                        
stimulusitem:                        the first presented stimulus (=fixation cross)
parameters.focusx:                    the x-coordinate of the fixation cross
parameters.focusy:                    the y-coordinate of the fixation cross
parameters.focuscolor:                the color of the fixation cross
parameters.focussize:                the size of the fixation cross
stimulusitem:                        the second presented stimulus (=target)
parameters.targetcolor:                the current color of the target circle
parameters.targetsize:                the current color of the target circle
parameters.targetx:                    the x-coordinate of the target circle
parameters.targety:                    the y-coordinate of the target circle
parameters.fixed:                    0= fixed position of target; 1 = random position of target
parameters.maxtrialnumber:            the number of trials in a block
trials.SRTT.count    :                counts the SRTT trials run in a given block
values.stiminterval:                the current stimulus interval
latency:                            the latency of the response (in ms)
trial.SRTT.meanlatency:                the mean latency in the current block (in ms)
trial.SRTT.medianlatency:            the median latency in the current block (in ms)
trial.SRTT.minlatency:                the fastest response in the current block (in ms)
trial.SRTT.maxlatency:                the slowest response in the current block (in ms)
trial.SRTT.sdlatency:                the standard deviation of the latency responses in the current block
trial.SRTT.varlatency:                the variance of the latency responses in the current block
trial.SRTT.totalmeanlatency:        the mean latency across all trials.SRTT (in ms)
trial.SRTT.totalmedianlatency:        the median latency across all trials.SRTT (in ms)
trial.SRTT.totalminlatency:            the fastest response across all trials SRTT (in ms)
trial.SRTT.totalmaxlatency:            the slowest response across all trials SRTT (in ms)
trial.SRTT.totalsdlatency:            the the standard deviation of the latency responses across all trials SRTT
trial.SRTT.totalvarlatency:            the variance of the latency responses across all trials SRTT


(2) Summary data file: 'srtvisual_summary*.iqdat' (a separate file for each participant)

computer.platform:                    the platform the script was run on (win/mac/ios/android)
script.startdate:                    date script was run
script.starttime:                    time script was started
script.subjectid:                    assigned subject id number
script.groupid:                        assigned group id number
script.sessionid:                    assigned session id number
script.elapsedtime:                    time it took to run script (in ms); measured from onset to offset of script
script.completed:                    0 = script was not completed (prematurely aborted);
                                    1 = script was completed (all conditions run)
                                    
trial.SRTT.totalmeanlatency:        the mean latency across all trials.SRTT (in ms)
trial.SRTT.totalmedianlatency:        the median latency across all trials.SRTT (in ms)
trial.SRTT.totalminlatency:            the fastest response across all trials SRTT (in ms)
trial.SRTT.totalmaxlatency:            the slowest response across all trials SRTT (in ms)
trial.SRTT.totalsdlatency:            the the standard deviation of the latency responses across all trials SRTT
trial.SRTT.totalvarlatency:            the variance of the latency responses across all trials SRTT


___________________________________________________________________________________________________________________    
EXPERIMENTAL SET-UP
___________________________________________________________________________________________________________________    
* By default, the script runs 2 blocks of 20 trials each
* By default, the fixation cross as well as the target stimuli appear in the center of the screen. Changes can be made under
section Editable Parameter, including changing the script so that the target stimuli appear randomly in one of 9 screen positions.
* By default, the time intervals are randomly chosen from 2000ms, 3000ms, 4000ms, 5000ms, 6000ms, 7000ms, 8000ms
* By default, the fixation cross is black.
* By default, the color of the circle is red.
* By default, the color of the screen background is white.

___________________________________________________________________________________________________________________    
INSTRUCTIONS
___________________________________________________________________________________________________________________
see section Editable Instructions

___________________________________________________________________________________________________________________    
EDITABLE CODE
___________________________________________________________________________________________________________________    
check below for (relatively) easily editable parameters, stimuli, instructions etc.
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code
to further customize your experiment.

The parameters you can change are:

targetcolor:                            sets the color of the circle; the default is red
targetsize:                                sets the size of the circle; the default is 10% of the vertical screen
targetx:                                sets the x-coordinate of the target circle ; the default is the center (50%)
targety:                                sets the y-coordinate of the target circle , the default is the center (50%)
focusx:                                    sets the x-coordinate of the focus stimulus; the default is the center (50%)
focusy:                                    sets the y-coordinate of the focus stimulus; the default is the center (50%)
focuscolor:                                sets the color of the focus stimulus; the default is black
focussize:                                sets the size of the focus stimulus
maxtrialnumber:                            sets the number of trials that should be run in a block; the default is 20
screencolor:                            sets the background color of the screen
fixed:                                    determines whether to use the fixed coordinates for the target stimulus (= 0) or to select
                                        randomly from 9 different screen positions (=1) ; default is 0

</usermanual>


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

<parameters>
/targetcolor = red
/targetsize = 10%
/targetx = 50%
/targety = 50%
/focusx = 50%
/focusy = 50%
/focuscolor = black
/focussize = 10%
/maxtrialnumber = 1
/screencolor = white
/fixed = 0
</parameters>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************
<instruct>
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

Note:
Change instructions to suit your experiment

<page instruct>
<h1>Simple Reaction Time Task</h1><hr><br>
In this test you will be presented with a fixation cross, followed by a red circle.<br>
<br>Your task is to<br>
(1) concentrate on the fixation cross<br>
(2) press the SPACEBAR as soon as possible once the red circle is presented.<br>
<br><br>Press the Spacebar to start.
</page>

<page feedback>
<h1>Thank you!</h1><hr><br>
<br>Your average response time was: <%trial.SRTT.meanlatency%> ms
<br>Your fastest response time was: <%trial.SRTT.minlatency%> ms
<br>Your slowest response time was : <%trial.SRTT.maxlatency%> ms<br>
<% script.elapsedtime %>
</text>
<br><br>Press the Spacebar to exit.
</page>


****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************



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

**************************************************************
STIMULUS PRESENTATION INTERVAL LIST
**************************************************************
Note:
List.stimulusinterval randomly selects with replacement the amount of time that the focus stimulus will be shown before
presenting the target.

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

**************************************************************
RANDOM TARGET POSITIONS LIST
**************************************************************
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 = (25%, 50%, 75%)
/replace = true
/ selectionrate = always
</list>

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


**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 6.1.0.0 or higher

<defaults>
/ fontstyle = ("Arial", 3.5%)
/ screencolor = (white)
/ txbgcolor = (0,0,0)
/ txcolor = (255, 255, 255)
/ minimumversion = "6.1.0.0"
/canvasaspectratio = (4,3)
</defaults>

**************************************************************************************************************
**************************************************************************************************************
    DATA
**************************************************************************************************************
**************************************************************************************************************

Note: data file explanations under User Manual Information at the top

*************************
raw data
*************************
<data>
/ columns = (build, computer.platform, date, time, subject, group, script.sessionid,
blockcode, blocknum, trialcode, trialnum,
                    stimulusitem, parameters.focusx, parameters.focusy, parameters.focuscolor,
                    stimulusitem, parameters.targetcolor, parameters.targetsize, parameters.fixed, parameters.targetx, parameters.targety,
                    parameters.maxtrialnumber, trial.SRTT.count, values.stiminterval, response, correct, latency,
                    trial.SRTT.meanlatency, trial.SRTT.medianlatency, trial.SRTT.minlatency, trial.SRTT.maxlatency, trial.SRTT.sdlatency, trial.SRTT.varlatency,
                    trial.SRTT.totalmeanlatency, trial.SRTT.totalmedianlatency, trial.SRTT.totalminlatency, trial.SRTT.totalmaxlatency,
                    trial.SRTT.totalsdlatency, trial.SRTT.totalvarlatency)
</data>


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

<summarydata>
/ columns = (computer.platform, script.startdate, script.starttime, script.subjectid, script.groupid, script.sessionid,
script.elapsedtime, script.completed
            trial.SRTT.totalmeanlatency, trial.SRTT.totalmedianlatency,
            trial.SRTT.totalminlatency, trial.SRTT.totalmaxlatency,
            trial.SRTT.totalsdlatency, trial.SRTT.totalvarlatency)
</summarydata>

**************************************************************************************************************
**************************************************************************************************************
    VALUES: automatically updated
**************************************************************************************************************
**************************************************************************************************************
            
stiminterval:                        determines how long the focus stimulus is shown before the target stimulus is presented

<values>
/stiminterval = 0
/TotalTimeA = 0
</values>

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

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


***FOCUSSTIMULUS:
<text focus>
/ items = ("+")
/position = (parameters.focusx, parameters.focusy)
/ fontstyle = ("Arial", parameters.focussize, true, false, false, false, 5, 0)
/ txcolor = black
/ txbgcolor = white
/erase = false
</text>

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

Note:
trial.SRTT presents the fixationcross and the stimulus (either in a fixed position or randomly) and waits for pressing the spacebar.

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

    values.stiminterval = list.stimulusinterval.nextvalue;
    trial.SRTT.insertstimulustime(shape.targetcircle, values.stiminterval);
]
/ stimulustimes = [0 = focus]
/ beginresponsetime = values.stiminterval
/ validresponse = (" ")
/ correctresponse = (" ")
/ ontrialend = [trial.SRTT.resetstimulusframes()]
/ branch = [return trial.SRTT;]
/ ontrialend = [
   values.TotalTimeA += script.elapsedtime;
]
</trial>

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

Note: block.SRTTblock runs the specified number of trials with either a fixed or a random position for the target circles.
If a separate block is needed for random target positions, copy the code below, rename the block, and add the line
/ ontrialbegin = [parameters.fixed = 1].

<block SRTTblock>
/ onblockbegin = [
    shape.targetcircle.color = parameters.targetcolor;
    text.focus.textcolor = parameters.focuscolor;
    text.focus.textbgcolor = parameters.screencolor;
]

/ trials = [1 = SRTT]
/ onblockbegin = [block.SRTTblock.screencolor = parameters.screencolor]
/ preinstructions = (instruct)
/ postinstructions = (feedback)
/ stop = [trial.SRTT.count == parameters.maxtrialnumber]
</block>

**************************************************************************************************************
**************************************************************************************************************
    EXPERIMENT
**************************************************************************************************************
**************************************************************************************************************

Note: Main script, change according to your needs.
<expt>
/ blocks = [1-2=SRTTblock]
</expt>

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

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

If a batch element isn't explicitly named, Inquisit gives it an internal numerical identifier (starting from 1, it numbers all batch elements in the batch script). Thus, the below needs to read:

<batch>
/ file= "srtvisualA.iqx"
/ onscriptend = [
if (batch.1.currentscript == "srtvisualA.iqx")
{
 parameters.StartElapsedDelayTime = values.TotalTimeA;
}
]
</batch>

Alternatively, as hinted at above, you can also given the element(s) proper names, which makes things a little more obvious and easier to understand.

<batch example>
/ file= "srtvisualA.iqx"
/ onscriptend = [
if (batch.example.currentscript == "srtvisualA.iqx")
{
parameters.StartElapsedDelayTime = values.TotalTimeA;
}
]
</batch>

The notation always is elementtype.elementname.elementproperty.
CogNeurotic
CogNeurotic
Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)
Group: Forum Members
Posts: 4, Visits: 38
Hi again,
Thanks for all of your guidance above; I've been chipping away at other aspects of the project and now I'm back to tackling this and could use some more help. 

In the actual experiment, I'm going to have a chain of scripts like below in my batch file. In the meantime, I made (and attached here) some "proof of concept" scripts (ScriptA, ScriptB, ScriptC, batch.proofofconcept) representing the delay tasks and batch script  to show myself that I'm passing on the values that I want to between scripts.
I've confirmed that the ElapsedDelayTime value output by script A is successfully called on whichever script is the next one; however, I can't get it to pass on to a third script. In fact, ScriptC only works properly when I have only 2 scripts in the batch file. Each script runs fine on its own. If I have script C after scripts A and B, C starts and responds to keypresses, but does not shows any stimuli, only a blank page. If I only call on A and C in the batch, C runs fine; if I only call on B and C in the batch, C runs fine (though the ElapsedDelayTime in C is not correct in this last case). 
The script is as below:

* Here we define the batch parameters *
<parameters>
/ ElapsedDelayTime = 0
</parameters>

* Here we define the batch values *
<values>
/ TotalTimeA = 0
</values>

* Here we define which scripts run and set the values of batch parameters*
<batch>
/ file= "ScriptA.iqx"
/ file= "ScriptB.iqx"
/ file= "ScriptC.iqx"
/ onscriptend = [
  if (batch.1.currentscript == "ScriptA.iqx")
  {
   parameters.ElapsedDelayTime = values.TotalTimeA;
  }
  else if(batch.1.currentscript == "ScriptB.iqx")
  {
   parameters.ElapsedDelayTime = values.TotalTimeAandB;
  }
     else if(batch.1.currentscript == "ScriptC.iqx")
  {
   parameters.ElapsedDelayTime = values.TotalTimeABandC;
  }
]
</batch>

In a previous version, I had this, which also worked fine for just running A and B:
if (batch.1.currentscript == "srtvisualA.iqx")
  {
   parameters.StartElapsedDelayTime = values.TotalTimeA;
}
]


(FYI, eventually, the batch will be more like this):
TaskX
LearningTask1
Delaytask1.1 (represented by ScriptA)
Delaytask1.2 (represented by ScriptB)
Delaytask1.3 (represented by ScriptC)
waittrial 
RecallForLearningTask1
TaskY
LearningTask2
Delaytask2.1 
Delaytask2.2 
RecallForLearningTask2
TaskZ...

Thanks again for your help.

Attachments
batch.proofofconcept.iqx (291 views, 714 bytes)
ScriptA.iqx (268 views, 1.00 KB)
ScriptB.iqx (294 views, 1.00 KB)
ScriptC.iqx (303 views, 1.00 KB)
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: 13K, Visits: 104K
CogNeurotic - 2/21/2021
Hi again,
Thanks for all of your guidance above; I've been chipping away at other aspects of the project and now I'm back to tackling this and could use some more help. 

In the actual experiment, I'm going to have a chain of scripts like below in my batch file. In the meantime, I made (and attached here) some "proof of concept" scripts (ScriptA, ScriptB, ScriptC, batch.proofofconcept) representing the delay tasks and batch script  to show myself that I'm passing on the values that I want to between scripts.
I've confirmed that the ElapsedDelayTime value output by script A is successfully called on whichever script is the next one; however, I can't get it to pass on to a third script. In fact, ScriptC only works properly when I have only 2 scripts in the batch file. Each script runs fine on its own. If I have script C after scripts A and B, C starts and responds to keypresses, but does not shows any stimuli, only a blank page. If I only call on A and C in the batch, C runs fine; if I only call on B and C in the batch, C runs fine (though the ElapsedDelayTime in C is not correct in this last case). 
The script is as below:

* Here we define the batch parameters *
<parameters>
/ ElapsedDelayTime = 0
</parameters>

* Here we define the batch values *
<values>
/ TotalTimeA = 0
</values>

* Here we define which scripts run and set the values of batch parameters*
<batch>
/ file= "ScriptA.iqx"
/ file= "ScriptB.iqx"
/ file= "ScriptC.iqx"
/ onscriptend = [
  if (batch.1.currentscript == "ScriptA.iqx")
  {
   parameters.ElapsedDelayTime = values.TotalTimeA;
  }
  else if(batch.1.currentscript == "ScriptB.iqx")
  {
   parameters.ElapsedDelayTime = values.TotalTimeAandB;
  }
     else if(batch.1.currentscript == "ScriptC.iqx")
  {
   parameters.ElapsedDelayTime = values.TotalTimeABandC;
  }
]
</batch>

In a previous version, I had this, which also worked fine for just running A and B:
if (batch.1.currentscript == "srtvisualA.iqx")
  {
   parameters.StartElapsedDelayTime = values.TotalTimeA;
}
]


(FYI, eventually, the batch will be more like this):
TaskX
LearningTask1
Delaytask1.1 (represented by ScriptA)
Delaytask1.2 (represented by ScriptB)
Delaytask1.3 (represented by ScriptC)
waittrial 
RecallForLearningTask1
TaskY
LearningTask2
Delaytask2.1 
Delaytask2.2 
RecallForLearningTask2
TaskZ...

Thanks again for your help.

Problem is that values.TotalTimeAandB and values.TotalTimeAandBandC are not defined as batch values, so the batch logic cannot acces them. If you actually define them, things will run just fine. They do for me, anyway.

* Here we define the batch values *
<values>
/ TotalTimeA = 0
/ TotalTimeAandB = 0
/ TotalTimeAandBandC = 0
</values>



Attachments
batch.proofofconcept.iqx (269 views, 766 bytes)
ScriptA.iqx (273 views, 1.00 KB)
ScriptB.iqx (275 views, 1.00 KB)
ScriptC.iqx (282 views, 1.00 KB)
CogNeurotic
CogNeurotic
Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)Associate Member (57 reputation)
Group: Forum Members
Posts: 4, Visits: 38

D'oh! Thank you, works like a charm.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search