Millisecond Forums

How to save current item in image element to datafile?

https://forums.millisecond.com/Topic32399.aspx

By pops - 10/28/2021

Sorry, this has probably been asked before but searching the forums is very slow and tedious (the name 'instantForum' being some sort of joke) and I cannot find what I am looking for.

At the end of my experiment I want to test participant's knowledge by showing each stimulus and asking them a radiobutton question. Based on advice in the forums I am therefore using the image element and (radiobutton element) and putting them both in a surveypage. This is the essential code.

<item monsterImages>
/ 1 ="M1.GIF"
/ 2 ="M2.GIF"
/ 3 ="M3.GIF"
/ 4 ="M4.GIF"
</item>

<image instrumKnowledge>
/items = monsterImages
</image>

<radiobuttons instrumKnowledgeQ>
/ caption = "If you saw this monster appear, what was the correct response to make and what would you earn?"
/ options = ("Click to earn chocolate", "Click to earn ice cream", "do not click to earn chocolate", "do not click to earn ice cream")
</radiobuttons>

<surveypage instrumKnowledge>
/ questions = [1=instrumKnowledge; 2 = radiobuttons.instrumKnowledgeQ]
/ showquestionnumbers = false
/ showpagenumbers = false
</surveypage>

<block knowledgeTests>
/ preinstructions = (page.finalKnowledgeCheck)
/ onblockbegin = [values.blockCount +=1; values.trialcount = 0;]
/trials = [1-4 = surveypage.instrumKnowledge;]
/ postinstructions = (page.thankyou)
</block>

Despite the fact that there is no 'select' option available under the image element, the script runs through the four monsterImages stimuli when I run the block. However, no information about which of the four stimuli is currently being shown is recorded anywhere in the datafile (e.g., the stimulusitem field just populates with 'monsterImages'). I assumed that I could use something like currrentPic = item.monsterImages.currentitem feature with onblockend but this is apparently not possible with the surveypage element? Advice appreciated. Thank you
By Dave - 10/28/2021

pops - 10/28/2021
Sorry, this has probably been asked before but searching the forums is very slow and tedious (the name 'instantForum' being some sort of joke) and I cannot find what I am looking for.

At the end of my experiment I want to test participant's knowledge by showing each stimulus and asking them a radiobutton question. Based on advice in the forums I am therefore using the image element and (radiobutton element) and putting them both in a surveypage. This is the essential code.

<item monsterImages>
/ 1 ="M1.GIF"
/ 2 ="M2.GIF"
/ 3 ="M3.GIF"
/ 4 ="M4.GIF"
</item>

<image instrumKnowledge>
/items = monsterImages
</image>

<radiobuttons instrumKnowledgeQ>
/ caption = "If you saw this monster appear, what was the correct response to make and what would you earn?"
/ options = ("Click to earn chocolate", "Click to earn ice cream", "do not click to earn chocolate", "do not click to earn ice cream")
</radiobuttons>

<surveypage instrumKnowledge>
/ questions = [1=instrumKnowledge; 2 = radiobuttons.instrumKnowledgeQ]
/ showquestionnumbers = false
/ showpagenumbers = false
</surveypage>

<block knowledgeTests>
/ preinstructions = (page.finalKnowledgeCheck)
/ onblockbegin = [values.blockCount +=1; values.trialcount = 0;]
/trials = [1-4 = surveypage.instrumKnowledge;]
/ postinstructions = (page.thankyou)
</block>

Despite the fact that there is no 'select' option available under the image element, the script runs through the four monsterImages stimuli when I run the block. However, no information about which of the four stimuli is currently being shown is recorded anywhere in the datafile (e.g., the stimulusitem field just populates with 'monsterImages'). I assumed that I could use something like currrentPic = item.monsterImages.currentitem feature with onblockend but this is apparently not possible with the surveypage element? Advice appreciated. Thank you

Yes, this is a limitation of the <image> element and requires a little trickery:

<item monsterImages>
/ 1 ="M1.GIF"
/ 2 ="M2.GIF"
/ 3 ="M3.GIF"
/ 4 ="M4.GIF"
</item>

<picture monsterpic>
/ items = monsterImages
/ position = (-1%,-1%)
/ size = (0.5px, 0.5px)
</picture>

<image instrumKnowledge>
/items = ("<%picture.monsterpic.currentitem%>")
</image>

<radiobuttons instrumKnowledgeQ>
/ caption = "If you saw this monster appear, what was the correct response to make and what would you earn?"
/ options = ("Click to earn chocolate", "Click to earn ice cream", "do not click to earn chocolate", "do not click to earn ice cream")
</radiobuttons>

<surveypage instrumKnowledge>
/ stimulusframes = [1=monsterpic]
/ questions = [1=instrumKnowledge; 2 = radiobuttons.instrumKnowledgeQ]
/ showquestionnumbers = false
/ showpagenumbers = false
</surveypage>

<block knowledgeTests>
/ preinstructions = (page.finalKnowledgeCheck)
/ onblockbegin = [values.blockCount +=1; values.trialcount = 0;]
/trials = [1-4 = surveypage.instrumKnowledge;]
/ postinstructions = (page.thankyou)
</block>


By pops - 10/28/2021

Dave - 10/29/2021
pops - 10/28/2021
Sorry, this has probably been asked before but searching the forums is very slow and tedious (the name 'instantForum' being some sort of joke) and I cannot find what I am looking for.

At the end of my experiment I want to test participant's knowledge by showing each stimulus and asking them a radiobutton question. Based on advice in the forums I am therefore using the image element and (radiobutton element) and putting them both in a surveypage. This is the essential code.

<item monsterImages>
/ 1 ="M1.GIF"
/ 2 ="M2.GIF"
/ 3 ="M3.GIF"
/ 4 ="M4.GIF"
</item>

<image instrumKnowledge>
/items = monsterImages
</image>

<radiobuttons instrumKnowledgeQ>
/ caption = "If you saw this monster appear, what was the correct response to make and what would you earn?"
/ options = ("Click to earn chocolate", "Click to earn ice cream", "do not click to earn chocolate", "do not click to earn ice cream")
</radiobuttons>

<surveypage instrumKnowledge>
/ questions = [1=instrumKnowledge; 2 = radiobuttons.instrumKnowledgeQ]
/ showquestionnumbers = false
/ showpagenumbers = false
</surveypage>

<block knowledgeTests>
/ preinstructions = (page.finalKnowledgeCheck)
/ onblockbegin = [values.blockCount +=1; values.trialcount = 0;]
/trials = [1-4 = surveypage.instrumKnowledge;]
/ postinstructions = (page.thankyou)
</block>

Despite the fact that there is no 'select' option available under the image element, the script runs through the four monsterImages stimuli when I run the block. However, no information about which of the four stimuli is currently being shown is recorded anywhere in the datafile (e.g., the stimulusitem field just populates with 'monsterImages'). I assumed that I could use something like currrentPic = item.monsterImages.currentitem feature with onblockend but this is apparently not possible with the surveypage element? Advice appreciated. Thank you

Yes, this is a limitation of the <image> element and requires a little trickery:

<item monsterImages>
/ 1 ="M1.GIF"
/ 2 ="M2.GIF"
/ 3 ="M3.GIF"
/ 4 ="M4.GIF"
</item>

<picture monsterpic>
/ items = monsterImages
/ position = (-1%,-1%)
/ size = (0.5px, 0.5px)
</picture>

<image instrumKnowledge>
/items = ("<%picture.monsterpic.currentitem%>")
</image>

<radiobuttons instrumKnowledgeQ>
/ caption = "If you saw this monster appear, what was the correct response to make and what would you earn?"
/ options = ("Click to earn chocolate", "Click to earn ice cream", "do not click to earn chocolate", "do not click to earn ice cream")
</radiobuttons>

<surveypage instrumKnowledge>
/ stimulusframes = [1=monsterpic]
/ questions = [1=instrumKnowledge; 2 = radiobuttons.instrumKnowledgeQ]
/ showquestionnumbers = false
/ showpagenumbers = false
</surveypage>

<block knowledgeTests>
/ preinstructions = (page.finalKnowledgeCheck)
/ onblockbegin = [values.blockCount +=1; values.trialcount = 0;]
/trials = [1-4 = surveypage.instrumKnowledge;]
/ postinstructions = (page.thankyou)
</block>



Thanks Dave! I would have been struggling to figure that out on my own :