Millisecond Forums

Start next trial - Serial 13 task

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

By Lingi - 11/9/2016

Hi everyone,

I am currently working on an adapted version of the serial 7 task. The participants will have to subtract 13 from a random startnumber (between 4020 and 4800), then subtract 13 again and so on. I am using an openended trial and I would like the next trial to start automatically after a four-digit number has been entered. Is this possible? The only restriction I found so far is a time limit.
I would be really grateful for any hint!

Lina

Here is my script so far:

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

*task duration = 7min

<parameters>
/ taskDuration = 420000
/ ShowLastResponse = false
</parameters>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************
<instruct>
/ fontstyle = ("Arial", 2.8%, false, false, false, false, 5, 1)
/ txcolor = (black)
</instruct>

<page Serial13Instructions>
^
Zählen Sie bitte in 13-er Schritten RÜCKWÄRTS.^
^
Wichtige Hinweise:
^
1. Starten Sie bei der Zahl, die zu Beginn erscheint.^
2. Zählen Sie so schnell Sie können.^
3. Wenn Sie einen Fehler machen, erscheint eine neue Startzahl.^
4. Zählen Sie solange bis auf Ihrem Bildschirm STOPP erscheint.^
5. Nutzen Sie zur Eingabe der Zahlen die Tastatur.^
^
^
^^^Wenn Sie bereit sind, können Sie starten.
</page>



<page End>
You have reached the end of the task.
^^THANK YOU FOR YOUR PARTICIPATION!!!
</page>

<text NextNumber>
/ items = ("next number")
/ position = (50%, 10%)
/ size = (30%, 5%)
/ vjustify = center
/ fontstyle = ("Arial", 5%, true, false, false, false, 5, 1)
/ txcolor = orange
/ erase = false
</text>

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


**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.5.0 or higher

<defaults>
/ canvasaspectratio = (4,3)
/ minimumversion = "5.0.5.0"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txbgcolor = white
/ txcolor = (0, 0, 0)
</defaults>

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

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

To change from one data file per participant to one data file for all participants, set
/separatefiles = false

***********************
raw data file
***********************
<data>
/ separatefiles = false
/ columns = (build, computer.platform, date, time, subject, group, blockcode, blocknum, trialcode, trialnum,
values.currentNumber, values.targetDiff, values.correctSolution, values.proposedSolution,
latency, values.countResponses, values.countErrors)
</data>

***********************
summary data file
***********************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform,
values.completed,
values.countSerial13, values.countResponses13_1, values.countErrors13_1, values.countResponses13_2, values.countErrors13_2)
/ separatefiles = false
</summarydata>



**************************************************************************************************************
**************************************************************************************************************
    VALUES: automatically updated
**************************************************************************************************************
**************************************************************************************************************
                                   
/completed:                0 = script was not completed; 1 = script was completed (all conditions run)
/startNumber:            contains the StartNumber
/currentNumber:            contains the current Number to be presented
/nextNumber:            contains the next number to be presented (based on response)
/targetDiff:            contains the target difference between numbers
/proposedSolution:        stores the entered proposed solution for the current subtraction
/lastDigit:                stores the last entered Digit
/correctSolution:        stores the current correct solution
/countResponses:        counts the numbered of given responses
/countErrors:            counts the number of errors made
/countSerial13:            counts the number of Serial13 tasks run

/countResponses13_1:    stores the number of responses made for the first Serial 13 run
/countErrors13_1:        stores the number of errors made for the first Serial 13 run
/countResponses13_2:    stores the number of responses made for the second Serial 13 run
/countErrors13_2:        stores the number of errors made for the second Serial 13 run


<values>
/ completed = 0

/ startNumber = 0
/ currentNumber = 0
/ nextNumber = 0
/ targetDiff = 0
/ proposedSolution = ""
/ lastDigit = ""
/ correctSolution = 0

/ countResponses = 0
/ countErrors = 0
/ countSerial13 = 0

/ countResponses13_1 = 0
/ countErrors13_1 = 0
/ countResponses13_2 = 0
/ countErrors13_2 = 0
</values>


**************************************************************************************************************
**************************************************************************************************************
    NUMBER GENERATION
**************************************************************************************************************
**************************************************************************************************************

Note: this list is used to generate the RandomStart Number
it generates a random number between 1-800; this random Number will be adjusted by expressions.generateStartNumber
<list randomStart>
/ poolsize = 800
/ replace = false
/ resetinterval = 0
</list>

Note: this expressions subtracts 1 and then adds 4020 to the possible starting numbers.
Range of possible Numbers: 4020 - 4820
<expressions>
/ generateStartNumber = (list.randomStart.nextindex-1) + 4020
</expressions>


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

<text Number>
/ items = ("<%values.currentNumber%>")
/ position = (50%, 40%)
/ size = (20%, 10%)
/ vjustify = center
/ fontstyle = ("Arial", 8%, true, false, false, false, 5, 1)
/ txcolor = blue
</text>

<text response>
/ items = ("<%values.proposedSolution%>")
/ position = (50%, 60%)
/ size = (20%, 10%)
/ vjustify = center
/ fontstyle = ("Arial", 8%, true, false, false, false, 5, 1)
/ txcolor = black
</text>

<text start>
/ items = ("start")
/ fontstyle = ("Verdana", 3%, false, false, false, false, 5, 0)
/ position = (50%, 90%)
/ size = (15%, 5%)
/ vjustify = center
/ txbgcolor = black
/ txcolor = white
</text>

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

<trial startNumber>
/ inputdevice = mouse
/ ontrialbegin = [
    values.startNumber = expressions.generateStartNumber;
    values.nextNumber = values.startNumber;
    values.currentNumber = values.nextNumber;
]
/ stimulusframes = [1 = number, start]
/ validresponse = (start)
/ branch = [
    openended.enterResponse;
]
</trial>

<openended enterResponse>
/ ontrialbegin = [
    values.currentNumber = values.nextNumber;
    values.correctSolution = values.currentNumber - values.targetDiff;
]
/ ontrialend = [
    values.proposedSolution = openended.enterResponse.response
]
/ mask = integer
/ responsefontstyle = ("Al Bayan", 3.75%, true, false, false, false, 5, 0)
/ buttonlabel = ""
/ charlimit = 4
/ branch = [
    trial.evaluateResponse
]
</openended>


Note; trial.eraseLast
* erases the last entered digit from the proposed solution (as long as there are digits)
<trial eraseLast>
/ ontrialbegin = [
    values.proposedSolution = trimright(values.proposedSolution, values.lastDigit);
    values.lastDigit = substring(values.proposedSolution, length(values.proposedSolution) - 1, 1);
]
/ trialduration = 0
/ branch = [
    openended.enterResponse;
]
</trial>

Note: trial.evaluateResponse
* evaluates the accuracy of the proposed solution and updates summary variables
<trial evaluateResponse>
/ iscorrectresponse = [
    values.proposedSolution == values.correctSolution;
]
/ ontrialend = [
    values.nextNumber = values.proposedSolution;
    values.countResponses += 1;
    values.countErrors += trial.evaluateResponse.error;
]
/ trialduration = 0
/ recorddata = true
/ branch = [
    if(trial.evaluateResponse.error) trial.startNumber;
]
/ branch = [
    trial.start;
]
</trial>

<trial start>
/ ontrialbegin = [
    values.proposedSolution = "";
    values.lastDigit = "";
]
/ trialduration = 0
/ branch = [
    openended.enterResponse;
]
</trial>


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


*Serial13

<block serial13Start>
/ preinstructions = (Serial13Instructions)
/ branch = [
    block.serial13;
]
</block>


Note: this block runs a Serial 13 block
<block serial13>
/ timeout = parameters.taskDuration
/ onblockbegin = [
    values.targetDiff = 13;
    values.startNumber = expressions.generateStartNumber;
    values.nextNumber = values.startNumber;
    values.countErrors = 0;
    values.countResponses = 0;
    values.countSerial13 += 1;
]
/ trials = [1 = startNumber]
/ onblockend = [
    if (values.countSerial13 == 1) {
        values.countResponses13_1 = values.countResponses;
        values.countErrors13_1 = values.countErrors;
    } else if (values.countSerial13 == 2) {
        values.countResponses13_2 = values.countResponses;
        values.countErrors13_2 = values.countErrors;
    } ;
]
</block>

To add additional Serial Tasks: copy/paste and edit relevant block code
**************************************************************************************************************
**************************************************************************************************************
    EXPERIMENT
**************************************************************************************************************
**************************************************************************************************************

<expt>
/ onexptend = [
    values.completed = 1;
]
/ blocks = [
    1 = serial13Start
]
</expt>

**************************************************************************************************************
                                                End of File
**************************************************************************************************************
By Dave - 11/10/2016

Lingi - Thursday, November 10, 2016
Hi everyone,

I am currently working on an adapted version of the serial 7 task. The participants will have to subtract 13 from a random startnumber (between 4020 and 4800), then subtract 13 again and so on. I am using an openended trial and I would like the next trial to start automatically after a four-digit number has been entered. Is this possible? The only restriction I found so far is a time limit.
I would be really grateful for any hint!

Lina

Here is my script so far:

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

*task duration = 7min

<parameters>
/ taskDuration = 420000
/ ShowLastResponse = false
</parameters>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************
<instruct>
/ fontstyle = ("Arial", 2.8%, false, false, false, false, 5, 1)
/ txcolor = (black)
</instruct>

<page Serial13Instructions>
^
Zählen Sie bitte in 13-er Schritten RÜCKWÄRTS.^
^
Wichtige Hinweise:
^
1. Starten Sie bei der Zahl, die zu Beginn erscheint.^
2. Zählen Sie so schnell Sie können.^
3. Wenn Sie einen Fehler machen, erscheint eine neue Startzahl.^
4. Zählen Sie solange bis auf Ihrem Bildschirm STOPP erscheint.^
5. Nutzen Sie zur Eingabe der Zahlen die Tastatur.^
^
^
^^^Wenn Sie bereit sind, können Sie starten.
</page>



<page End>
You have reached the end of the task.
^^THANK YOU FOR YOUR PARTICIPATION!!!
</page>

<text NextNumber>
/ items = ("next number")
/ position = (50%, 10%)
/ size = (30%, 5%)
/ vjustify = center
/ fontstyle = ("Arial", 5%, true, false, false, false, 5, 1)
/ txcolor = orange
/ erase = false
</text>

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


**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.5.0 or higher

<defaults>
/ canvasaspectratio = (4,3)
/ minimumversion = "5.0.5.0"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txbgcolor = white
/ txcolor = (0, 0, 0)
</defaults>

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

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

To change from one data file per participant to one data file for all participants, set
/separatefiles = false

***********************
raw data file
***********************
<data>
/ separatefiles = false
/ columns = (build, computer.platform, date, time, subject, group, blockcode, blocknum, trialcode, trialnum,
values.currentNumber, values.targetDiff, values.correctSolution, values.proposedSolution,
latency, values.countResponses, values.countErrors)
</data>

***********************
summary data file
***********************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform,
values.completed,
values.countSerial13, values.countResponses13_1, values.countErrors13_1, values.countResponses13_2, values.countErrors13_2)
/ separatefiles = false
</summarydata>



**************************************************************************************************************
**************************************************************************************************************
    VALUES: automatically updated
**************************************************************************************************************
**************************************************************************************************************
                                   
/completed:                0 = script was not completed; 1 = script was completed (all conditions run)
/startNumber:            contains the StartNumber
/currentNumber:            contains the current Number to be presented
/nextNumber:            contains the next number to be presented (based on response)
/targetDiff:            contains the target difference between numbers
/proposedSolution:        stores the entered proposed solution for the current subtraction
/lastDigit:                stores the last entered Digit
/correctSolution:        stores the current correct solution
/countResponses:        counts the numbered of given responses
/countErrors:            counts the number of errors made
/countSerial13:            counts the number of Serial13 tasks run

/countResponses13_1:    stores the number of responses made for the first Serial 13 run
/countErrors13_1:        stores the number of errors made for the first Serial 13 run
/countResponses13_2:    stores the number of responses made for the second Serial 13 run
/countErrors13_2:        stores the number of errors made for the second Serial 13 run


<values>
/ completed = 0

/ startNumber = 0
/ currentNumber = 0
/ nextNumber = 0
/ targetDiff = 0
/ proposedSolution = ""
/ lastDigit = ""
/ correctSolution = 0

/ countResponses = 0
/ countErrors = 0
/ countSerial13 = 0

/ countResponses13_1 = 0
/ countErrors13_1 = 0
/ countResponses13_2 = 0
/ countErrors13_2 = 0
</values>


**************************************************************************************************************
**************************************************************************************************************
    NUMBER GENERATION
**************************************************************************************************************
**************************************************************************************************************

Note: this list is used to generate the RandomStart Number
it generates a random number between 1-800; this random Number will be adjusted by expressions.generateStartNumber
<list randomStart>
/ poolsize = 800
/ replace = false
/ resetinterval = 0
</list>

Note: this expressions subtracts 1 and then adds 4020 to the possible starting numbers.
Range of possible Numbers: 4020 - 4820
<expressions>
/ generateStartNumber = (list.randomStart.nextindex-1) + 4020
</expressions>


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

<text Number>
/ items = ("<%values.currentNumber%>")
/ position = (50%, 40%)
/ size = (20%, 10%)
/ vjustify = center
/ fontstyle = ("Arial", 8%, true, false, false, false, 5, 1)
/ txcolor = blue
</text>

<text response>
/ items = ("<%values.proposedSolution%>")
/ position = (50%, 60%)
/ size = (20%, 10%)
/ vjustify = center
/ fontstyle = ("Arial", 8%, true, false, false, false, 5, 1)
/ txcolor = black
</text>

<text start>
/ items = ("start")
/ fontstyle = ("Verdana", 3%, false, false, false, false, 5, 0)
/ position = (50%, 90%)
/ size = (15%, 5%)
/ vjustify = center
/ txbgcolor = black
/ txcolor = white
</text>

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

<trial startNumber>
/ inputdevice = mouse
/ ontrialbegin = [
    values.startNumber = expressions.generateStartNumber;
    values.nextNumber = values.startNumber;
    values.currentNumber = values.nextNumber;
]
/ stimulusframes = [1 = number, start]
/ validresponse = (start)
/ branch = [
    openended.enterResponse;
]
</trial>

<openended enterResponse>
/ ontrialbegin = [
    values.currentNumber = values.nextNumber;
    values.correctSolution = values.currentNumber - values.targetDiff;
]
/ ontrialend = [
    values.proposedSolution = openended.enterResponse.response
]
/ mask = integer
/ responsefontstyle = ("Al Bayan", 3.75%, true, false, false, false, 5, 0)
/ buttonlabel = ""
/ charlimit = 4
/ branch = [
    trial.evaluateResponse
]
</openended>


Note; trial.eraseLast
* erases the last entered digit from the proposed solution (as long as there are digits)
<trial eraseLast>
/ ontrialbegin = [
    values.proposedSolution = trimright(values.proposedSolution, values.lastDigit);
    values.lastDigit = substring(values.proposedSolution, length(values.proposedSolution) - 1, 1);
]
/ trialduration = 0
/ branch = [
    openended.enterResponse;
]
</trial>

Note: trial.evaluateResponse
* evaluates the accuracy of the proposed solution and updates summary variables
<trial evaluateResponse>
/ iscorrectresponse = [
    values.proposedSolution == values.correctSolution;
]
/ ontrialend = [
    values.nextNumber = values.proposedSolution;
    values.countResponses += 1;
    values.countErrors += trial.evaluateResponse.error;
]
/ trialduration = 0
/ recorddata = true
/ branch = [
    if(trial.evaluateResponse.error) trial.startNumber;
]
/ branch = [
    trial.start;
]
</trial>

<trial start>
/ ontrialbegin = [
    values.proposedSolution = "";
    values.lastDigit = "";
]
/ trialduration = 0
/ branch = [
    openended.enterResponse;
]
</trial>


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


*Serial13

<block serial13Start>
/ preinstructions = (Serial13Instructions)
/ branch = [
    block.serial13;
]
</block>


Note: this block runs a Serial 13 block
<block serial13>
/ timeout = parameters.taskDuration
/ onblockbegin = [
    values.targetDiff = 13;
    values.startNumber = expressions.generateStartNumber;
    values.nextNumber = values.startNumber;
    values.countErrors = 0;
    values.countResponses = 0;
    values.countSerial13 += 1;
]
/ trials = [1 = startNumber]
/ onblockend = [
    if (values.countSerial13 == 1) {
        values.countResponses13_1 = values.countResponses;
        values.countErrors13_1 = values.countErrors;
    } else if (values.countSerial13 == 2) {
        values.countResponses13_2 = values.countResponses;
        values.countErrors13_2 = values.countErrors;
    } ;
]
</block>

To add additional Serial Tasks: copy/paste and edit relevant block code
**************************************************************************************************************
**************************************************************************************************************
    EXPERIMENT
**************************************************************************************************************
**************************************************************************************************************

<expt>
/ onexptend = [
    values.completed = 1;
]
/ blocks = [
    1 = serial13Start
]
</expt>

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

> I am using an openended trial and I would like the next trial to start automatically after a four-digit number has been entered.

No, this is not possible. You can restrict the <openended> to accept only four digits, but you cannot make it move on automatically once four digits have been entered -- a participant has to submit the response by pressing the button / hitting ENTER on the keyboard (unless there is a /timeout, in which case the <openended> will terminate once the allotted time has run out).

Also note that having the <openended> move on automatically after four digits would make it impossible for the participant to correct her/his response (the original Serial 7 task explicitly allows for correct one's response).
By Lingi - 11/10/2016

Dave - Thursday, November 10, 2016

> I am using an openended trial and I would like the next trial to start automatically after a four-digit number has been entered.

No, this is not possible. You can restrict the <openended> to accept only four digits, but you cannot make it move on automatically once four digits have been entered -- a participant has to submit the response by pressing the button / hitting ENTER on the keyboard (unless there is a /timeout, in which case the <openended> will terminate once the allotted time has run out).

Also note that having the <openended> move on automatically after four digits would make it impossible for the participant to correct her/his response (the original Serial 7 task explicitly allows for correct one's response).
In that case, I will think about a time limit.

Thank you very much for your prompt and helpful answer!