Millisecond Forums

.setitem retreivable for lists and text but not pictures

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

By xiller09 - 7/2/2013

Hi There,



I'm having some trouble using item functions.


Specifically, I can call up the items as text items and directly from an item list  <%list.somelist.nextvalue%> as a text item, but not succesfully as pictures.


When the items get called up as text they appear within double quotation marks (").


This makes me believe that when I use picture.somepicture.setitem(list.somelist.currentvalue,values.somevalue) it is storing the item as "samplevalue.jpg" rather than samplevalue.jpg. I think this would explain why it can successfully present text stored using text.sometext.setitem(list.somelist.currentvalue,values.somevalue) but not pictures using the above method.


Is this correct?


If so, how do I get around this? I can't use any of the string based functions to trim out the " marks as these are delimitters in the script.



I've attached a sample script and associated files.


Adjust the following working line in trial.contingentdecision:


/ stimulustimes = [1=blanker, keptobjects_t]


to


/ stimulustimes = [1=blanker, keptobjects_p]


to try to present it as a picture rather than text and it will stop working (keptobjects_v will use <%list.somelist.nextvalue%> instead as a text stimulus)



Cheers,


By Dave - 7/2/2013

By (over)using <list> elements, you are actually making this way harder than it needs to be. Your script can be simplified to:


<block dummyblock>
/trials = [1-5=somedecision; 6=contingentdecision]
</block>

<trial somedecision>
/ stimulustimes = [1=blanker, initialobjects]
/ validresponse = (32,37)
/ ontrialend= [if(trial.somedecision.response==37){values.numkept += 1}]
/ ontrialend= [if(trial.somedecision.response==37){item.keptitems.item=picture.initialobjects.currentitem};]
</trial>

<trial contingentdecision>
/ontrialbegin = [values.contdecsel += 1]
/ stimulustimes = [1=blanker, keptobjects_p]
/ timeout = (2000)
/ branch = [if((values.contdecsel)<values.numkept){trial.contingentdecision}]
</trial>

<values>
/ numkept = 0
/ contdecsel = 0
</values>

***objectsets

<picture keptobjects_p>
/items = keptitems
/position = (50,35)
/erase = false
</picture>

<item keptitems>
</item>

***

<picture initialobjects>
/items = ("opencrayolabox.jpg","dime.jpg","ornatepillbox.jpg","usedpencil.jpg","newdetergentboxes.jpg")
/select = noreplace
/position = (50,35)
/erase = false
</picture>

<shape blanker>
/ shape = rectangle
/ color = (white)
/ size = (100%, 100%)
/ position = (50%, 50%)
/ erase = false
</shape>