Displaying multiple images in one trial


Author
Message
kam23
kam23
posted Last Year HOT
New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)
Group: Forum Members
Posts: 5, Visits: 42
For my script, I want to run through a set of images in each trial, with each image presented one by one for about 500ms each. As the images are displaying, the participant can press the spacebar at anytime, in which the remaining stimuli yet to be displayed will be terminated and a textbox will appear for them to enter their answer to the question I provide. After they submit their response, we start a brand new trial with a brand new set of images (so the leftover images of set1 are never displayed). I have provided what I have so far down below, and right now, when I run the trial, it just displays the first image in a set and just stays there. once the participant presses spacebar, the text box appears immediately, and that part works fine. So my main trouble right now, is getting multiple images to display, one by one within a singular trial. Can anyone help? I would greatly appreciate it!

**************************************************************************************************************
Lists of items
**************************************************************************************************************
<item ImageSet1> // store all images in order
/1 = "set1-1.jpg"
/2 = "set1-2.jpg"
/3 = "set1-3.jpg
/4 = "set1-4.jpg"
/5 = "set1-5.jpg"
</item>

<item ImageSet2>
/1 = "set2-1.jpg"
/2 = "set2-2.jpg"
/3 = "set2-3.jpg"
/4 = "set2-4.jpg"
/5 = "set2-5.jpg"
</item>
**************************************************************************************************************
picture
**************************************************************************************************************
<picture set1 > // so the pictures will get displayed in order
/ items = ImageSet1
/ select = values.selectframe
/ size = (50%, 50%)
</picture>

<picture set2 >
/ items = ImageSet2
/ select = sequence
/ size = (50%, 50%)
</picture>
****************************************
list
****************************************
<list selectframe>. // so photos are displayed in order
/items = (1, 2, 3, 4, 5)
/ replace = false
</list>

<list duration>
/ items = (500)
</list>
**************************************************************************************************************
trial
**************************************************************************************************************
<trial Trial1>
/ ontrialbegin = [
    values.starttrialtime = script.elapsedtime; //stores the start of the trial
    
    if (values.count_frames != 0) { // if not first iteration, then update value
        values.selectframe = list.selectframe.nextvalue;
    }
    else {
        values.selectframe = list.selectframe;  // else select first item
    }
    values.count_frames += 1;      
]

/ responseinterrupt = immediate
/ validresponse = (" ")
/ beginresponsetime = values.frameduration
/ isvalidresponse = [
    if (trial.Trial1.responsetext == " "){.  //check if the spacebar was pressed
        values.responsetime = script.elapsedtime; //store the recorded responsetime in script.elapsedtime        
    };
    return (trial.Trial1.responsetext == " ");    
]
/ branch = [
    if (values.count_frames < values.numofframes){. // if there are more frames to be displayed, run through trial again
        return (trial.Trial1);
        };
]

/ ontrialend = [
    values.endtrialtime = script.elapsedtime; //to record participant time
    values.selectframe = 0;  
]

</trial>
****************************************
block
****************************************
<block block1>
/onblockbegin = [
    values.numofframes = 0;
]
/trials = [
    1 = getReady;
    2 = Trial1;
    3 = userResponse;
]
</block>
****************************************
* Once I get the trial working, I then planned on duplicating it for each set of images. 
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
kam23 - 2/23/2023
For my script, I want to run through a set of images in each trial, with each image presented one by one for about 500ms each. As the images are displaying, the participant can press the spacebar at anytime, in which the remaining stimuli yet to be displayed will be terminated and a textbox will appear for them to enter their answer to the question I provide. After they submit their response, we start a brand new trial with a brand new set of images (so the leftover images of set1 are never displayed). I have provided what I have so far down below, and right now, when I run the trial, it just displays the first image in a set and just stays there. once the participant presses spacebar, the text box appears immediately, and that part works fine. So my main trouble right now, is getting multiple images to display, one by one within a singular trial. Can anyone help? I would greatly appreciate it!

**************************************************************************************************************
Lists of items
**************************************************************************************************************
<item ImageSet1> // store all images in order
/1 = "set1-1.jpg"
/2 = "set1-2.jpg"
/3 = "set1-3.jpg
/4 = "set1-4.jpg"
/5 = "set1-5.jpg"
</item>

<item ImageSet2>
/1 = "set2-1.jpg"
/2 = "set2-2.jpg"
/3 = "set2-3.jpg"
/4 = "set2-4.jpg"
/5 = "set2-5.jpg"
</item>
**************************************************************************************************************
picture
**************************************************************************************************************
<picture set1 > // so the pictures will get displayed in order
/ items = ImageSet1
/ select = values.selectframe
/ size = (50%, 50%)
</picture>

<picture set2 >
/ items = ImageSet2
/ select = sequence
/ size = (50%, 50%)
</picture>
****************************************
list
****************************************
<list selectframe>. // so photos are displayed in order
/items = (1, 2, 3, 4, 5)
/ replace = false
</list>

<list duration>
/ items = (500)
</list>
**************************************************************************************************************
trial
**************************************************************************************************************
<trial Trial1>
/ ontrialbegin = [
    values.starttrialtime = script.elapsedtime; //stores the start of the trial
    
    if (values.count_frames != 0) { // if not first iteration, then update value
        values.selectframe = list.selectframe.nextvalue;
    }
    else {
        values.selectframe = list.selectframe;  // else select first item
    }
    values.count_frames += 1;      
]

/ responseinterrupt = immediate
/ validresponse = (" ")
/ beginresponsetime = values.frameduration
/ isvalidresponse = [
    if (trial.Trial1.responsetext == " "){.  //check if the spacebar was pressed
        values.responsetime = script.elapsedtime; //store the recorded responsetime in script.elapsedtime        
    };
    return (trial.Trial1.responsetext == " ");    
]
/ branch = [
    if (values.count_frames < values.numofframes){. // if there are more frames to be displayed, run through trial again
        return (trial.Trial1);
        };
]

/ ontrialend = [
    values.endtrialtime = script.elapsedtime; //to record participant time
    values.selectframe = 0;  
]

</trial>
****************************************
block
****************************************
<block block1>
/onblockbegin = [
    values.numofframes = 0;
]
/trials = [
    1 = getReady;
    2 = Trial1;
    3 = userResponse;
]
</block>
****************************************
* Once I get the trial working, I then planned on duplicating it for each set of images. 

At a minimum, provide code that is complete enough to actually run, please. The trial fragment you posted doesn't even display any stimulus, so I'm not sure how it's supposed to relate to "when I run the trial, it just displays the first image in a set" -- the code does not display any image at all as given.

kam23
kam23
New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)
Group: Forum Members
Posts: 5, Visits: 42
oh, sorry! I only posted the parts that I felt was crucial to understanding what my general approach was. Here's everything! (also I realized that I had accidentally deleted the stimulusframe attribute from trial when I copied and pasted here, which is probably why it wasn't running!)) 

**************************************************************************************************************
Parameters
**************************************************************************************************************
<parameters>
/getReadyDuration = 2000
/target_responsewindow = 1500
/presentationtime = 500
/set_length = 5 
/debugmode = 0
</parameters>
**************************************************************************************************************
**************************************************************************************************************
<instruct>
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

<htmlpage intro>
/ file = "intro.html"
</htmlpage>

<text finish>
/ items = ("Thank you!")
/ fontstyle = ("Arial", 8%, true, false, false, false, 5, 1)
/ position = (50%, 30%)
/ size = (80%, 10%)
/ vjustify = center
/ valign = center
/ halign = center
</text>


<text exit>
/ items = ("<press spacebar to exit>")
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ position = (50%, 90%)
/ size = (80%, 5%)
/ vjustify = center
/ valign = center
/ halign = center
</text>

*******************************
General Helper Instructions
******************************
<text getReady>
/ items = ("Get Ready!

Put your index finger on the SPACEBAR")
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ size = (80%, 40%)
/ vjustify = center
</text>
**************************************************************************************************************
Lists of items
**************************************************************************************************************
<item ImageSet1> // store all images in order
/1 = "set1-1.jpg"
/2 = "set1-2.jpg"
/3 = "set1-3.jpg
/4 = "set1-4.jpg"
/5 = "set1-5.jpg"
</item>

<item ImageSet2>
/1 = "set2-1.jpg"
/2 = "set2-2.jpg"
/3 = "set2-3.jpg"
/4 = "set2-4.jpg"
/5 = "set2-5.jpg"
</item>

**************************************************************************************************************
picture
**************************************************************************************************************

<picture set1 > // so the pictures will get displayed in order
/ items = ImageSet1
/ select = values.selectframe
/ size = (50%, 50%)
</picture>

<picture set2 >
/ items = ImageSet2
/ select = values.selectframe
/ size = (50%, 50%)
</picture>

****************************************
list
****************************************
<list selectframe>
/items = (1, 2, 3, 4, 5)
/ replace = false
</list>


<list duration>
/ items = (500)
</list>

**************************************************************************************************************
Defaults
**************************************************************************************************************
script requires Inquisit 6.1.0.0 or higher

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

****************************************
raw data
****************************************

<data>
/ columns = (build, computer.platform, date, time, subject, group, session, blockcode, blocknum,
trialcode, trialnum,
values.starttrialtime, values.endtrialtime, parameters.target_responsewindow, values.target_responseendtime,
response, correct, values.responsetime, values.RT_hit, latency, values.count_frames,
values.Hit, values.FA,
values.SumTargets,
values.SumHit, values.SumFA)
</data>                    
        
****************************************
summary data
****************************************

<summarydata>
/ columns = (inquisit.build, computer.platform, script.startdate, script.starttime,
script.subjectid, script.groupid, script.sessionid, script.elapsedtime,
script.completed,
expressions.propcorrect, values.SumTargets, values.SumHit, values.SumFA,
expressions.meanRT_hit, expressions.Std_hit, expressions.medianRT_hit)
</summarydata>

**************************************************************************************************************
Values
**************************************************************************************************************
<values>

/starttrialtime = 0
/endtrialtime = 0
/responsetime = 0

/count_frames = 0
/numofframes = 5

/itemvalue = 0
/selectframe = 0

/frameduration = 500

</values>
*************************************************************************************************************
**************************************************************************************************************

<trial getReady>
/ stimulusframes = [1 = getReady]
/ validresponse = (" ")//for touchscreens: present the inactive response button
/ isvalidresponse = [
    return(false);
]
/ trialduration = parameters.getReadyDuration
/ recorddata = false
</trial>

**************************************************************************************************************

**************************************************************************************************************

<trial Trial1>
/ ontrialbegin = [
    values.starttrialtime = script.elapsedtime; //stores the start of the trial
    
    if (values.count_frames != 0) { // if not first iteration, then update value
        values.selectframe = list.selectframe.nextvalue;
    }
    else {
        values.selectframe = list.selectframe;
    }
    values.count_frames += 1;        
]
/ stimulusframes = [1 =set1]
/ responseinterrupt = immediate
/ validresponse = (" ")
/ beginresponsetime = values.frameduration
/ isvalidresponse = [
    if (trial.Trial1.responsetext == " "){ //check if the spacebar was pressed
        values.responsetime = script.elapsedtime; //store the recorded responsetime in script.elapsedtime        
    };
    return (trial.Trial1.responsetext == " ");    
]
/ branch = [
    if (values.count_frames < values.numofframes){
        //values.itemvalue += 1;
        return (trial.Trial1);
        };
]

/ ontrialend = [
    values.endtrialtime = script.elapsedtime; //to record participant time
    values.selectframe = 0;    
]

</trial>


<openended userResponse> // text box for users
/ stimulusframes = [1 = typeprompt]
/ position = (50%, 70%)
/ linelength = 25
/ numlines = 1
/ isvalidresponse = [length(openended.userResponse.response) >= 3] // if they typed in more than 3 characters
</openended>


<text typeprompt>
/ items = ("Please type what you saw in this image.")
/ position = (50%, 60%)
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ size = (80%, 40%)
</text>

**************************************************************************************************************
**************************************************************************************************************

<block set1>
/onblockbegin = [
    values.numofframes = 0;
]
/trials = [
    1 = getReady;
    2 = Trial1;
    3 = userResponse;
]
</block>

**************************************************************************************************************
**************************************************************************************************************
<expt>
/ blocks = [
    1 = set1;    
]
</expt>

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
kam23 - 2/23/2023
oh, sorry! I only posted the parts that I felt was crucial to understanding what my general approach was. Here's everything! (also I realized that I had accidentally deleted the stimulusframe attribute from trial when I copied and pasted here, which is probably why it wasn't running!)) 

**************************************************************************************************************
Parameters
**************************************************************************************************************
<parameters>
/getReadyDuration = 2000
/target_responsewindow = 1500
/presentationtime = 500
/set_length = 5 
/debugmode = 0
</parameters>
**************************************************************************************************************
**************************************************************************************************************
<instruct>
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

<htmlpage intro>
/ file = "intro.html"
</htmlpage>

<text finish>
/ items = ("Thank you!")
/ fontstyle = ("Arial", 8%, true, false, false, false, 5, 1)
/ position = (50%, 30%)
/ size = (80%, 10%)
/ vjustify = center
/ valign = center
/ halign = center
</text>


<text exit>
/ items = ("<press spacebar to exit>")
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ position = (50%, 90%)
/ size = (80%, 5%)
/ vjustify = center
/ valign = center
/ halign = center
</text>

*******************************
General Helper Instructions
******************************
<text getReady>
/ items = ("Get Ready!

Put your index finger on the SPACEBAR")
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ size = (80%, 40%)
/ vjustify = center
</text>
**************************************************************************************************************
Lists of items
**************************************************************************************************************
<item ImageSet1> // store all images in order
/1 = "set1-1.jpg"
/2 = "set1-2.jpg"
/3 = "set1-3.jpg
/4 = "set1-4.jpg"
/5 = "set1-5.jpg"
</item>

<item ImageSet2>
/1 = "set2-1.jpg"
/2 = "set2-2.jpg"
/3 = "set2-3.jpg"
/4 = "set2-4.jpg"
/5 = "set2-5.jpg"
</item>

**************************************************************************************************************
picture
**************************************************************************************************************

<picture set1 > // so the pictures will get displayed in order
/ items = ImageSet1
/ select = values.selectframe
/ size = (50%, 50%)
</picture>

<picture set2 >
/ items = ImageSet2
/ select = values.selectframe
/ size = (50%, 50%)
</picture>

****************************************
list
****************************************
<list selectframe>
/items = (1, 2, 3, 4, 5)
/ replace = false
</list>


<list duration>
/ items = (500)
</list>

**************************************************************************************************************
Defaults
**************************************************************************************************************
script requires Inquisit 6.1.0.0 or higher

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

****************************************
raw data
****************************************

<data>
/ columns = (build, computer.platform, date, time, subject, group, session, blockcode, blocknum,
trialcode, trialnum,
values.starttrialtime, values.endtrialtime, parameters.target_responsewindow, values.target_responseendtime,
response, correct, values.responsetime, values.RT_hit, latency, values.count_frames,
values.Hit, values.FA,
values.SumTargets,
values.SumHit, values.SumFA)
</data>                    
        
****************************************
summary data
****************************************

<summarydata>
/ columns = (inquisit.build, computer.platform, script.startdate, script.starttime,
script.subjectid, script.groupid, script.sessionid, script.elapsedtime,
script.completed,
expressions.propcorrect, values.SumTargets, values.SumHit, values.SumFA,
expressions.meanRT_hit, expressions.Std_hit, expressions.medianRT_hit)
</summarydata>

**************************************************************************************************************
Values
**************************************************************************************************************
<values>

/starttrialtime = 0
/endtrialtime = 0
/responsetime = 0

/count_frames = 0
/numofframes = 5

/itemvalue = 0
/selectframe = 0

/frameduration = 500

</values>
*************************************************************************************************************
**************************************************************************************************************

<trial getReady>
/ stimulusframes = [1 = getReady]
/ validresponse = (" ")//for touchscreens: present the inactive response button
/ isvalidresponse = [
    return(false);
]
/ trialduration = parameters.getReadyDuration
/ recorddata = false
</trial>

**************************************************************************************************************

**************************************************************************************************************

<trial Trial1>
/ ontrialbegin = [
    values.starttrialtime = script.elapsedtime; //stores the start of the trial
    
    if (values.count_frames != 0) { // if not first iteration, then update value
        values.selectframe = list.selectframe.nextvalue;
    }
    else {
        values.selectframe = list.selectframe;
    }
    values.count_frames += 1;        
]
/ stimulusframes = [1 =set1]
/ responseinterrupt = immediate
/ validresponse = (" ")
/ beginresponsetime = values.frameduration
/ isvalidresponse = [
    if (trial.Trial1.responsetext == " "){ //check if the spacebar was pressed
        values.responsetime = script.elapsedtime; //store the recorded responsetime in script.elapsedtime        
    };
    return (trial.Trial1.responsetext == " ");    
]
/ branch = [
    if (values.count_frames < values.numofframes){
        //values.itemvalue += 1;
        return (trial.Trial1);
        };
]

/ ontrialend = [
    values.endtrialtime = script.elapsedtime; //to record participant time
    values.selectframe = 0;    
]

</trial>


<openended userResponse> // text box for users
/ stimulusframes = [1 = typeprompt]
/ position = (50%, 70%)
/ linelength = 25
/ numlines = 1
/ isvalidresponse = [length(openended.userResponse.response) >= 3] // if they typed in more than 3 characters
</openended>


<text typeprompt>
/ items = ("Please type what you saw in this image.")
/ position = (50%, 60%)
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ size = (80%, 40%)
</text>

**************************************************************************************************************
**************************************************************************************************************

<block set1>
/onblockbegin = [
    values.numofframes = 0;
]
/trials = [
    1 = getReady;
    2 = Trial1;
    3 = userResponse;
]
</block>

**************************************************************************************************************
**************************************************************************************************************
<expt>
/ blocks = [
    1 = set1;    
]
</expt>

That's still not runnable, but it's at least enough to make sense of. So, why is there only a single iteration of Trial1?

It's this:

/ branch = [
if (values.count_frames < values.numofframes){
//values.itemvalue += 1;
return trial.Trial1;
};
]


If and only if values.count_frames is less than values.numoffframes, another instance of Trial1 is invoked. At the end of the first instance of Trial1, values.count_frames will be 1.

But values.numofframes is 0, becasue that is what you set it to at the start of the block per

<block set1>
/onblockbegin = [
  values.numofframes = 0;
]

/trials = [
  1 = getReady;
  2 = Trial1;
  3 = userResponse;
]
</block>

Since 1 is greater than 0, no further instance of Trial1 is invoked. The block advances to the userResponse trial as it should.

There's a bunch of other stuff that does not make sense or seems wrong to me with the code, but I assume that's because you're not done with it yet.

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
Dave - 2/23/2023
kam23 - 2/23/2023
oh, sorry! I only posted the parts that I felt was crucial to understanding what my general approach was. Here's everything! (also I realized that I had accidentally deleted the stimulusframe attribute from trial when I copied and pasted here, which is probably why it wasn't running!)) 

**************************************************************************************************************
Parameters
**************************************************************************************************************
<parameters>
/getReadyDuration = 2000
/target_responsewindow = 1500
/presentationtime = 500
/set_length = 5 
/debugmode = 0
</parameters>
**************************************************************************************************************
**************************************************************************************************************
<instruct>
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

<htmlpage intro>
/ file = "intro.html"
</htmlpage>

<text finish>
/ items = ("Thank you!")
/ fontstyle = ("Arial", 8%, true, false, false, false, 5, 1)
/ position = (50%, 30%)
/ size = (80%, 10%)
/ vjustify = center
/ valign = center
/ halign = center
</text>


<text exit>
/ items = ("<press spacebar to exit>")
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ position = (50%, 90%)
/ size = (80%, 5%)
/ vjustify = center
/ valign = center
/ halign = center
</text>

*******************************
General Helper Instructions
******************************
<text getReady>
/ items = ("Get Ready!

Put your index finger on the SPACEBAR")
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ size = (80%, 40%)
/ vjustify = center
</text>
**************************************************************************************************************
Lists of items
**************************************************************************************************************
<item ImageSet1> // store all images in order
/1 = "set1-1.jpg"
/2 = "set1-2.jpg"
/3 = "set1-3.jpg
/4 = "set1-4.jpg"
/5 = "set1-5.jpg"
</item>

<item ImageSet2>
/1 = "set2-1.jpg"
/2 = "set2-2.jpg"
/3 = "set2-3.jpg"
/4 = "set2-4.jpg"
/5 = "set2-5.jpg"
</item>

**************************************************************************************************************
picture
**************************************************************************************************************

<picture set1 > // so the pictures will get displayed in order
/ items = ImageSet1
/ select = values.selectframe
/ size = (50%, 50%)
</picture>

<picture set2 >
/ items = ImageSet2
/ select = values.selectframe
/ size = (50%, 50%)
</picture>

****************************************
list
****************************************
<list selectframe>
/items = (1, 2, 3, 4, 5)
/ replace = false
</list>


<list duration>
/ items = (500)
</list>

**************************************************************************************************************
Defaults
**************************************************************************************************************
script requires Inquisit 6.1.0.0 or higher

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

****************************************
raw data
****************************************

<data>
/ columns = (build, computer.platform, date, time, subject, group, session, blockcode, blocknum,
trialcode, trialnum,
values.starttrialtime, values.endtrialtime, parameters.target_responsewindow, values.target_responseendtime,
response, correct, values.responsetime, values.RT_hit, latency, values.count_frames,
values.Hit, values.FA,
values.SumTargets,
values.SumHit, values.SumFA)
</data>                    
        
****************************************
summary data
****************************************

<summarydata>
/ columns = (inquisit.build, computer.platform, script.startdate, script.starttime,
script.subjectid, script.groupid, script.sessionid, script.elapsedtime,
script.completed,
expressions.propcorrect, values.SumTargets, values.SumHit, values.SumFA,
expressions.meanRT_hit, expressions.Std_hit, expressions.medianRT_hit)
</summarydata>

**************************************************************************************************************
Values
**************************************************************************************************************
<values>

/starttrialtime = 0
/endtrialtime = 0
/responsetime = 0

/count_frames = 0
/numofframes = 5

/itemvalue = 0
/selectframe = 0

/frameduration = 500

</values>
*************************************************************************************************************
**************************************************************************************************************

<trial getReady>
/ stimulusframes = [1 = getReady]
/ validresponse = (" ")//for touchscreens: present the inactive response button
/ isvalidresponse = [
    return(false);
]
/ trialduration = parameters.getReadyDuration
/ recorddata = false
</trial>

**************************************************************************************************************

**************************************************************************************************************

<trial Trial1>
/ ontrialbegin = [
    values.starttrialtime = script.elapsedtime; //stores the start of the trial
    
    if (values.count_frames != 0) { // if not first iteration, then update value
        values.selectframe = list.selectframe.nextvalue;
    }
    else {
        values.selectframe = list.selectframe;
    }
    values.count_frames += 1;        
]
/ stimulusframes = [1 =set1]
/ responseinterrupt = immediate
/ validresponse = (" ")
/ beginresponsetime = values.frameduration
/ isvalidresponse = [
    if (trial.Trial1.responsetext == " "){ //check if the spacebar was pressed
        values.responsetime = script.elapsedtime; //store the recorded responsetime in script.elapsedtime        
    };
    return (trial.Trial1.responsetext == " ");    
]
/ branch = [
    if (values.count_frames < values.numofframes){
        //values.itemvalue += 1;
        return (trial.Trial1);
        };
]

/ ontrialend = [
    values.endtrialtime = script.elapsedtime; //to record participant time
    values.selectframe = 0;    
]

</trial>


<openended userResponse> // text box for users
/ stimulusframes = [1 = typeprompt]
/ position = (50%, 70%)
/ linelength = 25
/ numlines = 1
/ isvalidresponse = [length(openended.userResponse.response) >= 3] // if they typed in more than 3 characters
</openended>


<text typeprompt>
/ items = ("Please type what you saw in this image.")
/ position = (50%, 60%)
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ size = (80%, 40%)
</text>

**************************************************************************************************************
**************************************************************************************************************

<block set1>
/onblockbegin = [
    values.numofframes = 0;
]
/trials = [
    1 = getReady;
    2 = Trial1;
    3 = userResponse;
]
</block>

**************************************************************************************************************
**************************************************************************************************************
<expt>
/ blocks = [
    1 = set1;    
]
</expt>

That's still not runnable, but it's at least enough to make sense of. So, why is there only a single iteration of Trial1?

It's this:

/ branch = [
if (values.count_frames < values.numofframes){
//values.itemvalue += 1;
return trial.Trial1;
};
]


If and only if values.count_frames is less than values.numoffframes, another instance of Trial1 is invoked. At the end of the first instance of Trial1, values.count_frames will be 1.

But values.numofframes is 0, becasue that is what you set it to at the start of the block per

<block set1>
/onblockbegin = [
  values.numofframes = 0;
]

/trials = [
  1 = getReady;
  2 = Trial1;
  3 = userResponse;
]
</block>

Since 1 is greater than 0, no further instance of Trial1 is invoked. The block advances to the userResponse trial as it should.

There's a bunch of other stuff that does not make sense or seems wrong to me with the code, but I assume that's because you're not done with it yet.

And here's how I would set this up, assuming "I want to run through a set of images in each trial, with each image presented one by one for about 500ms each. As the images are displaying, the participant can press the spacebar at anytime, in which the remaining stimuli yet to be displayed will be terminated and a textbox will appear for them to enter their answer to the question I provide." is an accurate description. (The code you provided previously does not actually comport with that description)

**************************************************************************************************************
Parameters
**************************************************************************************************************
<parameters>
/getReadyDuration = 2000
/target_responsewindow = 1500
/presentationtime = 500
/set_length = 5
/debugmode = 0
</parameters>
**************************************************************************************************************
**************************************************************************************************************
<instruct>
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</instruct>

<text finish>
/ items = ("Thank you!")
/ fontstyle = ("Arial", 8%, true, false, false, false, 5, 1)
/ position = (50%, 30%)
/ size = (80%, 10%)
/ vjustify = center
/ valign = center
/ halign = center
</text>


<text exit>
/ items = ("<press spacebar to exit>")
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ position = (50%, 90%)
/ size = (80%, 5%)
/ vjustify = center
/ valign = center
/ halign = center
</text>

*******************************
General Helper Instructions
******************************
<text getReady>
/ items = ("Get Ready!

Put your index finger on the SPACEBAR")
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ size = (80%, 40%)
/ vjustify = center
</text>
**************************************************************************************************************
Lists of items
**************************************************************************************************************
<item ImageSet1> // store all images in order
/1 = "set1-1.jpg"
/2 = "set1-2.jpg"
/3 = "set1-3.jpg"
/4 = "set1-4.jpg"
/5 = "set1-5.jpg"
</item>

<item ImageSet2>
/1 = "set2-1.jpg"
/2 = "set2-2.jpg"
/3 = "set2-3.jpg"
/4 = "set2-4.jpg"
/5 = "set2-5.jpg"
</item>

**************************************************************************************************************
picture
**************************************************************************************************************

<text set1 > // so the pictures will get displayed in order
/ items = ImageSet1
/ select = values.selectframe
/ size = (50%, 50%)
/ erase = false
</text>

****************************************
list
****************************************
<list selectframe>
/items = (1, 2, 3, 4, 5)
/ selectionmode = sequence // should be set to sequential selection if you want items displayed in order
</list>


**************************************************************************************************************
Defaults
**************************************************************************************************************
script requires Inquisit 6.1.0.0 or higher

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

****************************************
raw data
****************************************
// commented out, because several of the referenced variables are not defined in the script

data>
/ columns = (build, computer.platform, date, time, subject, group, session, blockcode, blocknum,
trialcode, trialnum,
values.starttrialtime, values.endtrialtime, parameters.target_responsewindow, values.target_responseendtime,
response, correct, values.responsetime, values.RT_hit, latency, values.count_frames,
values.Hit, values.FA,
values.SumTargets,
values.SumHit, values.SumFA)
/data>

****************************************
summary data
****************************************
// commented out, because several of the referenced variables are not defined in the script

summarydata>
/ columns = (inquisit.build, computer.platform, script.startdate, script.starttime,
script.subjectid, script.groupid, script.sessionid, script.elapsedtime,
script.completed,
expressions.propcorrect, values.SumTargets, values.SumHit, values.SumFA,
expressions.meanRT_hit, expressions.Std_hit, expressions.medianRT_hit)
/summarydata>

**************************************************************************************************************
Values
**************************************************************************************************************
<values>
/starttrialtime = 0
/responsetime = 0
/count_frames = 0
/numofframes = 5
/selectframe = 0
/frameduration = 500
</values>
*************************************************************************************************************
**************************************************************************************************************

<trial getReady>
/ stimulusframes = [1 = getReady]
/ validresponse = (" ")//for touchscreens: present the inactive response button
/ isvalidresponse = [
return false;
]
/ trialduration = parameters.getReadyDuration
/ recorddata = false
</trial>

**************************************************************************************************************

**************************************************************************************************************

<trial Trial1>
/ ontrialbegin = [
    values.count_frames += 1; // increase frame counter
    // if first frame, record start time as reference point
    if (values.count_frames == 1) {
        values.starttrialtime = script.elapsedtime;
    };
    values.selectframe = list.selectframe.nextvalue; // select image item number to display

]
/ stimulusframes = [1 =set1]
/ responseinterrupt = immediate
/ validresponse = (" ", 0) // valid responses are spacebar and no response
/ beginresponsetime = 0 // you'll want to measure responses as soon as image appears on screen
/ timeout = values.frameduration // that's how long this trial will last if there is no response
/ isvalidresponse = [
    // if we have a space bar press
    if (trial.Trial1.responsetext == " "){ //check if the spacebar was pressed
        values.responsetime = script.elapsedtime; //store the recorded responsetime in script.elapsedtime
        return true;
    };
]
/ branch = [
    // as long as we have no response and frames left to show
    if (trial.Trial1.response == 0 && (values.count_frames < values.numofframes)){
        //invoke next frame;
        return trial.Trial1;
    } else {
        //otherwise go to response collection trial
        return openended.userResponse;
    };
]
</trial>


<openended userResponse> // text box for users
/ stimulusframes = [1 = clearscreen, typeprompt]
/ position = (50%, 70%)
/ linelength = 25
/ numlines = 1
/ isvalidresponse = [length(openended.userResponse.response) >= 3] // if they typed in more than 3 characters
</openended>


<text typeprompt>
/ items = ("Please type what you saw in this image.")
/ position = (50%, 60%)
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ size = (80%, 40%)
</text>

**************************************************************************************************************
**************************************************************************************************************

<block set1>
/onblockbegin = [
    //reset variables for this round
    values.count_frames = 0;
    values.starttrialtime = 0;
    values.responsetime = 0;
]
/trials = [
    1 = getReady;
    2 = Trial1;
]
</block>

**************************************************************************************************************
**************************************************************************************************************
<expt>
/ blocks = [
1 = set1;
]
</expt>

kam23
kam23
New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)New Member (47 reputation)
Group: Forum Members
Posts: 5, Visits: 42
Thank you Dave, it works!!! I now understand the errors in my general approach. I am going to work on cleaning it up, and creating trials for each set of images, and then hopefully figuring out the data/summary stuff afterwards. Thanks again!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search