ldobb
|
|
Group: Forum Members
Posts: 36,
Visits: 146
|
Hi again, I have a general strategy question. I'd like to show an image from a randomized set and have two options of words/phrases to click on, where the positioning will also be randomized. I've tried a number of different approaches and have come up short. I have managed to show the image and have randomized positioning of the stimuli (thanks to an earlier forum post), but it's unclear to me what the best method is for actually click on the words so that participants KNOW they've selected it. Ideally, the textcolor would change (I tried the code in the forum post http://www.millisecond.com/forums/Topic17402.aspx but it didn't seem to work for me). I couldn't figure out how to do it as a radiobutton, for instance. The way the code is now, the image appears with the two words, and then nothing really seems to happen if I click. Here is the code: <block alcohol> / trials = [1-10 = alcohol] </block> <picture alcohol> / items = ("1L_1.jpg","1L_2.jpg","1L_3. jpg","1L_4.jpg","1L_5.jpg","1L_6.jpg","1L_7.jpg","1L_8.jpg","1L_9.jpg","1L_10.jpg") / select = replacenorepeat / size = (80%, 80%) </picture>
<trial alcohol> / stimulusframes = [1=alcohol, alc_categories1, alc_categories2] / showmousecursor = true / validresponse = (alc_categories1, alc_categories2) </trial>
<text alc_categories1> / items = ("Non-alcoholic beverage","Food","Non-food object") / select = replace / vposition = 50% / hposition = counter.type1pos.selectedvalue / txcolor = black </text>
<text alc_categories2> / items = ("Alcoholic beverage") / vposition = 50% / hposition = counter.type2pos.selectedvalue / txcolor = black </text>
<counter type1pos> / items = (20%,80%) / select = noreplace </counter>
<counter type2pos> / items = (20%,80%) / not = (type1pos) / select = noreplace / selectionrate = always </counter>
Any feedback is greatly appreciated - especially if there's a better/more efficient way to do it!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 104K
|
If you want the <trial> to do something (show some sort of message upon response), you need to specify /responsemessage attributes in it.
<block alcohol> / trials = [1-10 = alcohol] </block>
<picture alcohol> / items = ("1L_1.jpg","1L_2.jpg","1L_3.jpg","1L_4.jpg","1L_5.jpg","1L_6.jpg","1L_7.jpg","1L_8.jpg","1L_9.jpg","1L_10.jpg") / select = replacenorepeat / size = (80%, 80%) </picture>
<trial alcohol> / stimulusframes = [1=alcohol, alc_categories1, alc_categories2] / showmousecursor = true / inputdevice = mouse / validresponse = (alc_categories1, alc_categories2) / responsemessage = (alc_categories1, alc_categories1_clicked, 500) / responsemessage = (alc_categories2, alc_categories2_clicked, 500) </trial>
<text alc_categories1> / items = ("Non-alcoholic beverage","Food","Non-food object") / select = replace / vposition = 50% / hposition = counter.type1pos.selectedvalue / txcolor = black </text>
<text alc_categories2> / items = ("Alcoholic beverage") / vposition = 50% / hposition = counter.type2pos.selectedvalue / txcolor = black </text>
<text alc_categories1_clicked> / items = ("Non-alcoholic beverage","Food","Non-food object") / select = text.alc_categories1.currentindex / vposition = 50% / hposition = text.alc_categories1.hposition / txcolor = red </text>
<text alc_categories2_clicked> / items = ("Alcoholic beverage") / vposition = 50% / hposition = text.alc_categories2.hposition / txcolor = red </text>
<counter type1pos> / items = (20%,80%) / select = noreplace </counter>
<counter type2pos> / items = (20%,80%) / not = (type1pos) / select = noreplace / selectionrate = always </counter>
|
|
|
ldobb
|
|
Group: Forum Members
Posts: 36,
Visits: 146
|
Thanks, Dave! Looks great. I just tested it, though, and it looks like sometimes when I click on the text, the red text appears on the OTHER side of the screen. Looks like it's only the text "Alcoholic beverage", so it must have to do with the alc_categories2_clicked, right? Any idea what might be happening?
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 104K
|
Change that counter's selectionrate to trial
<counter type2pos> / items = (20%,80%) / not = (type1pos) / select = noreplace
/ selectionrate = always / selectionrate = trial </counter>
There's no reason to have it set to always.
|
|
|
ldobb
|
|
Group: Forum Members
Posts: 36,
Visits: 146
|
Amazing, thanks as always. Works like a charm now.
|
|
|
ldobb
|
|
Group: Forum Members
Posts: 36,
Visits: 146
|
Hi again, Dave -
I have a new question involving the same task as troubleshot above.
Basically, I'd like to maintain the paradigm but instead of clicking, I'd like to assign the Z and / keys on the keyboard to mean left and right, respectively.
My issue is that because the hpositions are randomized, I don't know how to properly assign the "correctresponse" characters, or the "responsemessage" characters. I imagine I need some sort of conditional logic, or I need some way to associate a key with an hposition? I'm really not sure. The script is exactly the same as above because I haven't touched it/am not sure where to begin.
Thanks in advance.
|
|
|
ldobb
|
|
Group: Forum Members
Posts: 36,
Visits: 146
|
I should also add that if I just have the characters as responses, it'll be somewhat hard for me to understand the data at the end. Hopefully there's a way around that too.
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 104K
|
Correct. You need to apply conditional logic via the <trial>'s /iscorrectresponse attribute. You'll then also want to use /correctmessage and /errormessage instead of /responsemessage.
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 104K
|
In short, you do (example uses the D and K keys on the keyboard)
<block alcohol> / trials = [1-10 = alcohol] </block>
<picture alcohol> / items = ("1L_1.jpg","1L_2.jpg","1L_3.jpg","1L_4.jpg","1L_5.jpg","1L_6.jpg","1L_7.jpg","1L_8.jpg","1L_9.jpg","1L_10.jpg") / select = replacenorepeat / size = (80%, 80%) </picture>
<trial alcohol> / stimulusframes = [1=alcohol, alc_categories1, alc_categories2] / validresponse = (32, 37) / iscorrectresponse = [(text.alc_categories2.hposition==20% && trial.alcohol.response==32) || (text.alc_categories2.hposition==80% && trial.alcohol.response==37)] / errormessage = (alc_categories1_clicked, 500) / correctmessage = (alc_categories2_clicked, 500) </trial>
<text alc_categories1> / items = ("Non-alcoholic beverage","Food","Non-food object") / select = replace / vposition = 50% / hposition = counter.type1pos.selectedvalue / txcolor = black </text>
<text alc_categories2> / items = ("Alcoholic beverage") / vposition = 50% / hposition = counter.type2pos.selectedvalue / txcolor = black </text>
<text alc_categories1_clicked> / items = ("Non-alcoholic beverage","Food","Non-food object") / select = text.alc_categories1.currentindex / vposition = 50% / hposition = text.alc_categories1.hposition / txcolor = red </text>
<text alc_categories2_clicked> / items = ("Alcoholic beverage") / vposition = 50% / hposition = text.alc_categories2.hposition / txcolor = red </text>
<counter type1pos> / items = (20%,80%) / select = noreplace </counter>
<counter type2pos> / items = (20%,80%) / not = (type1pos) / select = noreplace </counter>
or something similar. You can find lots of examples using /isvalid- and /iscorrectresponse on the forum or in the scripts available in the library if you want to delve in deeper.
|
|
|
ldobb
|
|
Group: Forum Members
Posts: 36,
Visits: 146
|
Are there any other posts/documents I can look to for understanding how to best set up this logic? Would it be something like: / iscorrectresponse = [if (text.alc_alc.hposition == 20%) trial.alcohol.correct == "Z"; if (text.alc_alc.hposition == 80%) trial.alcohol.correct == "/"] ???
And then in the data file, is there a way for me to record what the key corresponded to? Or should I just have all the stimulusitem columns and then a correct column and figure it out myself?
|
|
|