Multiple selection of images


Author
Message
natash
natash
Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)
Group: Forum Members
Posts: 14, Visits: 38
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!
Attachments
Set_2.iqx (222 views, 9.00 KB)
zwei_rechteck_blau_fill.PNG (235 views, 356 bytes)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
natash - 5/7/2020
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!

There are a number of scripts in the library which do something similar, so you may want to work through those.

https://www.millisecond.com/download/library/huskerdu/
https://www.millisecond.com/download/library/columbiacardtask/
https://www.millisecond.com/download/library/v6/internationalshoppinglisttask/

The basic story goes like this:

<values>
/ a_x = 0%
/ a_y = 0%
/ b_x = 0%
/ b_y = 0%
/ c_x = 0%
/ c_y = 0%
/ d_x = 0%
/ d_y = 0%
/ a_selected = 0
/ b_selected = 0
/ c_selected = 0
/ d_selected = 0
</values>

<expressions>
/ n_selected = (values.a_selected + values.b_selected + values.c_selected + values.d_selected)
</expressions>


<text a>
/ items = ("A")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (200px,200px)
/ erase = false
</text>

<text a_bg>
/ items = (" ")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (210px,210px)
/ erase = false
</text>

<text b>
/ items = ("B")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (200px,200px)
/ erase = false
</text>

<text b_bg>
/ items = (" ")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (210px,210px)
/ erase = false
</text>

<text c>
/ items = ("C")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (200px,200px)
/ erase = false
</text>

<text c_bg>
/ items = (" ")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (210px,210px)
/ erase = false
</text>

<text d>
/ items = ("D")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (200px,200px)
/ erase = false
</text>

<text d_bg>
/ items = (" ")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.a_x = list.xpos.nextvalue;
    values.a_y = list.ypos.nextvalue;
    values.b_x = list.xpos.nextvalue;
    values.b_y = list.ypos.nextvalue;
    values.c_x = list.xpos.nextvalue;
    values.c_y = list.ypos.nextvalue;
    values.d_x = list.xpos.nextvalue;
    values.d_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "a") {
        if (values.a_selected == 0) {
            values.a_selected = 1;
            text.a_bg.textbgcolor = green;
        } else if (values.a_selected == 1) {
            values.a_selected = 0;
            text.a_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "b") {
        if (values.b_selected == 0) {
            values.b_selected = 1;
            text.b_bg.textbgcolor = green;
        } else if (values.b_selected == 1) {
            values.b_selected = 0;
            text.b_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "c") {
        if (values.c_selected == 0) {
            values.c_selected = 1;
            text.c_bg.textbgcolor = green;
        } else if (values.c_selected == 1) {
            values.c_selected = 0;
            text.c_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "d") {
        if (values.d_selected == 0) {
            values.d_selected = 1;
            text.d_bg.textbgcolor = green;
        } else if (values.d_selected == 1) {
            values.d_selected = 0;
            text.d_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected]
/ inputdevice = mouse
/ validresponse = (a, b, c, d, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("The End")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1=start]
</block>


natash
natash
Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)
Group: Forum Members
Posts: 14, Visits: 38
Dave - 5/7/2020
natash - 5/7/2020
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!

There are a number of scripts in the library which do something similar, so you may want to work through those.

https://www.millisecond.com/download/library/huskerdu/
https://www.millisecond.com/download/library/columbiacardtask/
https://www.millisecond.com/download/library/v6/internationalshoppinglisttask/

The basic story goes like this:

<values>
/ a_x = 0%
/ a_y = 0%
/ b_x = 0%
/ b_y = 0%
/ c_x = 0%
/ c_y = 0%
/ d_x = 0%
/ d_y = 0%
/ a_selected = 0
/ b_selected = 0
/ c_selected = 0
/ d_selected = 0
</values>

<expressions>
/ n_selected = (values.a_selected + values.b_selected + values.c_selected + values.d_selected)
</expressions>


<text a>
/ items = ("A")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (200px,200px)
/ erase = false
</text>

<text a_bg>
/ items = (" ")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (210px,210px)
/ erase = false
</text>

<text b>
/ items = ("B")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (200px,200px)
/ erase = false
</text>

<text b_bg>
/ items = (" ")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (210px,210px)
/ erase = false
</text>

<text c>
/ items = ("C")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (200px,200px)
/ erase = false
</text>

<text c_bg>
/ items = (" ")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (210px,210px)
/ erase = false
</text>

<text d>
/ items = ("D")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (200px,200px)
/ erase = false
</text>

<text d_bg>
/ items = (" ")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.a_x = list.xpos.nextvalue;
    values.a_y = list.ypos.nextvalue;
    values.b_x = list.xpos.nextvalue;
    values.b_y = list.ypos.nextvalue;
    values.c_x = list.xpos.nextvalue;
    values.c_y = list.ypos.nextvalue;
    values.d_x = list.xpos.nextvalue;
    values.d_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "a") {
        if (values.a_selected == 0) {
            values.a_selected = 1;
            text.a_bg.textbgcolor = green;
        } else if (values.a_selected == 1) {
            values.a_selected = 0;
            text.a_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "b") {
        if (values.b_selected == 0) {
            values.b_selected = 1;
            text.b_bg.textbgcolor = green;
        } else if (values.b_selected == 1) {
            values.b_selected = 0;
            text.b_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "c") {
        if (values.c_selected == 0) {
            values.c_selected = 1;
            text.c_bg.textbgcolor = green;
        } else if (values.c_selected == 1) {
            values.c_selected = 0;
            text.c_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "d") {
        if (values.d_selected == 0) {
            values.d_selected = 1;
            text.d_bg.textbgcolor = green;
        } else if (values.d_selected == 1) {
            values.d_selected = 0;
            text.d_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected]
/ inputdevice = mouse
/ validresponse = (a, b, c, d, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("The End")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1=start]
</block>


Thanks a lot! I'm still a bit confused, where is the possiblity to specify my pictures? This is very advanced for me, so excuse me for the questions
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
natash - 5/8/2020
Dave - 5/7/2020
natash - 5/7/2020
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!

There are a number of scripts in the library which do something similar, so you may want to work through those.

https://www.millisecond.com/download/library/huskerdu/
https://www.millisecond.com/download/library/columbiacardtask/
https://www.millisecond.com/download/library/v6/internationalshoppinglisttask/

The basic story goes like this:

<values>
/ a_x = 0%
/ a_y = 0%
/ b_x = 0%
/ b_y = 0%
/ c_x = 0%
/ c_y = 0%
/ d_x = 0%
/ d_y = 0%
/ a_selected = 0
/ b_selected = 0
/ c_selected = 0
/ d_selected = 0
</values>

<expressions>
/ n_selected = (values.a_selected + values.b_selected + values.c_selected + values.d_selected)
</expressions>


<text a>
/ items = ("A")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (200px,200px)
/ erase = false
</text>

<text a_bg>
/ items = (" ")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (210px,210px)
/ erase = false
</text>

<text b>
/ items = ("B")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (200px,200px)
/ erase = false
</text>

<text b_bg>
/ items = (" ")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (210px,210px)
/ erase = false
</text>

<text c>
/ items = ("C")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (200px,200px)
/ erase = false
</text>

<text c_bg>
/ items = (" ")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (210px,210px)
/ erase = false
</text>

<text d>
/ items = ("D")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (200px,200px)
/ erase = false
</text>

<text d_bg>
/ items = (" ")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.a_x = list.xpos.nextvalue;
    values.a_y = list.ypos.nextvalue;
    values.b_x = list.xpos.nextvalue;
    values.b_y = list.ypos.nextvalue;
    values.c_x = list.xpos.nextvalue;
    values.c_y = list.ypos.nextvalue;
    values.d_x = list.xpos.nextvalue;
    values.d_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "a") {
        if (values.a_selected == 0) {
            values.a_selected = 1;
            text.a_bg.textbgcolor = green;
        } else if (values.a_selected == 1) {
            values.a_selected = 0;
            text.a_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "b") {
        if (values.b_selected == 0) {
            values.b_selected = 1;
            text.b_bg.textbgcolor = green;
        } else if (values.b_selected == 1) {
            values.b_selected = 0;
            text.b_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "c") {
        if (values.c_selected == 0) {
            values.c_selected = 1;
            text.c_bg.textbgcolor = green;
        } else if (values.c_selected == 1) {
            values.c_selected = 0;
            text.c_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "d") {
        if (values.d_selected == 0) {
            values.d_selected = 1;
            text.d_bg.textbgcolor = green;
        } else if (values.d_selected == 1) {
            values.d_selected = 0;
            text.d_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected]
/ inputdevice = mouse
/ validresponse = (a, b, c, d, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("The End")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1=start]
</block>


Thanks a lot! I'm still a bit confused, where is the possiblity to specify my pictures? This is very advanced for me, so excuse me for the questions

Instead of <text> elements, use <picture> elements. Works the same way.
natash
natash
Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)
Group: Forum Members
Posts: 14, Visits: 38
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/7/2020
natash - 5/7/2020
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!

There are a number of scripts in the library which do something similar, so you may want to work through those.

https://www.millisecond.com/download/library/huskerdu/
https://www.millisecond.com/download/library/columbiacardtask/
https://www.millisecond.com/download/library/v6/internationalshoppinglisttask/

The basic story goes like this:

<values>
/ a_x = 0%
/ a_y = 0%
/ b_x = 0%
/ b_y = 0%
/ c_x = 0%
/ c_y = 0%
/ d_x = 0%
/ d_y = 0%
/ a_selected = 0
/ b_selected = 0
/ c_selected = 0
/ d_selected = 0
</values>

<expressions>
/ n_selected = (values.a_selected + values.b_selected + values.c_selected + values.d_selected)
</expressions>


<text a>
/ items = ("A")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (200px,200px)
/ erase = false
</text>

<text a_bg>
/ items = (" ")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (210px,210px)
/ erase = false
</text>

<text b>
/ items = ("B")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (200px,200px)
/ erase = false
</text>

<text b_bg>
/ items = (" ")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (210px,210px)
/ erase = false
</text>

<text c>
/ items = ("C")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (200px,200px)
/ erase = false
</text>

<text c_bg>
/ items = (" ")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (210px,210px)
/ erase = false
</text>

<text d>
/ items = ("D")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (200px,200px)
/ erase = false
</text>

<text d_bg>
/ items = (" ")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.a_x = list.xpos.nextvalue;
    values.a_y = list.ypos.nextvalue;
    values.b_x = list.xpos.nextvalue;
    values.b_y = list.ypos.nextvalue;
    values.c_x = list.xpos.nextvalue;
    values.c_y = list.ypos.nextvalue;
    values.d_x = list.xpos.nextvalue;
    values.d_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "a") {
        if (values.a_selected == 0) {
            values.a_selected = 1;
            text.a_bg.textbgcolor = green;
        } else if (values.a_selected == 1) {
            values.a_selected = 0;
            text.a_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "b") {
        if (values.b_selected == 0) {
            values.b_selected = 1;
            text.b_bg.textbgcolor = green;
        } else if (values.b_selected == 1) {
            values.b_selected = 0;
            text.b_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "c") {
        if (values.c_selected == 0) {
            values.c_selected = 1;
            text.c_bg.textbgcolor = green;
        } else if (values.c_selected == 1) {
            values.c_selected = 0;
            text.c_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "d") {
        if (values.d_selected == 0) {
            values.d_selected = 1;
            text.d_bg.textbgcolor = green;
        } else if (values.d_selected == 1) {
            values.d_selected = 0;
            text.d_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected]
/ inputdevice = mouse
/ validresponse = (a, b, c, d, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("The End")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1=start]
</block>


Thanks a lot! I'm still a bit confused, where is the possiblity to specify my pictures? This is very advanced for me, so excuse me for the questions

Instead of <text> elements, use <picture> elements. Works the same way.

That helped a lot! Now it works perfectly, the only thing is that I need it to pursue after the Person has selected three items and clicked done, then it should go on to the next items. It would be amazing if you could help me there as well
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
natash - 5/8/2020
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/7/2020
natash - 5/7/2020
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!

There are a number of scripts in the library which do something similar, so you may want to work through those.

https://www.millisecond.com/download/library/huskerdu/
https://www.millisecond.com/download/library/columbiacardtask/
https://www.millisecond.com/download/library/v6/internationalshoppinglisttask/

The basic story goes like this:

<values>
/ a_x = 0%
/ a_y = 0%
/ b_x = 0%
/ b_y = 0%
/ c_x = 0%
/ c_y = 0%
/ d_x = 0%
/ d_y = 0%
/ a_selected = 0
/ b_selected = 0
/ c_selected = 0
/ d_selected = 0
</values>

<expressions>
/ n_selected = (values.a_selected + values.b_selected + values.c_selected + values.d_selected)
</expressions>


<text a>
/ items = ("A")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (200px,200px)
/ erase = false
</text>

<text a_bg>
/ items = (" ")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (210px,210px)
/ erase = false
</text>

<text b>
/ items = ("B")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (200px,200px)
/ erase = false
</text>

<text b_bg>
/ items = (" ")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (210px,210px)
/ erase = false
</text>

<text c>
/ items = ("C")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (200px,200px)
/ erase = false
</text>

<text c_bg>
/ items = (" ")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (210px,210px)
/ erase = false
</text>

<text d>
/ items = ("D")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (200px,200px)
/ erase = false
</text>

<text d_bg>
/ items = (" ")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.a_x = list.xpos.nextvalue;
    values.a_y = list.ypos.nextvalue;
    values.b_x = list.xpos.nextvalue;
    values.b_y = list.ypos.nextvalue;
    values.c_x = list.xpos.nextvalue;
    values.c_y = list.ypos.nextvalue;
    values.d_x = list.xpos.nextvalue;
    values.d_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "a") {
        if (values.a_selected == 0) {
            values.a_selected = 1;
            text.a_bg.textbgcolor = green;
        } else if (values.a_selected == 1) {
            values.a_selected = 0;
            text.a_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "b") {
        if (values.b_selected == 0) {
            values.b_selected = 1;
            text.b_bg.textbgcolor = green;
        } else if (values.b_selected == 1) {
            values.b_selected = 0;
            text.b_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "c") {
        if (values.c_selected == 0) {
            values.c_selected = 1;
            text.c_bg.textbgcolor = green;
        } else if (values.c_selected == 1) {
            values.c_selected = 0;
            text.c_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "d") {
        if (values.d_selected == 0) {
            values.d_selected = 1;
            text.d_bg.textbgcolor = green;
        } else if (values.d_selected == 1) {
            values.d_selected = 0;
            text.d_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected]
/ inputdevice = mouse
/ validresponse = (a, b, c, d, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("The End")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1=start]
</block>


Thanks a lot! I'm still a bit confused, where is the possiblity to specify my pictures? This is very advanced for me, so excuse me for the questions

Instead of <text> elements, use <picture> elements. Works the same way.

That helped a lot! Now it works perfectly, the only thing is that I need it to pursue after the Person has selected three items and clicked done, then it should go on to the next items. It would be amazing if you could help me there as well

You need to spell out clearly what exactly you want to do and what exactly you don't know how to do. I.e. which parts of the code I gave you do you not understand? Then I can explain those to you and you can take it from there.
natash
natash
Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)
Group: Forum Members
Posts: 14, Visits: 38
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/7/2020
natash - 5/7/2020
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!

There are a number of scripts in the library which do something similar, so you may want to work through those.

https://www.millisecond.com/download/library/huskerdu/
https://www.millisecond.com/download/library/columbiacardtask/
https://www.millisecond.com/download/library/v6/internationalshoppinglisttask/

The basic story goes like this:

<values>
/ a_x = 0%
/ a_y = 0%
/ b_x = 0%
/ b_y = 0%
/ c_x = 0%
/ c_y = 0%
/ d_x = 0%
/ d_y = 0%
/ a_selected = 0
/ b_selected = 0
/ c_selected = 0
/ d_selected = 0
</values>

<expressions>
/ n_selected = (values.a_selected + values.b_selected + values.c_selected + values.d_selected)
</expressions>


<text a>
/ items = ("A")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (200px,200px)
/ erase = false
</text>

<text a_bg>
/ items = (" ")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (210px,210px)
/ erase = false
</text>

<text b>
/ items = ("B")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (200px,200px)
/ erase = false
</text>

<text b_bg>
/ items = (" ")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (210px,210px)
/ erase = false
</text>

<text c>
/ items = ("C")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (200px,200px)
/ erase = false
</text>

<text c_bg>
/ items = (" ")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (210px,210px)
/ erase = false
</text>

<text d>
/ items = ("D")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (200px,200px)
/ erase = false
</text>

<text d_bg>
/ items = (" ")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.a_x = list.xpos.nextvalue;
    values.a_y = list.ypos.nextvalue;
    values.b_x = list.xpos.nextvalue;
    values.b_y = list.ypos.nextvalue;
    values.c_x = list.xpos.nextvalue;
    values.c_y = list.ypos.nextvalue;
    values.d_x = list.xpos.nextvalue;
    values.d_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "a") {
        if (values.a_selected == 0) {
            values.a_selected = 1;
            text.a_bg.textbgcolor = green;
        } else if (values.a_selected == 1) {
            values.a_selected = 0;
            text.a_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "b") {
        if (values.b_selected == 0) {
            values.b_selected = 1;
            text.b_bg.textbgcolor = green;
        } else if (values.b_selected == 1) {
            values.b_selected = 0;
            text.b_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "c") {
        if (values.c_selected == 0) {
            values.c_selected = 1;
            text.c_bg.textbgcolor = green;
        } else if (values.c_selected == 1) {
            values.c_selected = 0;
            text.c_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "d") {
        if (values.d_selected == 0) {
            values.d_selected = 1;
            text.d_bg.textbgcolor = green;
        } else if (values.d_selected == 1) {
            values.d_selected = 0;
            text.d_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected]
/ inputdevice = mouse
/ validresponse = (a, b, c, d, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("The End")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1=start]
</block>


Thanks a lot! I'm still a bit confused, where is the possiblity to specify my pictures? This is very advanced for me, so excuse me for the questions

Instead of <text> elements, use <picture> elements. Works the same way.

That helped a lot! Now it works perfectly, the only thing is that I need it to pursue after the Person has selected three items and clicked done, then it should go on to the next items. It would be amazing if you could help me there as well

You need to spell out clearly what exactly you want to do and what exactly you don't know how to do. I.e. which parts of the code I gave you do you not understand? Then I can explain those to you and you can take it from there.

I actually think that I understand all of it. My problem is that right now it shows 4 Items and if I select three of them and click on "done" then it quits the session. What I want is that after I selected three items that it goes on to show me 4 new items from which I again have to choose three and so o
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
natash - 5/8/2020
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/7/2020
natash - 5/7/2020
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!

There are a number of scripts in the library which do something similar, so you may want to work through those.

https://www.millisecond.com/download/library/huskerdu/
https://www.millisecond.com/download/library/columbiacardtask/
https://www.millisecond.com/download/library/v6/internationalshoppinglisttask/

The basic story goes like this:

<values>
/ a_x = 0%
/ a_y = 0%
/ b_x = 0%
/ b_y = 0%
/ c_x = 0%
/ c_y = 0%
/ d_x = 0%
/ d_y = 0%
/ a_selected = 0
/ b_selected = 0
/ c_selected = 0
/ d_selected = 0
</values>

<expressions>
/ n_selected = (values.a_selected + values.b_selected + values.c_selected + values.d_selected)
</expressions>


<text a>
/ items = ("A")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (200px,200px)
/ erase = false
</text>

<text a_bg>
/ items = (" ")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (210px,210px)
/ erase = false
</text>

<text b>
/ items = ("B")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (200px,200px)
/ erase = false
</text>

<text b_bg>
/ items = (" ")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (210px,210px)
/ erase = false
</text>

<text c>
/ items = ("C")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (200px,200px)
/ erase = false
</text>

<text c_bg>
/ items = (" ")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (210px,210px)
/ erase = false
</text>

<text d>
/ items = ("D")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (200px,200px)
/ erase = false
</text>

<text d_bg>
/ items = (" ")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.a_x = list.xpos.nextvalue;
    values.a_y = list.ypos.nextvalue;
    values.b_x = list.xpos.nextvalue;
    values.b_y = list.ypos.nextvalue;
    values.c_x = list.xpos.nextvalue;
    values.c_y = list.ypos.nextvalue;
    values.d_x = list.xpos.nextvalue;
    values.d_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "a") {
        if (values.a_selected == 0) {
            values.a_selected = 1;
            text.a_bg.textbgcolor = green;
        } else if (values.a_selected == 1) {
            values.a_selected = 0;
            text.a_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "b") {
        if (values.b_selected == 0) {
            values.b_selected = 1;
            text.b_bg.textbgcolor = green;
        } else if (values.b_selected == 1) {
            values.b_selected = 0;
            text.b_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "c") {
        if (values.c_selected == 0) {
            values.c_selected = 1;
            text.c_bg.textbgcolor = green;
        } else if (values.c_selected == 1) {
            values.c_selected = 0;
            text.c_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "d") {
        if (values.d_selected == 0) {
            values.d_selected = 1;
            text.d_bg.textbgcolor = green;
        } else if (values.d_selected == 1) {
            values.d_selected = 0;
            text.d_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected]
/ inputdevice = mouse
/ validresponse = (a, b, c, d, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("The End")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1=start]
</block>


Thanks a lot! I'm still a bit confused, where is the possiblity to specify my pictures? This is very advanced for me, so excuse me for the questions

Instead of <text> elements, use <picture> elements. Works the same way.

That helped a lot! Now it works perfectly, the only thing is that I need it to pursue after the Person has selected three items and clicked done, then it should go on to the next items. It would be amazing if you could help me there as well

You need to spell out clearly what exactly you want to do and what exactly you don't know how to do. I.e. which parts of the code I gave you do you not understand? Then I can explain those to you and you can take it from there.

I actually think that I understand all of it. My problem is that right now it shows 4 Items and if I select three of them and click on "done" then it quits the session. What I want is that after I selected three items that it goes on to show me 4 new items from which I again have to choose three and so o

And then what? What's the relationship between the four items in every, let's call it set of four items? Why only four? For the record, I chose four for the sake of illustration, you can extend it to 3 out of 8, 10, 12 -- whatever you need or want. The vague information I have from you is not something I can reasonably work with, I'm afraid.

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/7/2020
natash - 5/7/2020
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!

There are a number of scripts in the library which do something similar, so you may want to work through those.

https://www.millisecond.com/download/library/huskerdu/
https://www.millisecond.com/download/library/columbiacardtask/
https://www.millisecond.com/download/library/v6/internationalshoppinglisttask/

The basic story goes like this:

<values>
/ a_x = 0%
/ a_y = 0%
/ b_x = 0%
/ b_y = 0%
/ c_x = 0%
/ c_y = 0%
/ d_x = 0%
/ d_y = 0%
/ a_selected = 0
/ b_selected = 0
/ c_selected = 0
/ d_selected = 0
</values>

<expressions>
/ n_selected = (values.a_selected + values.b_selected + values.c_selected + values.d_selected)
</expressions>


<text a>
/ items = ("A")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (200px,200px)
/ erase = false
</text>

<text a_bg>
/ items = (" ")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (210px,210px)
/ erase = false
</text>

<text b>
/ items = ("B")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (200px,200px)
/ erase = false
</text>

<text b_bg>
/ items = (" ")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (210px,210px)
/ erase = false
</text>

<text c>
/ items = ("C")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (200px,200px)
/ erase = false
</text>

<text c_bg>
/ items = (" ")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (210px,210px)
/ erase = false
</text>

<text d>
/ items = ("D")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (200px,200px)
/ erase = false
</text>

<text d_bg>
/ items = (" ")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.a_x = list.xpos.nextvalue;
    values.a_y = list.ypos.nextvalue;
    values.b_x = list.xpos.nextvalue;
    values.b_y = list.ypos.nextvalue;
    values.c_x = list.xpos.nextvalue;
    values.c_y = list.ypos.nextvalue;
    values.d_x = list.xpos.nextvalue;
    values.d_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "a") {
        if (values.a_selected == 0) {
            values.a_selected = 1;
            text.a_bg.textbgcolor = green;
        } else if (values.a_selected == 1) {
            values.a_selected = 0;
            text.a_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "b") {
        if (values.b_selected == 0) {
            values.b_selected = 1;
            text.b_bg.textbgcolor = green;
        } else if (values.b_selected == 1) {
            values.b_selected = 0;
            text.b_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "c") {
        if (values.c_selected == 0) {
            values.c_selected = 1;
            text.c_bg.textbgcolor = green;
        } else if (values.c_selected == 1) {
            values.c_selected = 0;
            text.c_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "d") {
        if (values.d_selected == 0) {
            values.d_selected = 1;
            text.d_bg.textbgcolor = green;
        } else if (values.d_selected == 1) {
            values.d_selected = 0;
            text.d_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected]
/ inputdevice = mouse
/ validresponse = (a, b, c, d, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("The End")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1=start]
</block>


Thanks a lot! I'm still a bit confused, where is the possiblity to specify my pictures? This is very advanced for me, so excuse me for the questions

Instead of <text> elements, use <picture> elements. Works the same way.

That helped a lot! Now it works perfectly, the only thing is that I need it to pursue after the Person has selected three items and clicked done, then it should go on to the next items. It would be amazing if you could help me there as well

You need to spell out clearly what exactly you want to do and what exactly you don't know how to do. I.e. which parts of the code I gave you do you not understand? Then I can explain those to you and you can take it from there.

I actually think that I understand all of it. My problem is that right now it shows 4 Items and if I select three of them and click on "done" then it quits the session. What I want is that after I selected three items that it goes on to show me 4 new items from which I again have to choose three and so o

And then what? What's the relationship between the four items in every, let's call it set of four items? Why only four? For the record, I chose four for the sake of illustration, you can extend it to 3 out of 8, 10, 12 -- whatever you need or want. The vague information I have from you is not something I can reasonably work with, I'm afraid.

Okay, so here's a fairly straightforward extension of the code. Suppose you have five sets of four items each. Each set consists of three targets and one distractor item. The game thus lasts five rounds, and will give feedback about how many of the targets were identified after each round. The sets 1 to 5 are presented in random order.

<defaults>
/ fontstyle = ("Arial", 2%)
</defaults>

<values>
/ target_1_x = 0%
/ target_1_y = 0%
/ target_2_x = 0%
/ target_2_y = 0%
/ target_3_x = 0%
/ target_3_y = 0%
/ distractor_1_x = 0%
/ distractor_1_y = 0%
/ target_1_selected = 0
/ target_2_selected = 0
/ target_3_selected = 0
/ distractor_1_selected = 0
/ set = 1
</values>

<expressions>
/ n_selected = (values.target_1_selected + values.target_2_selected + values.target_3_selected + values.distractor_1_selected)
</expressions>

// five sets of four items each (three targets, one distractor)
<list setlist>
/ items = (1,2,3,4,5)
</list>

<item target_1_items>
/ 1 = "Set 1 Target 1"
/ 2 = "Set 2 Target 1"
/ 3 = "Set 3 Target 1"
/ 4 = "Set 4 Target 1"
/ 5 = "Set 5 Target 1"
</item>

<item target_2_items>
/ 1 = "Set 1 Target 2"
/ 2 = "Set 2 Target 2"
/ 3 = "Set 3 Target 2"
/ 4 = "Set 4 Target 2"
/ 5 = "Set 5 Target 2"
</item>

<item target_3_items>
/ 1 = "Set 1 Target 3"
/ 2 = "Set 2 Target 3"
/ 3 = "Set 3 Target 3"
/ 4 = "Set 4 Target 3"
/ 5 = "Set 5 Target 3"
</item>

<item distractor_1_items>
/ 1 = "Set 1 Distractor 1"
/ 2 = "Set 2 Distractor 1"
/ 3 = "Set 3 Distractor 1"
/ 4 = "Set 4 Distractor 1"
/ 5 = "Set 5 Distractor 1"
</item>

<text target_1>
/ items = target_1_items
/ select = values.set
/ hposition = values.target_1_x
/ vposition = values.target_1_y
/ size = (200px,200px)
/ erase = false
/ vjustify = center
</text>

<text target_1_bg>
/ items = (" ")
/ hposition = values.target_1_x
/ vposition = values.target_1_y
/ size = (210px,210px)
/ erase = false
</text>

<text target_2>
/ items = target_2_items
/ select = values.set
/ hposition = values.target_2_x
/ vposition = values.target_2_y
/ size = (200px,200px)
/ erase = false
/ vjustify = center
</text>

<text target_2_bg>
/ items = (" ")
/ hposition = values.target_2_x
/ vposition = values.target_2_y
/ size = (210px,210px)
/ erase = false
</text>

<text target_3>
/ items = target_3_items
/ select = values.set
/ hposition = values.target_3_x
/ vposition = values.target_3_y
/ size = (200px,200px)
/ erase = false
/ vjustify = center
</text>

<text target_3_bg>
/ items = (" ")
/ hposition = values.target_3_x
/ vposition = values.target_3_y
/ size = (210px,210px)
/ erase = false
</text>

<text distractor_1>
/ items = distractor_1_items
/ select = values.set
/ hposition = values.distractor_1_x
/ vposition = values.distractor_1_y
/ size = (200px,200px)
/ erase = false
/ vjustify = center
</text>

<text distractor_1_bg>
/ items = (" ")
/ hposition = values.distractor_1_x
/ vposition = values.distractor_1_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.set = list.setlist.nextvalue;
    text.target_1_bg.textbgcolor = white;
    text.target_2_bg.textbgcolor = white;
    text.target_3_bg.textbgcolor = white;
    text.distractor_1_bg.textbgcolor = white;
    values.target_1_selected = 0;
    values.target_2_selected = 0;
    values.target_3_selected = 0;
    values.distractor_1_selected = 0;
    values.target_1_x = list.xpos.nextvalue;
    values.target_1_y = list.ypos.nextvalue;
    values.target_2_x = list.xpos.nextvalue;
    values.target_2_y = list.ypos.nextvalue;
    values.target_3_x = list.xpos.nextvalue;
    values.target_3_y = list.ypos.nextvalue;
    values.distractor_1_x = list.xpos.nextvalue;
    values.distractor_1_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "target_1") {
        if (values.target_1_selected == 0) {
            values.target_1_selected = 1;
            text.target_1_bg.textbgcolor = green;
        } else if (values.target_1_selected == 1) {
            values.target_1_selected = 0;
            text.target_1_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "target_2") {
        if (values.target_2_selected == 0) {
            values.target_2_selected = 1;
            text.target_2_bg.textbgcolor = green;
        } else if (values.target_2_selected == 1) {
            values.target_2_selected = 0;
            text.target_2_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "target_3") {
        if (values.target_3_selected == 0) {
            values.target_3_selected = 1;
            text.target_3_bg.textbgcolor = green;
        } else if (values.target_3_selected == 1) {
            values.target_3_selected = 0;
            text.target_3_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "distractor_1") {
        if (values.distractor_1_selected == 0) {
            values.distractor_1_selected = 1;
            text.distractor_1_bg.textbgcolor = green;
        } else if (values.distractor_1_selected == 1) {
            values.distractor_1_selected = 0;
            text.distractor_1_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, target_1_bg, target_2_bg,target_3_bg, distractor_1_bg, target_1, target_2, target_3, distractor_1, done, n_selected]
/ inputdevice = mouse
/ validresponse = (target_1, target_2, target_3, distractor_1, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, target_1_bg, target_2_bg,target_3_bg, distractor_1_bg, target_1, target_2, target_3, distractor_1, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("You identified <%values.target_1_selected + values.target_2_selected + values.target_3_selected%> targets out of 3.")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1-5=start]
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode
values.set values.target_1_selected values.target_2_selected values.target_3_selected values.distractor_1_selected)
/ separatefiles = true
</data>


Edited 5 Years Ago by Dave
natash
natash
Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)Associate Member (201 reputation)
Group: Forum Members
Posts: 14, Visits: 38
Dave - 5/8/2020
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/8/2020
natash - 5/8/2020
Dave - 5/7/2020
natash - 5/7/2020
Hi together, 

I'm programming a "game" in Inquisit for an experiment. For that the person is being shown 12 pictures and he/she has to select three of them that belong together. 

Now I came across the problem that I don't know how to program that the person can select three pictures and not only one, and it would be nice if it would be shown which pictures the person already has selected and that he/she can undo the her/his choice.

I attached my script, maybe it is only possible with checkboxes but it would be a lot nicer if it would work without them as well and only with the pictures. For simplicity I'm only working with one picture right now before I've got the script running correctly.

Thank you!

There are a number of scripts in the library which do something similar, so you may want to work through those.

https://www.millisecond.com/download/library/huskerdu/
https://www.millisecond.com/download/library/columbiacardtask/
https://www.millisecond.com/download/library/v6/internationalshoppinglisttask/

The basic story goes like this:

<values>
/ a_x = 0%
/ a_y = 0%
/ b_x = 0%
/ b_y = 0%
/ c_x = 0%
/ c_y = 0%
/ d_x = 0%
/ d_y = 0%
/ a_selected = 0
/ b_selected = 0
/ c_selected = 0
/ d_selected = 0
</values>

<expressions>
/ n_selected = (values.a_selected + values.b_selected + values.c_selected + values.d_selected)
</expressions>


<text a>
/ items = ("A")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (200px,200px)
/ erase = false
</text>

<text a_bg>
/ items = (" ")
/ hposition = values.a_x
/ vposition = values.a_y
/ size = (210px,210px)
/ erase = false
</text>

<text b>
/ items = ("B")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (200px,200px)
/ erase = false
</text>

<text b_bg>
/ items = (" ")
/ hposition = values.b_x
/ vposition = values.b_y
/ size = (210px,210px)
/ erase = false
</text>

<text c>
/ items = ("C")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (200px,200px)
/ erase = false
</text>

<text c_bg>
/ items = (" ")
/ hposition = values.c_x
/ vposition = values.c_y
/ size = (210px,210px)
/ erase = false
</text>

<text d>
/ items = ("D")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (200px,200px)
/ erase = false
</text>

<text d_bg>
/ items = (" ")
/ hposition = values.d_x
/ vposition = values.d_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.a_x = list.xpos.nextvalue;
    values.a_y = list.ypos.nextvalue;
    values.b_x = list.xpos.nextvalue;
    values.b_y = list.ypos.nextvalue;
    values.c_x = list.xpos.nextvalue;
    values.c_y = list.ypos.nextvalue;
    values.d_x = list.xpos.nextvalue;
    values.d_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "a") {
        if (values.a_selected == 0) {
            values.a_selected = 1;
            text.a_bg.textbgcolor = green;
        } else if (values.a_selected == 1) {
            values.a_selected = 0;
            text.a_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "b") {
        if (values.b_selected == 0) {
            values.b_selected = 1;
            text.b_bg.textbgcolor = green;
        } else if (values.b_selected == 1) {
            values.b_selected = 0;
            text.b_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "c") {
        if (values.c_selected == 0) {
            values.c_selected = 1;
            text.c_bg.textbgcolor = green;
        } else if (values.c_selected == 1) {
            values.c_selected = 0;
            text.c_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "d") {
        if (values.d_selected == 0) {
            values.d_selected = 1;
            text.d_bg.textbgcolor = green;
        } else if (values.d_selected == 1) {
            values.d_selected = 0;
            text.d_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected]
/ inputdevice = mouse
/ validresponse = (a, b, c, d, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, a_bg, b_bg, c_bg, d_bg, a, b, c, d, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("The End")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1=start]
</block>


Thanks a lot! I'm still a bit confused, where is the possiblity to specify my pictures? This is very advanced for me, so excuse me for the questions

Instead of <text> elements, use <picture> elements. Works the same way.

That helped a lot! Now it works perfectly, the only thing is that I need it to pursue after the Person has selected three items and clicked done, then it should go on to the next items. It would be amazing if you could help me there as well

You need to spell out clearly what exactly you want to do and what exactly you don't know how to do. I.e. which parts of the code I gave you do you not understand? Then I can explain those to you and you can take it from there.

I actually think that I understand all of it. My problem is that right now it shows 4 Items and if I select three of them and click on "done" then it quits the session. What I want is that after I selected three items that it goes on to show me 4 new items from which I again have to choose three and so o

And then what? What's the relationship between the four items in every, let's call it set of four items? Why only four? For the record, I chose four for the sake of illustration, you can extend it to 3 out of 8, 10, 12 -- whatever you need or want. The vague information I have from you is not something I can reasonably work with, I'm afraid.

Okay, so here's a fairly straightforward extension of the code. Suppose you have five sets of four items each. Each set consists of three targets and one distractor item. The game thus lasts five rounds, and will give feedback about how many of the targets were identified after each round. The sets 1 to 5 are presented in random order.

<defaults>
/ fontstyle = ("Arial", 2%)
</defaults>

<values>
/ target_1_x = 0%
/ target_1_y = 0%
/ target_2_x = 0%
/ target_2_y = 0%
/ target_3_x = 0%
/ target_3_y = 0%
/ distractor_1_x = 0%
/ distractor_1_y = 0%
/ target_1_selected = 0
/ target_2_selected = 0
/ target_3_selected = 0
/ distractor_1_selected = 0
/ set = 1
</values>

<expressions>
/ n_selected = (values.target_1_selected + values.target_2_selected + values.target_3_selected + values.distractor_1_selected)
</expressions>

// five sets of four items each (three targets, one distractor)
<list setlist>
/ items = (1,2,3,4,5)
</list>

<item target_1_items>
/ 1 = "Set 1 Target 1"
/ 2 = "Set 2 Target 1"
/ 3 = "Set 3 Target 1"
/ 4 = "Set 4 Target 1"
/ 4 = "Set 5 Target 1"
</item>

<item target_2_items>
/ 1 = "Set 1 Target 2"
/ 2 = "Set 2 Target 2"
/ 3 = "Set 3 Target 2"
/ 4 = "Set 4 Target 2"
/ 4 = "Set 5 Target 2"
</item>

<item target_3_items>
/ 1 = "Set 1 Target 3"
/ 2 = "Set 2 Target 3"
/ 3 = "Set 3 Target 3"
/ 4 = "Set 4 Target 3"
/ 4 = "Set 5 Target 3"
</item>

<item distractor_1_items>
/ 1 = "Set 1 Distractor 1"
/ 2 = "Set 2 Distractor 1"
/ 3 = "Set 3 Distractor 1"
/ 4 = "Set 4 Distractor 1"
/ 4 = "Set 5 Distractor 1"
</item>

<text target_1>
/ items = target_1_items
/ select = values.set
/ hposition = values.target_1_x
/ vposition = values.target_1_y
/ size = (200px,200px)
/ erase = false
/ vjustify = center
</text>

<text target_1_bg>
/ items = (" ")
/ hposition = values.target_1_x
/ vposition = values.target_1_y
/ size = (210px,210px)
/ erase = false
</text>

<text target_2>
/ items = target_2_items
/ select = values.set
/ hposition = values.target_2_x
/ vposition = values.target_2_y
/ size = (200px,200px)
/ erase = false
/ vjustify = center
</text>

<text target_2_bg>
/ items = (" ")
/ hposition = values.target_2_x
/ vposition = values.target_2_y
/ size = (210px,210px)
/ erase = false
</text>

<text target_3>
/ items = target_3_items
/ select = values.set
/ hposition = values.target_3_x
/ vposition = values.target_3_y
/ size = (200px,200px)
/ erase = false
/ vjustify = center
</text>

<text target_3_bg>
/ items = (" ")
/ hposition = values.target_3_x
/ vposition = values.target_3_y
/ size = (210px,210px)
/ erase = false
</text>

<text distractor_1>
/ items = distractor_1_items
/ select = values.set
/ hposition = values.distractor_1_x
/ vposition = values.distractor_1_y
/ size = (200px,200px)
/ erase = false
/ vjustify = center
</text>

<text distractor_1_bg>
/ items = (" ")
/ hposition = values.distractor_1_x
/ vposition = values.distractor_1_y
/ size = (210px,210px)
/ erase = false
</text>

<list xpos>
/ items = (35%, 65%, 35%, 65%)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list ypos>
/ items = (25%, 25%, 75%, 75%)
/ selectionmode = list.xpos.currentindex
/ selectionrate = always
</list>

<trial start>
/ ontrialbegin = [
    values.set = list.setlist.nextvalue;
    text.target_1_bg.textbgcolor = white;
    text.target_2_bg.textbgcolor = white;
    text.target_3_bg.textbgcolor = white;
    text.distractor_1_bg.textbgcolor = white;
    values.target_1_selected = 0;
    values.target_2_selected = 0;
    values.target_3_selected = 0;
    values.distractor_1_selected = 0;
    values.target_1_x = list.xpos.nextvalue;
    values.target_1_y = list.ypos.nextvalue;
    values.target_2_x = list.xpos.nextvalue;
    values.target_2_y = list.ypos.nextvalue;
    values.target_3_x = list.xpos.nextvalue;
    values.target_3_y = list.ypos.nextvalue;
    values.distractor_1_x = list.xpos.nextvalue;
    values.distractor_1_y = list.ypos.nextvalue;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
/ branch = [
    trial.clicktrial;
]
</trial>

<trial clicktrial>
/ ontrialend = [
    if (trial.clicktrial.response == "target_1") {
        if (values.target_1_selected == 0) {
            values.target_1_selected = 1;
            text.target_1_bg.textbgcolor = green;
        } else if (values.target_1_selected == 1) {
            values.target_1_selected = 0;
            text.target_1_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "target_2") {
        if (values.target_2_selected == 0) {
            values.target_2_selected = 1;
            text.target_2_bg.textbgcolor = green;
        } else if (values.target_2_selected == 1) {
            values.target_2_selected = 0;
            text.target_2_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "target_3") {
        if (values.target_3_selected == 0) {
            values.target_3_selected = 1;
            text.target_3_bg.textbgcolor = green;
        } else if (values.target_3_selected == 1) {
            values.target_3_selected = 0;
            text.target_3_bg.textbgcolor = white;
        }
    };
    if (trial.clicktrial.response == "distractor_1") {
        if (values.distractor_1_selected == 0) {
            values.distractor_1_selected = 1;
            text.distractor_1_bg.textbgcolor = green;
        } else if (values.distractor_1_selected == 1) {
            values.distractor_1_selected = 0;
            text.distractor_1_bg.textbgcolor = white;
        }
    };
]

/ stimulusframes = [1=clearscreen, target_1_bg, target_2_bg,target_3_bg, distractor_1_bg, target_1, target_2, target_3, distractor_1, done, n_selected]
/ inputdevice = mouse
/ validresponse = (target_1, target_2, target_3, distractor_1, done)
/ branch = [
    if (trial.clicktrial.response != "done") {
        return trial.clicktrial;
    };
]
/ branch = [
    if (trial.clicktrial.response == "done" && expressions.n_selected != 3) {
        return trial.errortrial;
    } else {
        return trial.successtrial;
    };
]
/ recorddata = false
</trial>

<trial errortrial>
/ stimulusframes = [1=clearscreen, target_1_bg, target_2_bg,target_3_bg, distractor_1_bg, target_1, target_2, target_3, distractor_1, done, n_selected, errormsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = false
/ branch = [
    return trial.clicktrial;
]
</trial>

<trial successtrial>
/ stimulusframes = [1=clearscreen, successmsg]
/ trialduration = 1000
/ validresponse = (0)
/ recorddata = true
</trial>

<text n_selected>
/ items = ("Selected items: <%expressions.n_selected%>")
/ position = (85%, 10%)
/ erase = false
</text>

<button done>
/ caption = "DONE"
/ position = (50%, 90%)
/ size = (15%, 5%)
/ erase = false
</button>

<text errormsg>
/ items = ("Please select exactly three items")
/ txcolor = red
/ erase = false
</text>

<text successmsg>
/ items = ("You identified <%values.target_1_selected + values.target_2_selected + values.target_3_selected%> targets out of 3.")
/ txcolor = green
/ erase = false
</text>

<block myblock>
/ trials = [1-5=start]
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode
values.set values.target_1_selected values.target_2_selected values.target_3_selected values.distractor_1_selected)
/ separatefiles = true
</data>


wow thanks a lot! I will do it with 12 items, but that helps so much!!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search