Millisecond Forums

How to delete items from pictures, and to be able to use remaining ones in another trial?

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

By mingwu - 11/6/2016

My task is to run the trials where I show some pictures(not all) from summerpicture, and once I have finished to show them, I would like to have 2 collections of: 1.pictures that were displayed and 2. pictures that were not displayed!!. I need to show non-displayed pictures separately for my second trial. 

Here is my thinking:
I think my problem occurs in ontrialend. 
Actually, my first trial(summerdelete) does not show any errors


<trial summerdelete> 
/ontrialbegin = [
values.congruency = 1;
]
/ stimulustimes = [1=summerpicture]
/ correctresponse = ("d")
/ validresponse = ("d", "f", "j", "k")
/ontrialend = [
item.summerremained.removeitem(picture.summerpicture.currentindex);
item.summerdisplayed.appenditem(picture.summerpicture.currentitem);
]
</trial>

However, when I run the second one, 

<trial summershow> 
/ontrialbegin = [
values.congruency = 1;
]
/ stimulustimes = [1=summerpicturerest]
/ correctresponse = ("d")
/ validresponse = ("d", "f", "j", "k")
/ontrialend = [
list.latencies.insertitem(trial.purpleincongruent.latency, 1);

I get an error, for example
Unable to initialize <picture summerpicturerest> item number 8. Verify the item exists and is correctly defined.

Please, help. I think the way I am deleting items is wrong. 
Here is, how I am declaring items and pictures.

<item summeroriginal>
/1="Summer/1.jpg"
/2="Summer/2.jpg"
/3="Summer/3.jpg"
/4="Summer/4.jpg"
/5="Summer/5.jpg"
/6="Summer/6.jpg"
/7="Summer/7.jpg"
/8="Summer/8.jpg"
</item>

<item summerremained>
/1="Summer/1.jpg"
/2="Summer/2.jpg"
/3="Summer/3.jpg"
/4="Summer/4.jpg"
/5="Summer/5.jpg"
/6="Summer/6.jpg"
/7="Summer/7.jpg"
/8="Summer/8.jpg"
</item>

<item summerdisplayed>
</item>


<picture summerpicture>
/ items = summeroriginal
/ valign =center
/ height = 35
/halign=center
/ width = 80
/ size = (60%,60%)
</picture>

<picture summerpicturerest>
/ items = summerremained
/ valign =center
/ height = 35
/halign=center
/ width = 80
/ size = (60%,60%)
</picture>
By Dave - 11/6/2016

mingwu - Sunday, November 06, 2016
My task is to run the trials where I show some pictures(not all) from summerpicture, and once I have finished to show them, I would like to have 2 collections of: 1.pictures that were displayed and 2. pictures that were not displayed!!. I need to show non-displayed pictures separately for my second trial. 

Here is my thinking:
I think my problem occurs in ontrialend. 
Actually, my first trial(summerdelete) does not show any errors


<trial summerdelete> 
/ontrialbegin = [
values.congruency = 1;
]
/ stimulustimes = [1=summerpicture]
/ correctresponse = ("d")
/ validresponse = ("d", "f", "j", "k")
/ontrialend = [
item.summerremained.removeitem(picture.summerpicture.currentindex);
item.summerdisplayed.appenditem(picture.summerpicture.currentitem);
]
</trial>

However, when I run the second one, 

<trial summershow> 
/ontrialbegin = [
values.congruency = 1;
]
/ stimulustimes = [1=summerpicturerest]
/ correctresponse = ("d")
/ validresponse = ("d", "f", "j", "k")
/ontrialend = [
list.latencies.insertitem(trial.purpleincongruent.latency, 1);

I get an error, for example
Unable to initialize <picture summerpicturerest> item number 8. Verify the item exists and is correctly defined.

Please, help. I think the way I am deleting items is wrong. 
Here is, how I am declaring items and pictures.

<item summeroriginal>
/1="Summer/1.jpg"
/2="Summer/2.jpg"
/3="Summer/3.jpg"
/4="Summer/4.jpg"
/5="Summer/5.jpg"
/6="Summer/6.jpg"
/7="Summer/7.jpg"
/8="Summer/8.jpg"
</item>

<item summerremained>
/1="Summer/1.jpg"
/2="Summer/2.jpg"
/3="Summer/3.jpg"
/4="Summer/4.jpg"
/5="Summer/5.jpg"
/6="Summer/6.jpg"
/7="Summer/7.jpg"
/8="Summer/8.jpg"
</item>

<item summerdisplayed>
</item>


<picture summerpicture>
/ items = summeroriginal
/ valign =center
/ height = 35
/halign=center
/ width = 80
/ size = (60%,60%)
</picture>

<picture summerpicturerest>
/ items = summerremained
/ valign =center
/ height = 35
/halign=center
/ width = 80
/ size = (60%,60%)
</picture>

Instead of removing images from and appending them to <item> elements, the better way is to simply work with *item numbers* and distribute them to various <list>s for selection. See e.g. https://www.millisecond.com/forums/FindPost17070.aspx