Millisecond Forums

Script for same/different task

https://www.millisecond.com/forums/Topic31694.aspx

By John Clapper - 6/8/2021

I would like to run a simple same-different task, where participants see a stimulus (selected from a collection of image files) on the left side of the screen, followed 1000 msec later by a second stimulus (again selected from a collection of image files) on the right side of the screen. The participant decides if they are the same or different by pressing either S or D, respectively. The program records their response and the latency in msec on each trial. Is there an existing script that does something like this?

Thanks!
By Dave - 6/8/2021

John Clapper - 6/8/2021
I would like to run a simple same-different task, where participants see a stimulus (selected from a collection of image files) on the left side of the screen, followed 1000 msec later by a second stimulus (again selected from a collection of image files) on the right side of the screen. The participant decides if they are the same or different by pressing either S or D, respectively. The program records their response and the latency in msec on each trial. Is there an existing script that does something like this?

Thanks!

There is not, but you should be able to set this up from scratch easily. The gist goes like this:

<block example>
/ trials = [1-20 = noreplace(same, different)]
</block>

<values>
/ leftitem = 1
/ rightitem = 1
/ not = 0
</values>

<trial same>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.rightitem = values.leftitem;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("S")
</trial>

<trial different>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.not = values.leftitem;
    values.rightitem = list.itemnumbers.nextvalue;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("D")
</trial>

// 10 images in this example, sampled without replacement
<list itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ selectionrate = always
/ replace = false
/ not = (values.not)
</list>

<pictureleftpic>
/ items = picitems
/ select = values.leftitem
/ position = (20%, 50%)
/ size = (35%, 50%)
</picture>

<picture rightpic>
/ items = picitems
/ select = values.rightitem
/ position = (80%, 50%)
/ size = (35%, 50%)
</picture>

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>
By John Clapper - 6/8/2021

Dave - 6/8/2021
John Clapper - 6/8/2021
I would like to run a simple same-different task, where participants see a stimulus (selected from a collection of image files) on the left side of the screen, followed 1000 msec later by a second stimulus (again selected from a collection of image files) on the right side of the screen. The participant decides if they are the same or different by pressing either S or D, respectively. The program records their response and the latency in msec on each trial. Is there an existing script that does something like this?

Thanks!

There is not, but you should be able to set this up from scratch easily. The gist goes like this:

<block example>
/ trials = [1-20 = noreplace(same, different)]
</block>

<values>
/ leftitem = 1
/ rightitem = 1
/ not = 0
</values>

<trial same>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.rightitem = values.leftitem;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("S")
</trial>

<trial different>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.not = values.leftitem;
    values.rightitem = list.itemnumbers.nextvalue;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("D")
</trial>

// 10 images in this example, sampled without replacement
<list itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ selectionrate = always
/ replace = false
/ not = (values.not)
</list>

<pictureleftpic>
/ items = picitems
/ select = values.leftitem
/ position = (20%, 50%)
/ size = (35%, 50%)
</picture>

<picture rightpic>
/ items = picitems
/ select = values.rightitem
/ position = (80%, 50%)
/ size = (35%, 50%)
</picture>

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>

Thanks, I'll give it a try
By John Clapper - 6/30/2021

John Clapper - 6/8/2021
Dave - 6/8/2021
John Clapper - 6/8/2021
I would like to run a simple same-different task, where participants see a stimulus (selected from a collection of image files) on the left side of the screen, followed 1000 msec later by a second stimulus (again selected from a collection of image files) on the right side of the screen. The participant decides if they are the same or different by pressing either S or D, respectively. The program records their response and the latency in msec on each trial. Is there an existing script that does something like this?

Thanks!

There is not, but you should be able to set this up from scratch easily. The gist goes like this:

<block example>
/ trials = [1-20 = noreplace(same, different)]
</block>

<values>
/ leftitem = 1
/ rightitem = 1
/ not = 0
</values>

<trial same>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.rightitem = values.leftitem;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("S")
</trial>

<trial different>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.not = values.leftitem;
    values.rightitem = list.itemnumbers.nextvalue;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("D")
</trial>

// 10 images in this example, sampled without replacement
<list itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ selectionrate = always
/ replace = false
/ not = (values.not)
</list>

<pictureleftpic>
/ items = picitems
/ select = values.leftitem
/ position = (20%, 50%)
/ size = (35%, 50%)
</picture>

<picture rightpic>
/ items = picitems
/ select = values.rightitem
/ position = (80%, 50%)
/ size = (35%, 50%)
</picture>

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>

Thanks, I'll give it a try

Hello,

I am trying to figure out how to make a specific modification to this script.

Right now, the script randomly selects two different objects (image files) to show on "different" trials. However, I would like to be able to show specific pairs of objects in the different trials, rather than selecting them at random. What I imagine doing is passing a list of specific object (filename) pairs to to the different trial object to be used in constructing those trial. These could be written directly into the program or read in from an input file.

Is there a simple way to modify the current script that would allow me to do that?

Thanks,

John Clapper
By Dave - 6/30/2021

John Clapper - 6/30/2021
John Clapper - 6/8/2021
Dave - 6/8/2021
John Clapper - 6/8/2021
I would like to run a simple same-different task, where participants see a stimulus (selected from a collection of image files) on the left side of the screen, followed 1000 msec later by a second stimulus (again selected from a collection of image files) on the right side of the screen. The participant decides if they are the same or different by pressing either S or D, respectively. The program records their response and the latency in msec on each trial. Is there an existing script that does something like this?

Thanks!

There is not, but you should be able to set this up from scratch easily. The gist goes like this:

<block example>
/ trials = [1-20 = noreplace(same, different)]
</block>

<values>
/ leftitem = 1
/ rightitem = 1
/ not = 0
</values>

<trial same>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.rightitem = values.leftitem;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("S")
</trial>

<trial different>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.not = values.leftitem;
    values.rightitem = list.itemnumbers.nextvalue;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("D")
</trial>

// 10 images in this example, sampled without replacement
<list itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ selectionrate = always
/ replace = false
/ not = (values.not)
</list>

<pictureleftpic>
/ items = picitems
/ select = values.leftitem
/ position = (20%, 50%)
/ size = (35%, 50%)
</picture>

<picture rightpic>
/ items = picitems
/ select = values.rightitem
/ position = (80%, 50%)
/ size = (35%, 50%)
</picture>

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>

Thanks, I'll give it a try

Hello,

I am trying to figure out how to make a specific modification to this script.

Right now, the script randomly selects two different objects (image files) to show on "different" trials. However, I would like to be able to show specific pairs of objects in the different trials, rather than selecting them at random. What I imagine doing is passing a list of specific object (filename) pairs to to the different trial object to be used in constructing those trial. These could be written directly into the program or read in from an input file.

Is there a simple way to modify the current script that would allow me to do that?

Thanks,

John Clapper

You'll need to be more specific re. which item you want paired which other item.
By John Clapper - 6/30/2021

Dave - 6/30/2021
John Clapper - 6/30/2021
John Clapper - 6/8/2021
Dave - 6/8/2021
John Clapper - 6/8/2021
I would like to run a simple same-different task, where participants see a stimulus (selected from a collection of image files) on the left side of the screen, followed 1000 msec later by a second stimulus (again selected from a collection of image files) on the right side of the screen. The participant decides if they are the same or different by pressing either S or D, respectively. The program records their response and the latency in msec on each trial. Is there an existing script that does something like this?

Thanks!

There is not, but you should be able to set this up from scratch easily. The gist goes like this:

<block example>
/ trials = [1-20 = noreplace(same, different)]
</block>

<values>
/ leftitem = 1
/ rightitem = 1
/ not = 0
</values>

<trial same>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.rightitem = values.leftitem;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("S")
</trial>

<trial different>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.not = values.leftitem;
    values.rightitem = list.itemnumbers.nextvalue;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("D")
</trial>

// 10 images in this example, sampled without replacement
<list itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ selectionrate = always
/ replace = false
/ not = (values.not)
</list>

<pictureleftpic>
/ items = picitems
/ select = values.leftitem
/ position = (20%, 50%)
/ size = (35%, 50%)
</picture>

<picture rightpic>
/ items = picitems
/ select = values.rightitem
/ position = (80%, 50%)
/ size = (35%, 50%)
</picture>

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>

Thanks, I'll give it a try

Hello,

I am trying to figure out how to make a specific modification to this script.

Right now, the script randomly selects two different objects (image files) to show on "different" trials. However, I would like to be able to show specific pairs of objects in the different trials, rather than selecting them at random. What I imagine doing is passing a list of specific object (filename) pairs to to the different trial object to be used in constructing those trial. These could be written directly into the program or read in from an input file.

Is there a simple way to modify the current script that would allow me to do that?

Thanks,

John Clapper

You'll need to be more specific re. which item you want paired which other item.

That would vary with the specific experiment, but for the sake of this particular example imagine that we wanted to use the following item pairs on the 10 "different" trials:

1,10
2,9
3,8
4,7
5,6
6,5
7,4
8,3
9,2
10,1
By Dave - 6/30/2021

John Clapper - 6/30/2021
Dave - 6/30/2021
John Clapper - 6/30/2021
John Clapper - 6/8/2021
Dave - 6/8/2021
John Clapper - 6/8/2021
I would like to run a simple same-different task, where participants see a stimulus (selected from a collection of image files) on the left side of the screen, followed 1000 msec later by a second stimulus (again selected from a collection of image files) on the right side of the screen. The participant decides if they are the same or different by pressing either S or D, respectively. The program records their response and the latency in msec on each trial. Is there an existing script that does something like this?

Thanks!

There is not, but you should be able to set this up from scratch easily. The gist goes like this:

<block example>
/ trials = [1-20 = noreplace(same, different)]
</block>

<values>
/ leftitem = 1
/ rightitem = 1
/ not = 0
</values>

<trial same>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.rightitem = values.leftitem;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("S")
</trial>

<trial different>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.not = values.leftitem;
    values.rightitem = list.itemnumbers.nextvalue;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("D")
</trial>

// 10 images in this example, sampled without replacement
<list itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ selectionrate = always
/ replace = false
/ not = (values.not)
</list>

<pictureleftpic>
/ items = picitems
/ select = values.leftitem
/ position = (20%, 50%)
/ size = (35%, 50%)
</picture>

<picture rightpic>
/ items = picitems
/ select = values.rightitem
/ position = (80%, 50%)
/ size = (35%, 50%)
</picture>

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>

Thanks, I'll give it a try

Hello,

I am trying to figure out how to make a specific modification to this script.

Right now, the script randomly selects two different objects (image files) to show on "different" trials. However, I would like to be able to show specific pairs of objects in the different trials, rather than selecting them at random. What I imagine doing is passing a list of specific object (filename) pairs to to the different trial object to be used in constructing those trial. These could be written directly into the program or read in from an input file.

Is there a simple way to modify the current script that would allow me to do that?

Thanks,

John Clapper

You'll need to be more specific re. which item you want paired which other item.

That would vary with the specific experiment, but for the sake of this particular example imagine that we wanted to use the following item pairs on the 10 "different" trials:

1,10
2,9
3,8
4,7
5,6
6,5
7,4
8,3
9,2
10,1

Then that's simply:

<block example>
/ trials = [1-20 = noreplace(same, different)]
</block>

<values>
/ leftitem = 1
/ rightitem = 1
</values>

<trial same>
/ ontrialbegin = [
    values.leftitem = list.same.nextvalue;
    values.rightitem = values.leftitem;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("S")
</trial>

<trial different>
/ ontrialbegin = [
    values.leftitem = list.different1.nextvalue;
    values.rightitem = list.different2.nextvalue;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("D")
</trial>

<list same>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ replace = false
</list>

// item pairs for the 10 different trials
<list different1>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ replace = false
</list>

<list different2>
/ items = (10,9,8,7,6,5,4,3,2,1)
/ selectionmode = list.different1.currentindex
</list>

<picture leftpic>
/ items = picitems
/ select = values.leftitem
/ position = (20%, 50%)
/ size = (35%, 50%)
</picture>

<picture rightpic>
/ items = picitems
/ select = values.rightitem
/ position = (80%, 50%)
/ size = (35%, 50%)
</picture>

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>


Generally see https://www.millisecond.com/support/docs/v6/html/howto/howtopairs.htm
By John Clapper - 6/30/2021

Dave - 6/30/2021
John Clapper - 6/30/2021
Dave - 6/30/2021
John Clapper - 6/30/2021
John Clapper - 6/8/2021
Dave - 6/8/2021
John Clapper - 6/8/2021
I would like to run a simple same-different task, where participants see a stimulus (selected from a collection of image files) on the left side of the screen, followed 1000 msec later by a second stimulus (again selected from a collection of image files) on the right side of the screen. The participant decides if they are the same or different by pressing either S or D, respectively. The program records their response and the latency in msec on each trial. Is there an existing script that does something like this?

Thanks!

There is not, but you should be able to set this up from scratch easily. The gist goes like this:

<block example>
/ trials = [1-20 = noreplace(same, different)]
</block>

<values>
/ leftitem = 1
/ rightitem = 1
/ not = 0
</values>

<trial same>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.rightitem = values.leftitem;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("S")
</trial>

<trial different>
/ ontrialbegin = [
    values.not = 0;
    values.leftitem = list.itemnumbers.nextvalue;
    values.not = values.leftitem;
    values.rightitem = list.itemnumbers.nextvalue;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("D")
</trial>

// 10 images in this example, sampled without replacement
<list itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ selectionrate = always
/ replace = false
/ not = (values.not)
</list>

<pictureleftpic>
/ items = picitems
/ select = values.leftitem
/ position = (20%, 50%)
/ size = (35%, 50%)
</picture>

<picture rightpic>
/ items = picitems
/ select = values.rightitem
/ position = (80%, 50%)
/ size = (35%, 50%)
</picture>

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>

Thanks, I'll give it a try

Hello,

I am trying to figure out how to make a specific modification to this script.

Right now, the script randomly selects two different objects (image files) to show on "different" trials. However, I would like to be able to show specific pairs of objects in the different trials, rather than selecting them at random. What I imagine doing is passing a list of specific object (filename) pairs to to the different trial object to be used in constructing those trial. These could be written directly into the program or read in from an input file.

Is there a simple way to modify the current script that would allow me to do that?

Thanks,

John Clapper

You'll need to be more specific re. which item you want paired which other item.

That would vary with the specific experiment, but for the sake of this particular example imagine that we wanted to use the following item pairs on the 10 "different" trials:

1,10
2,9
3,8
4,7
5,6
6,5
7,4
8,3
9,2
10,1

Then that's simply:

<block example>
/ trials = [1-20 = noreplace(same, different)]
</block>

<values>
/ leftitem = 1
/ rightitem = 1
</values>

<trial same>
/ ontrialbegin = [
    values.leftitem = list.same.nextvalue;
    values.rightitem = values.leftitem;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("S")
</trial>

<trial different>
/ ontrialbegin = [
    values.leftitem = list.different1.nextvalue;
    values.rightitem = list.different2.nextvalue;
]
/ stimulustimes = [0=leftpic; 1000=rightpic]
/ validresponse = ("S", "D")
/ correctresponse = ("D")
</trial>

<list same>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ replace = false
</list>

// item pairs for the 10 different trials
<list different1>
/ items = (1,2,3,4,5,6,7,8,9,10)
/ replace = false
</list>

<list different2>
/ items = (10,9,8,7,6,5,4,3,2,1)
/ selectionmode = list.different1.currentindex
</list>

<picture leftpic>
/ items = picitems
/ select = values.leftitem
/ position = (20%, 50%)
/ size = (35%, 50%)
</picture>

<picture rightpic>
/ items = picitems
/ select = values.rightitem
/ position = (80%, 50%)
/ size = (35%, 50%)
</picture>

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>


Generally see https://www.millisecond.com/support/docs/v6/html/howto/howtopairs.htm

Thanks, I'll try it out!