+xHi 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>