natash
|
|
Group: Forum Members
Posts: 14,
Visits: 38
|
+x+x+xPlease do not paste entire scripts into a post's body. Attach the respective script instead. In addition, if the script requires external files (images, etc.) to run, please provide those files as well. Sorry, will not happen again! Thanks for providing the files. See the attached revision for details. thank you!!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+x+xPlease do not paste entire scripts into a post's body. Attach the respective script instead. In addition, if the script requires external files (images, etc.) to run, please provide those files as well. Sorry, will not happen again! Thanks for providing the files. See the attached revision for details.
|
|
|
natash
|
|
Group: Forum Members
Posts: 14,
Visits: 38
|
+xPlease do not paste entire scripts into a post's body. Attach the respective script instead. In addition, if the script requires external files (images, etc.) to run, please provide those files as well. Sorry, will not happen again!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
Please do not paste entire scripts into a post's body. Attach the respective script instead. In addition, if the script requires external files (images, etc.) to run, please provide those files as well.
|
|
|
natash
|
|
Group: Forum Members
Posts: 14,
Visits: 38
|
Hi there again,
I've got now the practice trials programmed and what I would like to do is create a branch, so that if the person doesn't select the three targets he/she is thrown back to the instruction page and has to do it all over again until she completes the practice trials without an error. I tried doing that below, I couldn't get it to start with the instruction again, all I got is that it is thrown to the "notgoodtrial" and then it doesn't start all over but continues with the trial where the error occured. Does somebody have an idea how to solve this?
best, Natash
<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% / dist_1_x = 0% / dist_1_y = 0% / dist_2_x = 0% / dist_2_y = 0% / dist_3_x = 0% / dist_3_y = 0% / dist_4_x = 0% / dist_4_y = 0% / dist_5_x = 0% / dist_5_y = 0% / dist_6_x = 0% / dist_6_y = 0% / target_1 = 0 / target_2 = 0 / target_3 = 0 / dist_1 = 0 / dist_2 = 0 / dist_3 = 0 / dist_4 = 0 / dist_5 = 0 / dist_6 = 0
/ set = 1 </values>
<expressions> / n_selected = (values.target_1 + values.target_2 + values.target_3 + values.dist_1 + values.dist_2 + values.dist_3 + values.dist_4 + values.dist_5 + values.dist_6) </expressions>
<expressions> /richtig = (values.target_1 + values.target_2 + values.target_3) </expressions>
<expressions> /falsch= (values.target_1 + values.target_2 + values.target_3!=3 && expressions.n_selected==3) </expressions>
// sets of 9 items each (three targets, nine dist) <list setlist> / items = (1,2,3) / selectionmode = sequence </list>
<item target_1_items> / 1 = "1_rund_blau_leer.png" / 2 = "1_kreuz_lila_leer.png" / 3 = "1_rund_orange_voll.png"
</item>
<item target_2_items> / 1 = "1_rund_orange_leer.png" / 2 = "1_rund_blau_leer.png" / 3 = "1_kreuz_lila_leer.png"
</item>
<item target_3_items> / 1 = "1_rund_lila_leer.png" / 2 = "1_eckig_orange_leer.png" / 3 = "1_eckig_blau_streifen.png"
</item>
<item dist_1_items> / 1 = "1_eckig_blau_leer.png" / 2 = "1_rund_lila_leer.png" / 3 = "1_rund_blau_leer.png"
</item>
<item dist_2_items> / 1 = "1_rund_lila_voll.png" / 2 = "1_rund_lila_voll.png" / 3 = "1_eckig_lila_voll.png"
</item>
<item dist_3_items> / 1 = "1_eckig_blau_voll.png" / 2 = "1_eckig_lila_voll.png" / 3 = "1_eckig_blau_voll.png"
</item>
<item dist_4_items> / 1 = "1_eckig_lila_voll.png" / 2 = "1_eckig_blau_voll.png" / 3 = "1_kreuz_blau_leer.png"
</item>
<item dist_5_items> / 1 = "1_rund_orange_voll.png" / 2 = "1_rund_orange_voll.png" / 3 = "1_rund_lila_leer.png"
</item>
<item dist_6_items> / 1 = "1_eckig_orange_leer.png" / 2 = "1_eckig_blau_leer.png" / 3 = "1_rund_lila_voll.png"
</item>
<picture target_1> / items = target_1_items / select = values.set / hposition = values.target_1_x / vposition = values.target_1_y / size = (16%, 26%) / erase = false / vjustify = center </picture>
<text target_1_bg> / items = ("") / hposition = values.target_1_x / vposition = values.target_1_y / size = (18%, 28%) / erase = false </text>
<picture target_2> / items = target_2_items / select = values.set / hposition = values.target_2_x / vposition = values.target_2_y / size = (16%, 26%) / erase = false / vjustify = center </picture>
<text target_2_bg> / items = (" ") / hposition = values.target_2_x / vposition = values.target_2_y / size = (18%, 28%) / erase = false </text>
<picture target_3> / items = target_3_items / select = values.set / hposition = values.target_3_x / vposition = values.target_3_y / size = (16%, 26%) / erase = false / vjustify = center </picture>
<text target_3_bg> / items = (" ") / hposition = values.target_3_x / vposition = values.target_3_y / size = (18%, 28%) / erase = false </text>
<picture dist_1> / items = dist_1_items / select = values.set / hposition = values.dist_1_x / vposition = values.dist_1_y / size = (16%, 26%) / erase = false / vjustify = center </picture>
<text dist_1_bg> / items = (" ") / hposition = values.dist_1_x / vposition = values.dist_1_y / size = (18%, 28%) / erase = false </text>
<picture dist_2> / items = dist_2_items / select = values.set / hposition = values.dist_2_x / vposition = values.dist_2_y / size = (16%, 26%) / erase = false / vjustify = center </picture>
<text dist_2_bg> / items = ("") / hposition = values.dist_2_x / vposition = values.dist_2_y / size = (18%, 28%) / erase = false </text>
<picture dist_3> / items = dist_3_items / select = values.set / hposition = values.dist_3_x / vposition = values.dist_3_y / size = (16%, 26%) / erase = false / vjustify = center </picture>
<text dist_3_bg> / items = (" ") / hposition = values.dist_3_x / vposition = values.dist_3_y / size = (18%, 28%) / erase = false </text>
<picture dist_4> / items = dist_4_items / select = values.set / hposition = values.dist_4_x / vposition = values.dist_4_y / size = (16%, 26%) / erase = false / vjustify = center </picture>
<text dist_4_bg> / items = (" ") / hposition = values.dist_4_x / vposition = values.dist_4_y / size = (18%, 28%) / erase = false </text>
<picture dist_5> / items = dist_5_items / select = values.set / hposition = values.dist_5_x / vposition = values.dist_5_y / size = (16%, 26%) / erase = false / vjustify = center </picture>
<text dist_5_bg> / items = (" ") / hposition = values.dist_5_x / vposition = values.dist_5_y / size = (18%, 28%) / erase = false </text>
<picture dist_6> / items = dist_6_items / select = values.set / hposition = values.dist_6_x / vposition = values.dist_6_y / size = (16%, 26%) / erase = false / vjustify = center </picture>
<text dist_6_bg> / items = (" ") / hposition = values.dist_6_x / vposition = values.dist_6_y / size = (18%, 28%) / erase = false </text>
<list xpos> / items = (10, 30, 50, 10, 30, 50, 10, 30, 50) / selectionmode = random / selectionrate = always </list>
<list ypos> / items = (15, 15, 15, 45, 45, 45, 75, 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.dist_1_bg.textbgcolor = white; text.dist_2_bg.textbgcolor = white; text.dist_3_bg.textbgcolor = white; text.dist_4_bg.textbgcolor = white; text.dist_5_bg.textbgcolor = white; text.dist_6_bg.textbgcolor = white; values.target_1 = 0; values.target_2 = 0; values.target_3 = 0; values.dist_1 = 0; values.dist_2 = 0; values.dist_3 = 0; values.dist_4 = 0; values.dist_5 = 0; values.dist_6 = 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.dist_1_x = list.xpos.nextvalue; values.dist_1_y = list.ypos.nextvalue; values.dist_2_x = list.xpos.nextvalue; values.dist_2_y = list.ypos.nextvalue; values.dist_3_x = list.xpos.nextvalue; values.dist_3_y = list.ypos.nextvalue; values.dist_4_x = list.xpos.nextvalue; values.dist_4_y = list.ypos.nextvalue; values.dist_5_x = list.xpos.nextvalue; values.dist_5_y = list.ypos.nextvalue; values.dist_6_x = list.xpos.nextvalue; values.dist_6_y = list.ypos.nextvalue;
] / stimulusframes = [1=clearscreen] / trialduration = 0 / validresponse = (0) / branch = [ trial.clicktrial; ] </trial>
<trial clicktrial> / ontrialend = [ if (trial.clicktrial.response == "target_1") { if (values.target_1 == 0) { values.target_1 = 1; text.target_1_bg.textbgcolor = grey; } else if (values.target_1 == 1) { values.target_1 = 0; text.target_1_bg.textbgcolor = white; } }; if (trial.clicktrial.response == "target_2") { if (values.target_2 == 0) { values.target_2 = 1; text.target_2_bg.textbgcolor = grey; } else if (values.target_2 == 1) { values.target_2 = 0; text.target_2_bg.textbgcolor = white; } }; if (trial.clicktrial.response == "target_3") { if (values.target_3 == 0) { values.target_3 = 1; text.target_3_bg.textbgcolor = grey; } else if (values.target_3 == 1) { values.target_3 = 0; text.target_3_bg.textbgcolor = white; } }; if (trial.clicktrial.response == "dist_1") { if (values.dist_1 == 0) { values.dist_1 = 1; text.dist_1_bg.textbgcolor = grey; } else if (values.dist_1 == 1) { values.dist_1 = 0; text.dist_1_bg.textbgcolor = white; } }; if (trial.clicktrial.response == "dist_2") { if (values.dist_2 == 0) { values.dist_2 = 1; text.dist_2_bg.textbgcolor = grey; } else if (values.dist_2 == 1) { values.dist_2 = 0; text.dist_2_bg.textbgcolor = white; } }; if (trial.clicktrial.response == "dist_3") { if (values.dist_3 == 0) { values.dist_3 = 1; text.dist_3_bg.textbgcolor = grey; } else if (values.dist_3 == 1) { values.dist_3 = 0; text.dist_3_bg.textbgcolor = white; } }; if (trial.clicktrial.response == "dist_4") { if (values.dist_4 == 0) { values.dist_4 = 1; text.dist_4_bg.textbgcolor = grey; } else if (values.dist_4 == 1) { values.dist_4 = 0; text.dist_4_bg.textbgcolor = white; } }; if (trial.clicktrial.response == "dist_5") { if (values.dist_5 == 0) { values.dist_5 = 1; text.dist_5_bg.textbgcolor = grey; } else if (values.dist_5 == 1) { values.dist_5 = 0; text.dist_5_bg.textbgcolor = white; } }; if (trial.clicktrial.response == "dist_6") { if (values.dist_6 == 0) { values.dist_6 = 1; text.dist_6_bg.textbgcolor = grey; } else if (values.dist_6 == 1) { values.dist_6 = 0; text.dist_6_bg.textbgcolor = white; } }; ]
/ stimulusframes = [1=clearscreen, target_1_bg, target_2_bg,target_3_bg, dist_1_bg, dist_2_bg, dist_3_bg, dist_4_bg, dist_5_bg, dist_6_bg, target_1, target_2, target_3, dist_1, dist_2, dist_3, dist_4, dist_5, dist_6, done, n_selected, spielregeln] / inputdevice = mouse / validresponse = (target_1, target_2, target_3, dist_1, dist_2, dist_3, dist_4, dist_5, dist_6, done) / branch = [ if (trial.clicktrial.response != "done") { return trial.clicktrial; }; ] / branch = [ if (trial.clicktrial.response == "done" && expressions.n_selected != 3) { return trial.errortrial; }; if (trial.clicktrial.response == "done" && expressions.n_selected == 3 && expressions.richtig != 3) { return trial.notgoodtrial; }; else { return trial.successtrial; } ] / recorddata = true
</trial>
<trial errortrial> / stimulusframes = [1=clearscreen, target_1_bg, target_2_bg,target_3_bg, dist_1_bg, dist_2_bg, dist_3_bg, dist_4_bg, dist_5_bg, dist_6_bg, target_1, target_2, target_3, dist_1, dist_2, dist_3, dist_4, dist_5, dist_6, done, n_selected, errormsg, spielregeln] / trialduration = 1000 / validresponse = (0) / recorddata = false / branch = [ return trial.clicktrial; ] </trial>
<trial successtrial> / stimulusframes = [1=clearscreen, successmsg] / trialduration = 1000 / validresponse = (0) / recorddata = false
</trial>
<trial notgoodtrial> / stimulusframes = [1=clearscreen, notgoodmsg] / trialduration = 1000 / validresponse = (0) / recorddata = false / branch = [ return trial.start; ] </trial>
<text notgoodmsg> / items = ("blablablabla") / erase = false </text>
<text spielregeln> / items = ("Spielregeln ~n~nMarkiere die drei setbildenden Karten. Jede Eigenschaft für sich betrachtet muss auf den drei Karten entweder dreimal genau gleich oder dreimal vollkommen unterschiedlich sein. ") / position = (70%, 20%) / size = (20%, 20%) / hjustify = left / erase = false </text>
<text n_selected> / items = ("Gewählte Karten: <%expressions.n_selected%>") / position = (70%, 70%) / erase = false </text>
<button done> / caption = "Abgabe" / position = (70%, 90%) / size = (15%, 10%) / erase = false </button>
<text errormsg> / items = ("Bitte wähle genau drei Karten aus.") / txcolor = red / erase = false </text>
<text successmsg> // items = ("You identified <%values.target_1 + values.target_2 + values.target_3%> of the SET.") / items = ("Runde <%values.set+1%>") / txcolor = green / erase = false </text>
<instruct> / nextlabel = "Weiter" / prevlabel = "Zurück " / lastlabel = "Weiter" / inputdevice = mouse / font = ("Arial", -24, 400, 0, 34) / windowsize = (95%,95%) </instruct>
<htmlpage Instruktion> / file = "test.htm" </htmlpage>
<text targets> /items = ("You identified <%values.target_1 + values.target_2 + values.target_3%> of the SET.") </text>
<block uebungsaufgaben> / preinstructions = (Instruktion) / trials = [1-3=start] </block>
<data> / columns = (date time subject group session blocknum blockcode trialnum trialcode latency expressions.falsch expressions.richtig values.set values.target_1 values.target_2 values.target_3 values.dist_1 values.dist_2 values.dist_3 values.dist_4 values.dist_5 values.dist_6 ) / separatefiles = true </data>
|
|
|
natash
|
|
Group: Forum Members
Posts: 14,
Visits: 38
|
+x+x+x+x+x+x+x+x+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> 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!!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+x+x+x+x+x+x+x+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> 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>
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+x+x+x+x+x+x+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> 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.
|
|
|
natash
|
|
Group: Forum Members
Posts: 14,
Visits: 38
|
+x+x+x+x+x+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> 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
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+x+x+x+x+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> 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.
|
|
|