Nested while loops for populating lists


Author
Message
kev_dent
kev_dent
Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)
Group: Forum Members
Posts: 47, Visits: 153
I'm trying to use nested while loops to prepopulate a bunch of lists that subsequently go on to control the properties of the stimuli in an experiment.
Here is a version of the code I'm working with. I can't seem to get it to work. Am I doing something wrong?
Any suggestions welcome.

<expt main>
/ onexptbegin = [
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
    
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
    
    var tcounter =0;
    
    while (CT1pos <2);
    {
    WT1pos =     100*(CT1pos +3);
    CT1pos +=1;
    
    while (Crotatet <2);
    {
    Wrotatet =     30*(Crotatet -0.5);
    Crotatet +=1;
    
        while (Cemotion<3);
        {
        Wemotion =     (Cemotion +1);
        Cemotion +=1;
    
            while (Csaliency<2);
            {
            Wsaliency =     (Csaliency +1);
            Csaliency +=1;
            
                while (CT2lag<2);
                {
                WT2lag =     (CT2lag*500)+200;
                CT2lag +=1;
                
                    while (CT1gender<2);
                    {
                    WT1gender =     (CT1gender +1);
                    CT1gender +=1;
                    {
                        while (CT2gender<2);
                        
                        WT2gender =     (CT2gender +1);
                        CT2gender +=1;
                        tcounter +=1;
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
kev_dent - 11/30/2023
I'm trying to use nested while loops to prepopulate a bunch of lists that subsequently go on to control the properties of the stimuli in an experiment.
Here is a version of the code I'm working with. I can't seem to get it to work. Am I doing something wrong?
Any suggestions welcome.

<expt main>
/ onexptbegin = [
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
    
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
    
    var tcounter =0;
    
    while (CT1pos <2);
    {
    WT1pos =     100*(CT1pos +3);
    CT1pos +=1;
    
    while (Crotatet <2);
    {
    Wrotatet =     30*(Crotatet -0.5);
    Crotatet +=1;
    
        while (Cemotion<3);
        {
        Wemotion =     (Cemotion +1);
        Cemotion +=1;
    
            while (Csaliency<2);
            {
            Wsaliency =     (Csaliency +1);
            Csaliency +=1;
            
                while (CT2lag<2);
                {
                WT2lag =     (CT2lag*500)+200;
                CT2lag +=1;
                
                    while (CT1gender<2);
                    {
                    WT1gender =     (CT1gender +1);
                    CT1gender +=1;
                    {
                        while (CT2gender<2);
                        
                        WT2gender =     (CT2gender +1);
                        CT2gender +=1;
                        tcounter +=1;
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>

(1) Please post code that actually runs, i.e. that includes all elements referenced in the code.
(2) When you say that code "does not work", you should first explain what the code is intended to do in the first place by commenting it properly. Then explain what, specifically, you think is not working properly.
kev_dent
kev_dent
Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)
Group: Forum Members
Posts: 47, Visits: 153
Here is the full script, I am working with.
Basically, my goal is to use var type variables to populate a set of lists, these lists then will go on to control stimulus presentation.
Essentially the issue is that I can not get my code to populate my lists at all.
I copied the code from the programmers manual and can't achieve the same in my code.
Is there an example perhaps in the library that shows how to use var type variables to control stimulus presentation?
Thanks 
Kevin
<list rotate>
/items=(0)
/poolsize =14
/ selectionrate = always
</list>

<values>
/scale = 100
</values>



<list T1pos>
/ selectionrate = trial
/ items = ()


</list>

<list rotatet>
/ selectionrate = trial
/ items = ()
/select = list.T1pos.nextindex
</list>

<list emotion>
/ items = ()

/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list saliency>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2lag>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T1gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list maleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<list femaleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<values>
/T2pos = 0
</values>

<item neutralfemale>
/1="WF01/WF01_NO.jpg"
/2="WF02/WF02_NO.jpg"
/3="WF03/WF03_NO.jpg"
/4="WF04/WF04_NO.jpg"
/5="WF05/WF05_NO.jpg"
/6="WF06/WF06_NO.jpg"
/7="WF07/WF07_NO.jpg"
/8="WF08/WF08_NO.jpg"
/9="WF09/WF09_NO.jpg"
/10="WF10/WF10_NO.jpg"
/11="WF11/WF11_NO.jpg"
/12="WF12/WF12_NO.jpg"
/13="WF13/WF13_NO.jpg"
</item>
<item neutralmale>
/1="WM01/WM01_NO.jpg"
/2="WM02/WM02_NO.jpg"
/3="WM03/WM03_NO.jpg"
/4="WM04/WM04_NO.jpg"
/5="WM05/WM05_NO.jpg"
/6="WM06/WM06_NO.jpg"
/7="WM07/WM07_NO.jpg"
/8="WM08/WM08_NO.jpg"
/9="WM09/WM09_NO.jpg"
/10="WM10/WM10_NO.jpg"
/11="WM11/WM11_NO.jpg"
/12="WM12/WM12_NO.jpg"
/13="WM13/WM13_NO.jpg"
</item>
<item neutralfemaleRED>
/1="WF01/WF01_REDs_NO.jpg"
/2="WF02/WF02_REDs_NO.jpg"
/3="WF03/WF03_REDs_NO.jpg"
/4="WF04/WF04_REDs_NO.jpg"
/5="WF05/WF05_REDs_NO.jpg"
/6="WF06/WF06_REDs_NO.jpg"
/7="WF07/WF07_REDs_NO.jpg"
/8="WF08/WF08_REDs_NO.jpg"
/9="WF09/WF09_REDs_NO.jpg"
/10="WF10/WF10_REDs_NO.jpg"
/11="WF11/WF11_REDs_NO.jpg"
/12="WF12/WF12_REDs_NO.jpg"
/13="WF13/WF13_REDs_NO.jpg"
</item>
<item neutralmaleRED>
/1="WM01/WM01_REDs_NO.jpg"
/2="WM02/WM02_REDs_NO.jpg"
/3="WM03/WM03_REDs_NO.jpg"
/4="WM04/WM04_REDs_NO.jpg"
/5="WM05/WM05_REDs_NO.jpg"
/6="WM06/WM06_REDs_NO.jpg"
/7="WM07/WM07_REDs_NO.jpg"
/8="WM08/WM08_REDs_NO.jpg"
/9="WM09/WM09_REDs_NO.jpg"
/10="WM10/WM10_REDs_NO.jpg"
/11="WM11/WM11_REDs_NO.jpg"
/12="WM12/WM12_REDs_NO.jpg"
/13="WM13/WM13_REDs_NO.jpg"
</item>
<item angryfemale>
/1="WF01/WF01_AO.jpg"
/2="WF02/WF02_AO.jpg"
/3="WF03/WF03_AO.jpg"
/4="WF04/WF04_AO.jpg"
/5="WF05/WF05_AO.jpg"
/6="WF06/WF06_AO.jpg"
/7="WF07/WF07_AO.jpg"
/8="WF08/WF08_AO.jpg"
/9="WF09/WF09_AC.jpg"
/10="WF10/WF10_AO.jpg"
/11="WF11/WF11_AO.jpg"
/12="WF12/WF12_AO.jpg"
/13="WF13/WF13_AO.jpg"
</item>

<item angrymale>
/1="WM01/WM01_AO.jpg"
/2="WM02/WM02_AO.jpg"
/3="WM03/WM03_AO.jpg"
/4="WM04/WM04_AO.jpg"
/5="WM05/WM05_AO.jpg"
/6="WM06/WM06_AO.jpg"
/7="WM07/WM07_AO.jpg"
/8="WM08/WM08_AO.jpg"
/9="WM09/WM09_AO.jpg"
/10="WM10/WM10_AO.jpg"
/11="WM11/WM11_AO.jpg"
/12="WM12/WM12_AO.jpg"
/13="WM13/WM13_AO.jpg"
</item>

<item fearfemale>
/1="WF01/WF01_FO.jpg"
/2="WF02/WF02_FO.jpg"
/3="WF03/WF03_FO.jpg"
/4="WF04/WF04_FO.jpg"
/5="WF05/WF05_FO.jpg"
/6="WF06/WF06_FO.jpg"
/7="WF07/WF07_FO.jpg"
/8="WF08/WF08_FO.jpg"
/9="WF09/WF09_FO.jpg"
/10="WF10/WF10_FO.jpg"
/11="WF11/WF11_FO.jpg"
/12="WF12/WF12_FO.jpg"
/13="WF13/WF13_FO.jpg"
</item>
<item fearmale>
/1="WM01/WM01_FO.jpg"
/2="WM02/WM02_FO.jpg"
/3="WM03/WM03_FO.jpg"
/4="WM04/WM04_FO.jpg"
/5="WM05/WM05_FO.jpg"
/6="WM06/WM06_FO.jpg"
/7="WM07/WM07_FO.jpg"
/8="WM08/WM08_FO.jpg"
/9="WM09/WM09_FO.jpg"
/10="WM10/WM10_FO.jpg"
/11="WM11/WM11_FO.jpg"
/12="WM12/WM12_FO.jpg"
/13="WM13/WM13_FO.jpg"
</item>

<item angryfemaleRED>
/1="WF01/WF01_REDs_AO.jpg"
/2="WF02/WF02_REDs_AO.jpg"
/3="WF03/WF03_REDs_AO.jpg"
/4="WF04/WF04_REDs_AO.jpg"
/5="WF05/WF05_REDs_AO.jpg"
/6="WF06/WF06_REDs_AO.jpg"
/7="WF07/WF07_REDs_AO.jpg"
/8="WF08/WF08_REDs_AO.jpg"
/9="WF09/WF09_REDs_AC.jpg"
/10="WF10/WF10_REDs_AO.jpg"
/11="WF11/WF11_REDs_AO.jpg"
/12="WF12/WF12_RED_AO.jpg"
/13="WF13/WF13_RED_AO.jpg"
</item>

<item angrymaleRED>
/1="WM01/WM01_REDs_AO.jpg"
/2="WM02/WM02_REDs_AO.jpg"
/3="WM03/WM03_REDs_AO.jpg"
/4="WM04/WM04_REDs_AO.jpg"
/5="WM05/WM05_REDs_AO.jpg"
/6="WM06/WM06_REDs_AO.jpg"
/7="WM07/WM07_REDs_AO.jpg"
/8="WM08/WM08_REDs_AO.jpg"
/9="WM09/WM09_REDs_AO.jpg"
/10="WM10/WM10_REDs_AO.jpg"
/11="WM11/WM11_REDs_AO.jpg"
/12="WM12/WM12_REDs_AO.jpg"
/13="WM13/WM13_REDs_AO.jpg"
</item>

<item fearfemaleRED>
/1="WF01/WF01_REDs_FO.jpg"
/2="WF02/WF02_REDs_FO.jpg"
/3="WF03/WF03_REDs_FO.jpg"
/4="WF04/WF04_REDs_FO.jpg"
/5="WF05/WF05_REDs_FO.jpg"
/6="WF06/WF06_REDs_FO.jpg"
/7="WF07/WF07_REDs_FO.jpg"
/8="WF08/WF08_REDs_FO.jpg"
/9="WF09/WF09_REDs_FO.jpg"
/10="WF10/WF10_REDs_FO.jpg"
/11="WF11/WF11_REDs_FO.jpg"
/12="WF12/WF12_RED_FO.jpg"
/13="WF13/WF13_RED_FO.jpg"
</item>
<item fearmaleRED>
/1="WM01/WM01_REDs_FO.jpg"
/2="WM02/WM02_REDs_FO.jpg"
/3="WM03/WM03_REDs_FO.jpg"
/4="WM04/WM04_REDs_FO.jpg"
/5="WM05/WM05_REDs_FO.jpg"
/6="WM06/WM06_REDs_FO.jpg"
/7="WM07/WM07_REDs_FO.jpg"
/8="WM08/WM08_REDs_FO.jpg"
/9="WM09/WM09_REDs_FO.jpg"
/10="WM10/WM10_REDs_FO.jpg"
/11="WM11/WM11_REDs_FO.jpg"
/12="WM12/WM12_REDs_FO.jpg"
/13="WM13/WM13_REDs_FO.jpg"
</item>

<item scrambledneutral>
/1="Scrm_data_KD/WF01_NO_S.jpg"
/2="Scrm_data_KD/WF02_NO_S.jpg"
/3="Scrm_data_KD/WF03_NO_S.jpg"
/4="Scrm_data_KD/WF04_NO_S.jpg"
/5="Scrm_data_KD/WF05_NO_S.jpg"
/6="Scrm_data_KD/WF06_NO_S.jpg"
/7="Scrm_data_KD/WF07_NO_S.jpg"
/8="Scrm_data_KD/WF08_NO_S.jpg"
/9="Scrm_data_KD/WF09_NO_S.jpg"
/10="Scrm_data_KD/WF10_NO_S.jpg"
/11="Scrm_data_KD/WF11_NO_S.jpg"
/12="Scrm_data_KD/WF12_NO_S.jpg"
/13="Scrm_data_KD/WF13_NO_S.jpg"
/14="Scrm_data_KD/WM01_NO_S.jpg"
/15="Scrm_data_KD/WM02_NO_S.jpg"
/16="Scrm_data_KD/WM03_NO_S.jpg"
/17="Scrm_data_KD/WM04_NO_S.jpg"
/18="Scrm_data_KD/WM05_NO_S.jpg"
/19="Scrm_data_KD/WM06_NO_S.jpg"
/20="Scrm_data_KD/WM07_NO_S.jpg"
/21="Scrm_data_KD/WM08_NO_S.jpg"
/22="Scrm_data_KD/WM09_NO_S.jpg"
/23="Scrm_data_KD/WM10_NO_S.jpg"
/24="Scrm_data_KD/WM11_NO_S.jpg"
/25="Scrm_data_KD/WM12_NO_S.jpg"
/26="Scrm_data_KD/WM13_NO_S.jpg"
</item>
<list scramselect>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26)

/ selectionrate = always
</list>

<picture distractor1>
/ items = scrambledneutral
/ selectionrate = always
/ size= (values.scale-0mm,values.scale-0mm)
/ select = list.scramselect.nextvalue
</picture>

<picture distractor2>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor3>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor4>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor5>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor6>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor7>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor8>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor9>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor10>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor11>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor12>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor13>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angryfemaleRED>
/ items = angryfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angrymaleRED>
/ items = angrymaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemaleRED>
/ items = fearfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture fearmaleRED>
/ items = fearmaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angryfemale>
/ items = angryfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angrymale>
/ items = angrymale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemale>
/ items = fearfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearmale>
/ items = fearmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture neutralmalet>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)
</picture>

<picture neutralfemalet>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)

</picture>

<picture neutralfemale>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture neutralmale>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<shape blank>
/shape =rectangle
/color = (white)
/ size = (100%, 100%)
</shape>


<trial facestream1>
/ontrialbegin =[

list.scramselect.reset();
list.maleselect.reset();
list.femaleselect.reset();
trial.facestream1.clearstimulusframes();
values.T2pos=list.T1pos.nextvalue + list.T2lag.nextvalue;
trial.facestream1.setstimulustime(shape.blank, 100*1);
trial.facestream1.setstimulustime(shape.blank, 200*1);
trial.facestream1.setstimulustime(shape.blank, 300*1);
trial.facestream1.setstimulustime(shape.blank, 400*1);
trial.facestream1.setstimulustime(shape.blank, 500*1);
trial.facestream1.setstimulustime(shape.blank, 600*1);
trial.facestream1.setstimulustime(shape.blank, 700*1);
trial.facestream1.setstimulustime(shape.blank, 800*1);
trial.facestream1.setstimulustime(shape.blank, 900*1);
trial.facestream1.setstimulustime(shape.blank, 1000*1);
trial.facestream1.setstimulustime(shape.blank, 1100*1);
trial.facestream1.setstimulustime(shape.blank, 1200*1);
trial.facestream1.setstimulustime(shape.blank, 1300*1);
trial.facestream1.insertstimulustime(picture.distractor1, 100*1);
trial.facestream1.insertstimulustime(picture.distractor2, 200*1);
trial.facestream1.insertstimulustime(picture.distractor3, 300*1);
trial.facestream1.insertstimulustime(picture.distractor4, 400*1);
trial.facestream1.insertstimulustime(picture.distractor5, 500*1);
trial.facestream1.insertstimulustime(picture.distractor6, 600*1);
trial.facestream1.insertstimulustime(picture.distractor7, 700*1);
trial.facestream1.insertstimulustime(picture.distractor8, 800*1);
trial.facestream1.insertstimulustime(picture.distractor9, 900*1);
trial.facestream1.insertstimulustime(picture.distractor10, 1000*1);
trial.facestream1.insertstimulustime(picture.distractor11, 1100*1);
trial.facestream1.insertstimulustime(picture.distractor12, 1200*1);
trial.facestream1.insertstimulustime(picture.distractor13, 1300*1);
trial.facestream1.insertstimulustime(shape.blank, 1400*1);

trial.facestream1.setstimulustime(shape.blank, values.T2pos);
if (list.T2gender.nextvalue==1)
trial.facestream1.insertstimulustime(picture.neutralfemalet, values.T2pos)
else if (list.T2gender.nextvalue==2)
trial.facestream1.insertstimulustime(picture.neutralmalet, values.T2pos);
trial.facestream1.setstimulustime(shape.blank, list.T1pos.nextvalue);


if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.neutralfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue);

if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.neutralmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue);
]
/stimulustimes =[
]
/ validresponse = (44,49)
/ inputdevice = keyboard
/ iscorrectresponse = [(list.T2gender.nextvalue==2 && trial.facestream1.response == 49)||(list.T2gender.nextvalue==1 && trial.facestream1.response == 44)]

</trial>

<data>
/ columns = (
date,
time,
group,
subject,
trialcode,
blockcode,
blocknum,
trialnum,
latency,
response,
responsetext,
list.T1gender.currentvalue,
list.T2gender.currentvalue,
list.emotion.currentvalue
list.saliency.currentvalue,
list.T1pos.currentvalue,
list.T2lag.currentvalue,
values.T2pos,
list.rotatet.currentvalue,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,

)



</data>




<page instruct>
^^ Look for the tilted face.
^^ If it is female to the left (top on left) press Z
^^ If it is male to the left (top on rigt) press N
</page>

<page break>
^^ Please take a breather...
</page>

<text correcttext>
/items =("Correct")
/ txcolor = green
</text>

<text errortext>
/items =("Wrong")
/ txcolor = red
</text>

<trial break>
/ timeout = 0
</trial>

<block break>
/preinstructions = (break)
/trials=[1=break]
</block>


<block main>
/preinstructions = (instruct)
/trials=[1-96=noreplace(facestream1)]
</block>

<expt main>
/ onexptbegin = [
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
    
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
    
    var tcounter =0;
    
    while (CT1pos <2);
    {
    WT1pos =     100*(CT1pos +3);
    CT1pos +=1;
    
    while (Crotatet <2);
    {
    Wrotatet =     30*(Crotatet -0.5);
    Crotatet +=1;
    
        while (Cemotion<3);
        {
        Wemotion =     (Cemotion +1);
        Cemotion +=1;
    
            while (Csaliency<2);
            {
            Wsaliency =     (Csaliency +1);
            Csaliency +=1;
            
                while (CT2lag<2);
                {
                WT2lag =     (CT2lag*500)+200;
                CT2lag +=1;
                
                    while (CT1gender<2);
                    {
                    WT1gender =     (CT1gender +1);
                    CT1gender +=1;
                    {
                        while (CT2gender<2);
                        
                        WT2gender =     (CT2gender +1);
                        CT2gender +=1;
                        tcounter +=1;
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        list.T1pos.appenditem(WT1pos);
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
kev_dent - 11/30/2023
Here is the full script, I am working with.
Basically, my goal is to use var type variables to populate a set of lists, these lists then will go on to control stimulus presentation.
Essentially the issue is that I can not get my code to populate my lists at all.
I copied the code from the programmers manual and can't achieve the same in my code.
Is there an example perhaps in the library that shows how to use var type variables to control stimulus presentation?
Thanks 
Kevin
<list rotate>
/items=(0)
/poolsize =14
/ selectionrate = always
</list>

<values>
/scale = 100
</values>



<list T1pos>
/ selectionrate = trial
/ items = ()


</list>

<list rotatet>
/ selectionrate = trial
/ items = ()
/select = list.T1pos.nextindex
</list>

<list emotion>
/ items = ()

/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list saliency>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2lag>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T1gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list maleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<list femaleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<values>
/T2pos = 0
</values>

<item neutralfemale>
/1="WF01/WF01_NO.jpg"
/2="WF02/WF02_NO.jpg"
/3="WF03/WF03_NO.jpg"
/4="WF04/WF04_NO.jpg"
/5="WF05/WF05_NO.jpg"
/6="WF06/WF06_NO.jpg"
/7="WF07/WF07_NO.jpg"
/8="WF08/WF08_NO.jpg"
/9="WF09/WF09_NO.jpg"
/10="WF10/WF10_NO.jpg"
/11="WF11/WF11_NO.jpg"
/12="WF12/WF12_NO.jpg"
/13="WF13/WF13_NO.jpg"
</item>
<item neutralmale>
/1="WM01/WM01_NO.jpg"
/2="WM02/WM02_NO.jpg"
/3="WM03/WM03_NO.jpg"
/4="WM04/WM04_NO.jpg"
/5="WM05/WM05_NO.jpg"
/6="WM06/WM06_NO.jpg"
/7="WM07/WM07_NO.jpg"
/8="WM08/WM08_NO.jpg"
/9="WM09/WM09_NO.jpg"
/10="WM10/WM10_NO.jpg"
/11="WM11/WM11_NO.jpg"
/12="WM12/WM12_NO.jpg"
/13="WM13/WM13_NO.jpg"
</item>
<item neutralfemaleRED>
/1="WF01/WF01_REDs_NO.jpg"
/2="WF02/WF02_REDs_NO.jpg"
/3="WF03/WF03_REDs_NO.jpg"
/4="WF04/WF04_REDs_NO.jpg"
/5="WF05/WF05_REDs_NO.jpg"
/6="WF06/WF06_REDs_NO.jpg"
/7="WF07/WF07_REDs_NO.jpg"
/8="WF08/WF08_REDs_NO.jpg"
/9="WF09/WF09_REDs_NO.jpg"
/10="WF10/WF10_REDs_NO.jpg"
/11="WF11/WF11_REDs_NO.jpg"
/12="WF12/WF12_REDs_NO.jpg"
/13="WF13/WF13_REDs_NO.jpg"
</item>
<item neutralmaleRED>
/1="WM01/WM01_REDs_NO.jpg"
/2="WM02/WM02_REDs_NO.jpg"
/3="WM03/WM03_REDs_NO.jpg"
/4="WM04/WM04_REDs_NO.jpg"
/5="WM05/WM05_REDs_NO.jpg"
/6="WM06/WM06_REDs_NO.jpg"
/7="WM07/WM07_REDs_NO.jpg"
/8="WM08/WM08_REDs_NO.jpg"
/9="WM09/WM09_REDs_NO.jpg"
/10="WM10/WM10_REDs_NO.jpg"
/11="WM11/WM11_REDs_NO.jpg"
/12="WM12/WM12_REDs_NO.jpg"
/13="WM13/WM13_REDs_NO.jpg"
</item>
<item angryfemale>
/1="WF01/WF01_AO.jpg"
/2="WF02/WF02_AO.jpg"
/3="WF03/WF03_AO.jpg"
/4="WF04/WF04_AO.jpg"
/5="WF05/WF05_AO.jpg"
/6="WF06/WF06_AO.jpg"
/7="WF07/WF07_AO.jpg"
/8="WF08/WF08_AO.jpg"
/9="WF09/WF09_AC.jpg"
/10="WF10/WF10_AO.jpg"
/11="WF11/WF11_AO.jpg"
/12="WF12/WF12_AO.jpg"
/13="WF13/WF13_AO.jpg"
</item>

<item angrymale>
/1="WM01/WM01_AO.jpg"
/2="WM02/WM02_AO.jpg"
/3="WM03/WM03_AO.jpg"
/4="WM04/WM04_AO.jpg"
/5="WM05/WM05_AO.jpg"
/6="WM06/WM06_AO.jpg"
/7="WM07/WM07_AO.jpg"
/8="WM08/WM08_AO.jpg"
/9="WM09/WM09_AO.jpg"
/10="WM10/WM10_AO.jpg"
/11="WM11/WM11_AO.jpg"
/12="WM12/WM12_AO.jpg"
/13="WM13/WM13_AO.jpg"
</item>

<item fearfemale>
/1="WF01/WF01_FO.jpg"
/2="WF02/WF02_FO.jpg"
/3="WF03/WF03_FO.jpg"
/4="WF04/WF04_FO.jpg"
/5="WF05/WF05_FO.jpg"
/6="WF06/WF06_FO.jpg"
/7="WF07/WF07_FO.jpg"
/8="WF08/WF08_FO.jpg"
/9="WF09/WF09_FO.jpg"
/10="WF10/WF10_FO.jpg"
/11="WF11/WF11_FO.jpg"
/12="WF12/WF12_FO.jpg"
/13="WF13/WF13_FO.jpg"
</item>
<item fearmale>
/1="WM01/WM01_FO.jpg"
/2="WM02/WM02_FO.jpg"
/3="WM03/WM03_FO.jpg"
/4="WM04/WM04_FO.jpg"
/5="WM05/WM05_FO.jpg"
/6="WM06/WM06_FO.jpg"
/7="WM07/WM07_FO.jpg"
/8="WM08/WM08_FO.jpg"
/9="WM09/WM09_FO.jpg"
/10="WM10/WM10_FO.jpg"
/11="WM11/WM11_FO.jpg"
/12="WM12/WM12_FO.jpg"
/13="WM13/WM13_FO.jpg"
</item>

<item angryfemaleRED>
/1="WF01/WF01_REDs_AO.jpg"
/2="WF02/WF02_REDs_AO.jpg"
/3="WF03/WF03_REDs_AO.jpg"
/4="WF04/WF04_REDs_AO.jpg"
/5="WF05/WF05_REDs_AO.jpg"
/6="WF06/WF06_REDs_AO.jpg"
/7="WF07/WF07_REDs_AO.jpg"
/8="WF08/WF08_REDs_AO.jpg"
/9="WF09/WF09_REDs_AC.jpg"
/10="WF10/WF10_REDs_AO.jpg"
/11="WF11/WF11_REDs_AO.jpg"
/12="WF12/WF12_RED_AO.jpg"
/13="WF13/WF13_RED_AO.jpg"
</item>

<item angrymaleRED>
/1="WM01/WM01_REDs_AO.jpg"
/2="WM02/WM02_REDs_AO.jpg"
/3="WM03/WM03_REDs_AO.jpg"
/4="WM04/WM04_REDs_AO.jpg"
/5="WM05/WM05_REDs_AO.jpg"
/6="WM06/WM06_REDs_AO.jpg"
/7="WM07/WM07_REDs_AO.jpg"
/8="WM08/WM08_REDs_AO.jpg"
/9="WM09/WM09_REDs_AO.jpg"
/10="WM10/WM10_REDs_AO.jpg"
/11="WM11/WM11_REDs_AO.jpg"
/12="WM12/WM12_REDs_AO.jpg"
/13="WM13/WM13_REDs_AO.jpg"
</item>

<item fearfemaleRED>
/1="WF01/WF01_REDs_FO.jpg"
/2="WF02/WF02_REDs_FO.jpg"
/3="WF03/WF03_REDs_FO.jpg"
/4="WF04/WF04_REDs_FO.jpg"
/5="WF05/WF05_REDs_FO.jpg"
/6="WF06/WF06_REDs_FO.jpg"
/7="WF07/WF07_REDs_FO.jpg"
/8="WF08/WF08_REDs_FO.jpg"
/9="WF09/WF09_REDs_FO.jpg"
/10="WF10/WF10_REDs_FO.jpg"
/11="WF11/WF11_REDs_FO.jpg"
/12="WF12/WF12_RED_FO.jpg"
/13="WF13/WF13_RED_FO.jpg"
</item>
<item fearmaleRED>
/1="WM01/WM01_REDs_FO.jpg"
/2="WM02/WM02_REDs_FO.jpg"
/3="WM03/WM03_REDs_FO.jpg"
/4="WM04/WM04_REDs_FO.jpg"
/5="WM05/WM05_REDs_FO.jpg"
/6="WM06/WM06_REDs_FO.jpg"
/7="WM07/WM07_REDs_FO.jpg"
/8="WM08/WM08_REDs_FO.jpg"
/9="WM09/WM09_REDs_FO.jpg"
/10="WM10/WM10_REDs_FO.jpg"
/11="WM11/WM11_REDs_FO.jpg"
/12="WM12/WM12_REDs_FO.jpg"
/13="WM13/WM13_REDs_FO.jpg"
</item>

<item scrambledneutral>
/1="Scrm_data_KD/WF01_NO_S.jpg"
/2="Scrm_data_KD/WF02_NO_S.jpg"
/3="Scrm_data_KD/WF03_NO_S.jpg"
/4="Scrm_data_KD/WF04_NO_S.jpg"
/5="Scrm_data_KD/WF05_NO_S.jpg"
/6="Scrm_data_KD/WF06_NO_S.jpg"
/7="Scrm_data_KD/WF07_NO_S.jpg"
/8="Scrm_data_KD/WF08_NO_S.jpg"
/9="Scrm_data_KD/WF09_NO_S.jpg"
/10="Scrm_data_KD/WF10_NO_S.jpg"
/11="Scrm_data_KD/WF11_NO_S.jpg"
/12="Scrm_data_KD/WF12_NO_S.jpg"
/13="Scrm_data_KD/WF13_NO_S.jpg"
/14="Scrm_data_KD/WM01_NO_S.jpg"
/15="Scrm_data_KD/WM02_NO_S.jpg"
/16="Scrm_data_KD/WM03_NO_S.jpg"
/17="Scrm_data_KD/WM04_NO_S.jpg"
/18="Scrm_data_KD/WM05_NO_S.jpg"
/19="Scrm_data_KD/WM06_NO_S.jpg"
/20="Scrm_data_KD/WM07_NO_S.jpg"
/21="Scrm_data_KD/WM08_NO_S.jpg"
/22="Scrm_data_KD/WM09_NO_S.jpg"
/23="Scrm_data_KD/WM10_NO_S.jpg"
/24="Scrm_data_KD/WM11_NO_S.jpg"
/25="Scrm_data_KD/WM12_NO_S.jpg"
/26="Scrm_data_KD/WM13_NO_S.jpg"
</item>
<list scramselect>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26)

/ selectionrate = always
</list>

<picture distractor1>
/ items = scrambledneutral
/ selectionrate = always
/ size= (values.scale-0mm,values.scale-0mm)
/ select = list.scramselect.nextvalue
</picture>

<picture distractor2>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor3>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor4>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor5>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor6>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor7>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor8>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor9>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor10>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor11>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor12>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor13>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angryfemaleRED>
/ items = angryfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angrymaleRED>
/ items = angrymaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemaleRED>
/ items = fearfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture fearmaleRED>
/ items = fearmaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angryfemale>
/ items = angryfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angrymale>
/ items = angrymale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemale>
/ items = fearfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearmale>
/ items = fearmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture neutralmalet>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)
</picture>

<picture neutralfemalet>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)

</picture>

<picture neutralfemale>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture neutralmale>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<shape blank>
/shape =rectangle
/color = (white)
/ size = (100%, 100%)
</shape>


<trial facestream1>
/ontrialbegin =[

list.scramselect.reset();
list.maleselect.reset();
list.femaleselect.reset();
trial.facestream1.clearstimulusframes();
values.T2pos=list.T1pos.nextvalue + list.T2lag.nextvalue;
trial.facestream1.setstimulustime(shape.blank, 100*1);
trial.facestream1.setstimulustime(shape.blank, 200*1);
trial.facestream1.setstimulustime(shape.blank, 300*1);
trial.facestream1.setstimulustime(shape.blank, 400*1);
trial.facestream1.setstimulustime(shape.blank, 500*1);
trial.facestream1.setstimulustime(shape.blank, 600*1);
trial.facestream1.setstimulustime(shape.blank, 700*1);
trial.facestream1.setstimulustime(shape.blank, 800*1);
trial.facestream1.setstimulustime(shape.blank, 900*1);
trial.facestream1.setstimulustime(shape.blank, 1000*1);
trial.facestream1.setstimulustime(shape.blank, 1100*1);
trial.facestream1.setstimulustime(shape.blank, 1200*1);
trial.facestream1.setstimulustime(shape.blank, 1300*1);
trial.facestream1.insertstimulustime(picture.distractor1, 100*1);
trial.facestream1.insertstimulustime(picture.distractor2, 200*1);
trial.facestream1.insertstimulustime(picture.distractor3, 300*1);
trial.facestream1.insertstimulustime(picture.distractor4, 400*1);
trial.facestream1.insertstimulustime(picture.distractor5, 500*1);
trial.facestream1.insertstimulustime(picture.distractor6, 600*1);
trial.facestream1.insertstimulustime(picture.distractor7, 700*1);
trial.facestream1.insertstimulustime(picture.distractor8, 800*1);
trial.facestream1.insertstimulustime(picture.distractor9, 900*1);
trial.facestream1.insertstimulustime(picture.distractor10, 1000*1);
trial.facestream1.insertstimulustime(picture.distractor11, 1100*1);
trial.facestream1.insertstimulustime(picture.distractor12, 1200*1);
trial.facestream1.insertstimulustime(picture.distractor13, 1300*1);
trial.facestream1.insertstimulustime(shape.blank, 1400*1);

trial.facestream1.setstimulustime(shape.blank, values.T2pos);
if (list.T2gender.nextvalue==1)
trial.facestream1.insertstimulustime(picture.neutralfemalet, values.T2pos)
else if (list.T2gender.nextvalue==2)
trial.facestream1.insertstimulustime(picture.neutralmalet, values.T2pos);
trial.facestream1.setstimulustime(shape.blank, list.T1pos.nextvalue);


if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.neutralfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue);

if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.neutralmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue);
]
/stimulustimes =[
]
/ validresponse = (44,49)
/ inputdevice = keyboard
/ iscorrectresponse = [(list.T2gender.nextvalue==2 && trial.facestream1.response == 49)||(list.T2gender.nextvalue==1 && trial.facestream1.response == 44)]

</trial>

<data>
/ columns = (
date,
time,
group,
subject,
trialcode,
blockcode,
blocknum,
trialnum,
latency,
response,
responsetext,
list.T1gender.currentvalue,
list.T2gender.currentvalue,
list.emotion.currentvalue
list.saliency.currentvalue,
list.T1pos.currentvalue,
list.T2lag.currentvalue,
values.T2pos,
list.rotatet.currentvalue,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,

)



</data>




<page instruct>
^^ Look for the tilted face.
^^ If it is female to the left (top on left) press Z
^^ If it is male to the left (top on rigt) press N
</page>

<page break>
^^ Please take a breather...
</page>

<text correcttext>
/items =("Correct")
/ txcolor = green
</text>

<text errortext>
/items =("Wrong")
/ txcolor = red
</text>

<trial break>
/ timeout = 0
</trial>

<block break>
/preinstructions = (break)
/trials=[1=break]
</block>


<block main>
/preinstructions = (instruct)
/trials=[1-96=noreplace(facestream1)]
</block>

<expt main>
/ onexptbegin = [
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
    
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
    
    var tcounter =0;
    
    while (CT1pos <2);
    {
    WT1pos =     100*(CT1pos +3);
    CT1pos +=1;
    
    while (Crotatet <2);
    {
    Wrotatet =     30*(Crotatet -0.5);
    Crotatet +=1;
    
        while (Cemotion<3);
        {
        Wemotion =     (Cemotion +1);
        Cemotion +=1;
    
            while (Csaliency<2);
            {
            Wsaliency =     (Csaliency +1);
            Csaliency +=1;
            
                while (CT2lag<2);
                {
                WT2lag =     (CT2lag*500)+200;
                CT2lag +=1;
                
                    while (CT1gender<2);
                    {
                    WT1gender =     (CT1gender +1);
                    CT1gender +=1;
                    {
                        while (CT2gender<2);
                        
                        WT2gender =     (CT2gender +1);
                        CT2gender +=1;
                        tcounter +=1;
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        list.T1pos.appenditem(WT1pos);
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>

Again, please comment your code. Specifically, the while() loops, since that is what you want help with
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Dave - 11/30/2023
kev_dent - 11/30/2023
Here is the full script, I am working with.
Basically, my goal is to use var type variables to populate a set of lists, these lists then will go on to control stimulus presentation.
Essentially the issue is that I can not get my code to populate my lists at all.
I copied the code from the programmers manual and can't achieve the same in my code.
Is there an example perhaps in the library that shows how to use var type variables to control stimulus presentation?
Thanks 
Kevin
<list rotate>
/items=(0)
/poolsize =14
/ selectionrate = always
</list>

<values>
/scale = 100
</values>



<list T1pos>
/ selectionrate = trial
/ items = ()


</list>

<list rotatet>
/ selectionrate = trial
/ items = ()
/select = list.T1pos.nextindex
</list>

<list emotion>
/ items = ()

/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list saliency>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2lag>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T1gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list maleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<list femaleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<values>
/T2pos = 0
</values>

<item neutralfemale>
/1="WF01/WF01_NO.jpg"
/2="WF02/WF02_NO.jpg"
/3="WF03/WF03_NO.jpg"
/4="WF04/WF04_NO.jpg"
/5="WF05/WF05_NO.jpg"
/6="WF06/WF06_NO.jpg"
/7="WF07/WF07_NO.jpg"
/8="WF08/WF08_NO.jpg"
/9="WF09/WF09_NO.jpg"
/10="WF10/WF10_NO.jpg"
/11="WF11/WF11_NO.jpg"
/12="WF12/WF12_NO.jpg"
/13="WF13/WF13_NO.jpg"
</item>
<item neutralmale>
/1="WM01/WM01_NO.jpg"
/2="WM02/WM02_NO.jpg"
/3="WM03/WM03_NO.jpg"
/4="WM04/WM04_NO.jpg"
/5="WM05/WM05_NO.jpg"
/6="WM06/WM06_NO.jpg"
/7="WM07/WM07_NO.jpg"
/8="WM08/WM08_NO.jpg"
/9="WM09/WM09_NO.jpg"
/10="WM10/WM10_NO.jpg"
/11="WM11/WM11_NO.jpg"
/12="WM12/WM12_NO.jpg"
/13="WM13/WM13_NO.jpg"
</item>
<item neutralfemaleRED>
/1="WF01/WF01_REDs_NO.jpg"
/2="WF02/WF02_REDs_NO.jpg"
/3="WF03/WF03_REDs_NO.jpg"
/4="WF04/WF04_REDs_NO.jpg"
/5="WF05/WF05_REDs_NO.jpg"
/6="WF06/WF06_REDs_NO.jpg"
/7="WF07/WF07_REDs_NO.jpg"
/8="WF08/WF08_REDs_NO.jpg"
/9="WF09/WF09_REDs_NO.jpg"
/10="WF10/WF10_REDs_NO.jpg"
/11="WF11/WF11_REDs_NO.jpg"
/12="WF12/WF12_REDs_NO.jpg"
/13="WF13/WF13_REDs_NO.jpg"
</item>
<item neutralmaleRED>
/1="WM01/WM01_REDs_NO.jpg"
/2="WM02/WM02_REDs_NO.jpg"
/3="WM03/WM03_REDs_NO.jpg"
/4="WM04/WM04_REDs_NO.jpg"
/5="WM05/WM05_REDs_NO.jpg"
/6="WM06/WM06_REDs_NO.jpg"
/7="WM07/WM07_REDs_NO.jpg"
/8="WM08/WM08_REDs_NO.jpg"
/9="WM09/WM09_REDs_NO.jpg"
/10="WM10/WM10_REDs_NO.jpg"
/11="WM11/WM11_REDs_NO.jpg"
/12="WM12/WM12_REDs_NO.jpg"
/13="WM13/WM13_REDs_NO.jpg"
</item>
<item angryfemale>
/1="WF01/WF01_AO.jpg"
/2="WF02/WF02_AO.jpg"
/3="WF03/WF03_AO.jpg"
/4="WF04/WF04_AO.jpg"
/5="WF05/WF05_AO.jpg"
/6="WF06/WF06_AO.jpg"
/7="WF07/WF07_AO.jpg"
/8="WF08/WF08_AO.jpg"
/9="WF09/WF09_AC.jpg"
/10="WF10/WF10_AO.jpg"
/11="WF11/WF11_AO.jpg"
/12="WF12/WF12_AO.jpg"
/13="WF13/WF13_AO.jpg"
</item>

<item angrymale>
/1="WM01/WM01_AO.jpg"
/2="WM02/WM02_AO.jpg"
/3="WM03/WM03_AO.jpg"
/4="WM04/WM04_AO.jpg"
/5="WM05/WM05_AO.jpg"
/6="WM06/WM06_AO.jpg"
/7="WM07/WM07_AO.jpg"
/8="WM08/WM08_AO.jpg"
/9="WM09/WM09_AO.jpg"
/10="WM10/WM10_AO.jpg"
/11="WM11/WM11_AO.jpg"
/12="WM12/WM12_AO.jpg"
/13="WM13/WM13_AO.jpg"
</item>

<item fearfemale>
/1="WF01/WF01_FO.jpg"
/2="WF02/WF02_FO.jpg"
/3="WF03/WF03_FO.jpg"
/4="WF04/WF04_FO.jpg"
/5="WF05/WF05_FO.jpg"
/6="WF06/WF06_FO.jpg"
/7="WF07/WF07_FO.jpg"
/8="WF08/WF08_FO.jpg"
/9="WF09/WF09_FO.jpg"
/10="WF10/WF10_FO.jpg"
/11="WF11/WF11_FO.jpg"
/12="WF12/WF12_FO.jpg"
/13="WF13/WF13_FO.jpg"
</item>
<item fearmale>
/1="WM01/WM01_FO.jpg"
/2="WM02/WM02_FO.jpg"
/3="WM03/WM03_FO.jpg"
/4="WM04/WM04_FO.jpg"
/5="WM05/WM05_FO.jpg"
/6="WM06/WM06_FO.jpg"
/7="WM07/WM07_FO.jpg"
/8="WM08/WM08_FO.jpg"
/9="WM09/WM09_FO.jpg"
/10="WM10/WM10_FO.jpg"
/11="WM11/WM11_FO.jpg"
/12="WM12/WM12_FO.jpg"
/13="WM13/WM13_FO.jpg"
</item>

<item angryfemaleRED>
/1="WF01/WF01_REDs_AO.jpg"
/2="WF02/WF02_REDs_AO.jpg"
/3="WF03/WF03_REDs_AO.jpg"
/4="WF04/WF04_REDs_AO.jpg"
/5="WF05/WF05_REDs_AO.jpg"
/6="WF06/WF06_REDs_AO.jpg"
/7="WF07/WF07_REDs_AO.jpg"
/8="WF08/WF08_REDs_AO.jpg"
/9="WF09/WF09_REDs_AC.jpg"
/10="WF10/WF10_REDs_AO.jpg"
/11="WF11/WF11_REDs_AO.jpg"
/12="WF12/WF12_RED_AO.jpg"
/13="WF13/WF13_RED_AO.jpg"
</item>

<item angrymaleRED>
/1="WM01/WM01_REDs_AO.jpg"
/2="WM02/WM02_REDs_AO.jpg"
/3="WM03/WM03_REDs_AO.jpg"
/4="WM04/WM04_REDs_AO.jpg"
/5="WM05/WM05_REDs_AO.jpg"
/6="WM06/WM06_REDs_AO.jpg"
/7="WM07/WM07_REDs_AO.jpg"
/8="WM08/WM08_REDs_AO.jpg"
/9="WM09/WM09_REDs_AO.jpg"
/10="WM10/WM10_REDs_AO.jpg"
/11="WM11/WM11_REDs_AO.jpg"
/12="WM12/WM12_REDs_AO.jpg"
/13="WM13/WM13_REDs_AO.jpg"
</item>

<item fearfemaleRED>
/1="WF01/WF01_REDs_FO.jpg"
/2="WF02/WF02_REDs_FO.jpg"
/3="WF03/WF03_REDs_FO.jpg"
/4="WF04/WF04_REDs_FO.jpg"
/5="WF05/WF05_REDs_FO.jpg"
/6="WF06/WF06_REDs_FO.jpg"
/7="WF07/WF07_REDs_FO.jpg"
/8="WF08/WF08_REDs_FO.jpg"
/9="WF09/WF09_REDs_FO.jpg"
/10="WF10/WF10_REDs_FO.jpg"
/11="WF11/WF11_REDs_FO.jpg"
/12="WF12/WF12_RED_FO.jpg"
/13="WF13/WF13_RED_FO.jpg"
</item>
<item fearmaleRED>
/1="WM01/WM01_REDs_FO.jpg"
/2="WM02/WM02_REDs_FO.jpg"
/3="WM03/WM03_REDs_FO.jpg"
/4="WM04/WM04_REDs_FO.jpg"
/5="WM05/WM05_REDs_FO.jpg"
/6="WM06/WM06_REDs_FO.jpg"
/7="WM07/WM07_REDs_FO.jpg"
/8="WM08/WM08_REDs_FO.jpg"
/9="WM09/WM09_REDs_FO.jpg"
/10="WM10/WM10_REDs_FO.jpg"
/11="WM11/WM11_REDs_FO.jpg"
/12="WM12/WM12_REDs_FO.jpg"
/13="WM13/WM13_REDs_FO.jpg"
</item>

<item scrambledneutral>
/1="Scrm_data_KD/WF01_NO_S.jpg"
/2="Scrm_data_KD/WF02_NO_S.jpg"
/3="Scrm_data_KD/WF03_NO_S.jpg"
/4="Scrm_data_KD/WF04_NO_S.jpg"
/5="Scrm_data_KD/WF05_NO_S.jpg"
/6="Scrm_data_KD/WF06_NO_S.jpg"
/7="Scrm_data_KD/WF07_NO_S.jpg"
/8="Scrm_data_KD/WF08_NO_S.jpg"
/9="Scrm_data_KD/WF09_NO_S.jpg"
/10="Scrm_data_KD/WF10_NO_S.jpg"
/11="Scrm_data_KD/WF11_NO_S.jpg"
/12="Scrm_data_KD/WF12_NO_S.jpg"
/13="Scrm_data_KD/WF13_NO_S.jpg"
/14="Scrm_data_KD/WM01_NO_S.jpg"
/15="Scrm_data_KD/WM02_NO_S.jpg"
/16="Scrm_data_KD/WM03_NO_S.jpg"
/17="Scrm_data_KD/WM04_NO_S.jpg"
/18="Scrm_data_KD/WM05_NO_S.jpg"
/19="Scrm_data_KD/WM06_NO_S.jpg"
/20="Scrm_data_KD/WM07_NO_S.jpg"
/21="Scrm_data_KD/WM08_NO_S.jpg"
/22="Scrm_data_KD/WM09_NO_S.jpg"
/23="Scrm_data_KD/WM10_NO_S.jpg"
/24="Scrm_data_KD/WM11_NO_S.jpg"
/25="Scrm_data_KD/WM12_NO_S.jpg"
/26="Scrm_data_KD/WM13_NO_S.jpg"
</item>
<list scramselect>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26)

/ selectionrate = always
</list>

<picture distractor1>
/ items = scrambledneutral
/ selectionrate = always
/ size= (values.scale-0mm,values.scale-0mm)
/ select = list.scramselect.nextvalue
</picture>

<picture distractor2>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor3>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor4>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor5>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor6>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor7>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor8>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor9>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor10>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor11>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor12>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor13>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angryfemaleRED>
/ items = angryfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angrymaleRED>
/ items = angrymaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemaleRED>
/ items = fearfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture fearmaleRED>
/ items = fearmaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angryfemale>
/ items = angryfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angrymale>
/ items = angrymale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemale>
/ items = fearfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearmale>
/ items = fearmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture neutralmalet>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)
</picture>

<picture neutralfemalet>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)

</picture>

<picture neutralfemale>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture neutralmale>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<shape blank>
/shape =rectangle
/color = (white)
/ size = (100%, 100%)
</shape>


<trial facestream1>
/ontrialbegin =[

list.scramselect.reset();
list.maleselect.reset();
list.femaleselect.reset();
trial.facestream1.clearstimulusframes();
values.T2pos=list.T1pos.nextvalue + list.T2lag.nextvalue;
trial.facestream1.setstimulustime(shape.blank, 100*1);
trial.facestream1.setstimulustime(shape.blank, 200*1);
trial.facestream1.setstimulustime(shape.blank, 300*1);
trial.facestream1.setstimulustime(shape.blank, 400*1);
trial.facestream1.setstimulustime(shape.blank, 500*1);
trial.facestream1.setstimulustime(shape.blank, 600*1);
trial.facestream1.setstimulustime(shape.blank, 700*1);
trial.facestream1.setstimulustime(shape.blank, 800*1);
trial.facestream1.setstimulustime(shape.blank, 900*1);
trial.facestream1.setstimulustime(shape.blank, 1000*1);
trial.facestream1.setstimulustime(shape.blank, 1100*1);
trial.facestream1.setstimulustime(shape.blank, 1200*1);
trial.facestream1.setstimulustime(shape.blank, 1300*1);
trial.facestream1.insertstimulustime(picture.distractor1, 100*1);
trial.facestream1.insertstimulustime(picture.distractor2, 200*1);
trial.facestream1.insertstimulustime(picture.distractor3, 300*1);
trial.facestream1.insertstimulustime(picture.distractor4, 400*1);
trial.facestream1.insertstimulustime(picture.distractor5, 500*1);
trial.facestream1.insertstimulustime(picture.distractor6, 600*1);
trial.facestream1.insertstimulustime(picture.distractor7, 700*1);
trial.facestream1.insertstimulustime(picture.distractor8, 800*1);
trial.facestream1.insertstimulustime(picture.distractor9, 900*1);
trial.facestream1.insertstimulustime(picture.distractor10, 1000*1);
trial.facestream1.insertstimulustime(picture.distractor11, 1100*1);
trial.facestream1.insertstimulustime(picture.distractor12, 1200*1);
trial.facestream1.insertstimulustime(picture.distractor13, 1300*1);
trial.facestream1.insertstimulustime(shape.blank, 1400*1);

trial.facestream1.setstimulustime(shape.blank, values.T2pos);
if (list.T2gender.nextvalue==1)
trial.facestream1.insertstimulustime(picture.neutralfemalet, values.T2pos)
else if (list.T2gender.nextvalue==2)
trial.facestream1.insertstimulustime(picture.neutralmalet, values.T2pos);
trial.facestream1.setstimulustime(shape.blank, list.T1pos.nextvalue);


if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.neutralfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue);

if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.neutralmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue);
]
/stimulustimes =[
]
/ validresponse = (44,49)
/ inputdevice = keyboard
/ iscorrectresponse = [(list.T2gender.nextvalue==2 && trial.facestream1.response == 49)||(list.T2gender.nextvalue==1 && trial.facestream1.response == 44)]

</trial>

<data>
/ columns = (
date,
time,
group,
subject,
trialcode,
blockcode,
blocknum,
trialnum,
latency,
response,
responsetext,
list.T1gender.currentvalue,
list.T2gender.currentvalue,
list.emotion.currentvalue
list.saliency.currentvalue,
list.T1pos.currentvalue,
list.T2lag.currentvalue,
values.T2pos,
list.rotatet.currentvalue,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,

)



</data>




<page instruct>
^^ Look for the tilted face.
^^ If it is female to the left (top on left) press Z
^^ If it is male to the left (top on rigt) press N
</page>

<page break>
^^ Please take a breather...
</page>

<text correcttext>
/items =("Correct")
/ txcolor = green
</text>

<text errortext>
/items =("Wrong")
/ txcolor = red
</text>

<trial break>
/ timeout = 0
</trial>

<block break>
/preinstructions = (break)
/trials=[1=break]
</block>


<block main>
/preinstructions = (instruct)
/trials=[1-96=noreplace(facestream1)]
</block>

<expt main>
/ onexptbegin = [
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
    
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
    
    var tcounter =0;
    
    while (CT1pos <2);
    {
    WT1pos =     100*(CT1pos +3);
    CT1pos +=1;
    
    while (Crotatet <2);
    {
    Wrotatet =     30*(Crotatet -0.5);
    Crotatet +=1;
    
        while (Cemotion<3);
        {
        Wemotion =     (Cemotion +1);
        Cemotion +=1;
    
            while (Csaliency<2);
            {
            Wsaliency =     (Csaliency +1);
            Csaliency +=1;
            
                while (CT2lag<2);
                {
                WT2lag =     (CT2lag*500)+200;
                CT2lag +=1;
                
                    while (CT1gender<2);
                    {
                    WT1gender =     (CT1gender +1);
                    CT1gender +=1;
                    {
                        while (CT2gender<2);
                        
                        WT2gender =     (CT2gender +1);
                        CT2gender +=1;
                        tcounter +=1;
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        list.T1pos.appenditem(WT1pos);
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>

Again, please comment your code. Specifically, the while() loops, since that is what you want help with

Syntax-wise, the whole thing is pretty broken. For example, you have a statement terminater after each while condition

while (CT1pos <2);


No ; belongs there.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Dave - 11/30/2023
Dave - 11/30/2023
kev_dent - 11/30/2023
Here is the full script, I am working with.
Basically, my goal is to use var type variables to populate a set of lists, these lists then will go on to control stimulus presentation.
Essentially the issue is that I can not get my code to populate my lists at all.
I copied the code from the programmers manual and can't achieve the same in my code.
Is there an example perhaps in the library that shows how to use var type variables to control stimulus presentation?
Thanks 
Kevin
<list rotate>
/items=(0)
/poolsize =14
/ selectionrate = always
</list>

<values>
/scale = 100
</values>



<list T1pos>
/ selectionrate = trial
/ items = ()


</list>

<list rotatet>
/ selectionrate = trial
/ items = ()
/select = list.T1pos.nextindex
</list>

<list emotion>
/ items = ()

/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list saliency>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2lag>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T1gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list maleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<list femaleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<values>
/T2pos = 0
</values>

<item neutralfemale>
/1="WF01/WF01_NO.jpg"
/2="WF02/WF02_NO.jpg"
/3="WF03/WF03_NO.jpg"
/4="WF04/WF04_NO.jpg"
/5="WF05/WF05_NO.jpg"
/6="WF06/WF06_NO.jpg"
/7="WF07/WF07_NO.jpg"
/8="WF08/WF08_NO.jpg"
/9="WF09/WF09_NO.jpg"
/10="WF10/WF10_NO.jpg"
/11="WF11/WF11_NO.jpg"
/12="WF12/WF12_NO.jpg"
/13="WF13/WF13_NO.jpg"
</item>
<item neutralmale>
/1="WM01/WM01_NO.jpg"
/2="WM02/WM02_NO.jpg"
/3="WM03/WM03_NO.jpg"
/4="WM04/WM04_NO.jpg"
/5="WM05/WM05_NO.jpg"
/6="WM06/WM06_NO.jpg"
/7="WM07/WM07_NO.jpg"
/8="WM08/WM08_NO.jpg"
/9="WM09/WM09_NO.jpg"
/10="WM10/WM10_NO.jpg"
/11="WM11/WM11_NO.jpg"
/12="WM12/WM12_NO.jpg"
/13="WM13/WM13_NO.jpg"
</item>
<item neutralfemaleRED>
/1="WF01/WF01_REDs_NO.jpg"
/2="WF02/WF02_REDs_NO.jpg"
/3="WF03/WF03_REDs_NO.jpg"
/4="WF04/WF04_REDs_NO.jpg"
/5="WF05/WF05_REDs_NO.jpg"
/6="WF06/WF06_REDs_NO.jpg"
/7="WF07/WF07_REDs_NO.jpg"
/8="WF08/WF08_REDs_NO.jpg"
/9="WF09/WF09_REDs_NO.jpg"
/10="WF10/WF10_REDs_NO.jpg"
/11="WF11/WF11_REDs_NO.jpg"
/12="WF12/WF12_REDs_NO.jpg"
/13="WF13/WF13_REDs_NO.jpg"
</item>
<item neutralmaleRED>
/1="WM01/WM01_REDs_NO.jpg"
/2="WM02/WM02_REDs_NO.jpg"
/3="WM03/WM03_REDs_NO.jpg"
/4="WM04/WM04_REDs_NO.jpg"
/5="WM05/WM05_REDs_NO.jpg"
/6="WM06/WM06_REDs_NO.jpg"
/7="WM07/WM07_REDs_NO.jpg"
/8="WM08/WM08_REDs_NO.jpg"
/9="WM09/WM09_REDs_NO.jpg"
/10="WM10/WM10_REDs_NO.jpg"
/11="WM11/WM11_REDs_NO.jpg"
/12="WM12/WM12_REDs_NO.jpg"
/13="WM13/WM13_REDs_NO.jpg"
</item>
<item angryfemale>
/1="WF01/WF01_AO.jpg"
/2="WF02/WF02_AO.jpg"
/3="WF03/WF03_AO.jpg"
/4="WF04/WF04_AO.jpg"
/5="WF05/WF05_AO.jpg"
/6="WF06/WF06_AO.jpg"
/7="WF07/WF07_AO.jpg"
/8="WF08/WF08_AO.jpg"
/9="WF09/WF09_AC.jpg"
/10="WF10/WF10_AO.jpg"
/11="WF11/WF11_AO.jpg"
/12="WF12/WF12_AO.jpg"
/13="WF13/WF13_AO.jpg"
</item>

<item angrymale>
/1="WM01/WM01_AO.jpg"
/2="WM02/WM02_AO.jpg"
/3="WM03/WM03_AO.jpg"
/4="WM04/WM04_AO.jpg"
/5="WM05/WM05_AO.jpg"
/6="WM06/WM06_AO.jpg"
/7="WM07/WM07_AO.jpg"
/8="WM08/WM08_AO.jpg"
/9="WM09/WM09_AO.jpg"
/10="WM10/WM10_AO.jpg"
/11="WM11/WM11_AO.jpg"
/12="WM12/WM12_AO.jpg"
/13="WM13/WM13_AO.jpg"
</item>

<item fearfemale>
/1="WF01/WF01_FO.jpg"
/2="WF02/WF02_FO.jpg"
/3="WF03/WF03_FO.jpg"
/4="WF04/WF04_FO.jpg"
/5="WF05/WF05_FO.jpg"
/6="WF06/WF06_FO.jpg"
/7="WF07/WF07_FO.jpg"
/8="WF08/WF08_FO.jpg"
/9="WF09/WF09_FO.jpg"
/10="WF10/WF10_FO.jpg"
/11="WF11/WF11_FO.jpg"
/12="WF12/WF12_FO.jpg"
/13="WF13/WF13_FO.jpg"
</item>
<item fearmale>
/1="WM01/WM01_FO.jpg"
/2="WM02/WM02_FO.jpg"
/3="WM03/WM03_FO.jpg"
/4="WM04/WM04_FO.jpg"
/5="WM05/WM05_FO.jpg"
/6="WM06/WM06_FO.jpg"
/7="WM07/WM07_FO.jpg"
/8="WM08/WM08_FO.jpg"
/9="WM09/WM09_FO.jpg"
/10="WM10/WM10_FO.jpg"
/11="WM11/WM11_FO.jpg"
/12="WM12/WM12_FO.jpg"
/13="WM13/WM13_FO.jpg"
</item>

<item angryfemaleRED>
/1="WF01/WF01_REDs_AO.jpg"
/2="WF02/WF02_REDs_AO.jpg"
/3="WF03/WF03_REDs_AO.jpg"
/4="WF04/WF04_REDs_AO.jpg"
/5="WF05/WF05_REDs_AO.jpg"
/6="WF06/WF06_REDs_AO.jpg"
/7="WF07/WF07_REDs_AO.jpg"
/8="WF08/WF08_REDs_AO.jpg"
/9="WF09/WF09_REDs_AC.jpg"
/10="WF10/WF10_REDs_AO.jpg"
/11="WF11/WF11_REDs_AO.jpg"
/12="WF12/WF12_RED_AO.jpg"
/13="WF13/WF13_RED_AO.jpg"
</item>

<item angrymaleRED>
/1="WM01/WM01_REDs_AO.jpg"
/2="WM02/WM02_REDs_AO.jpg"
/3="WM03/WM03_REDs_AO.jpg"
/4="WM04/WM04_REDs_AO.jpg"
/5="WM05/WM05_REDs_AO.jpg"
/6="WM06/WM06_REDs_AO.jpg"
/7="WM07/WM07_REDs_AO.jpg"
/8="WM08/WM08_REDs_AO.jpg"
/9="WM09/WM09_REDs_AO.jpg"
/10="WM10/WM10_REDs_AO.jpg"
/11="WM11/WM11_REDs_AO.jpg"
/12="WM12/WM12_REDs_AO.jpg"
/13="WM13/WM13_REDs_AO.jpg"
</item>

<item fearfemaleRED>
/1="WF01/WF01_REDs_FO.jpg"
/2="WF02/WF02_REDs_FO.jpg"
/3="WF03/WF03_REDs_FO.jpg"
/4="WF04/WF04_REDs_FO.jpg"
/5="WF05/WF05_REDs_FO.jpg"
/6="WF06/WF06_REDs_FO.jpg"
/7="WF07/WF07_REDs_FO.jpg"
/8="WF08/WF08_REDs_FO.jpg"
/9="WF09/WF09_REDs_FO.jpg"
/10="WF10/WF10_REDs_FO.jpg"
/11="WF11/WF11_REDs_FO.jpg"
/12="WF12/WF12_RED_FO.jpg"
/13="WF13/WF13_RED_FO.jpg"
</item>
<item fearmaleRED>
/1="WM01/WM01_REDs_FO.jpg"
/2="WM02/WM02_REDs_FO.jpg"
/3="WM03/WM03_REDs_FO.jpg"
/4="WM04/WM04_REDs_FO.jpg"
/5="WM05/WM05_REDs_FO.jpg"
/6="WM06/WM06_REDs_FO.jpg"
/7="WM07/WM07_REDs_FO.jpg"
/8="WM08/WM08_REDs_FO.jpg"
/9="WM09/WM09_REDs_FO.jpg"
/10="WM10/WM10_REDs_FO.jpg"
/11="WM11/WM11_REDs_FO.jpg"
/12="WM12/WM12_REDs_FO.jpg"
/13="WM13/WM13_REDs_FO.jpg"
</item>

<item scrambledneutral>
/1="Scrm_data_KD/WF01_NO_S.jpg"
/2="Scrm_data_KD/WF02_NO_S.jpg"
/3="Scrm_data_KD/WF03_NO_S.jpg"
/4="Scrm_data_KD/WF04_NO_S.jpg"
/5="Scrm_data_KD/WF05_NO_S.jpg"
/6="Scrm_data_KD/WF06_NO_S.jpg"
/7="Scrm_data_KD/WF07_NO_S.jpg"
/8="Scrm_data_KD/WF08_NO_S.jpg"
/9="Scrm_data_KD/WF09_NO_S.jpg"
/10="Scrm_data_KD/WF10_NO_S.jpg"
/11="Scrm_data_KD/WF11_NO_S.jpg"
/12="Scrm_data_KD/WF12_NO_S.jpg"
/13="Scrm_data_KD/WF13_NO_S.jpg"
/14="Scrm_data_KD/WM01_NO_S.jpg"
/15="Scrm_data_KD/WM02_NO_S.jpg"
/16="Scrm_data_KD/WM03_NO_S.jpg"
/17="Scrm_data_KD/WM04_NO_S.jpg"
/18="Scrm_data_KD/WM05_NO_S.jpg"
/19="Scrm_data_KD/WM06_NO_S.jpg"
/20="Scrm_data_KD/WM07_NO_S.jpg"
/21="Scrm_data_KD/WM08_NO_S.jpg"
/22="Scrm_data_KD/WM09_NO_S.jpg"
/23="Scrm_data_KD/WM10_NO_S.jpg"
/24="Scrm_data_KD/WM11_NO_S.jpg"
/25="Scrm_data_KD/WM12_NO_S.jpg"
/26="Scrm_data_KD/WM13_NO_S.jpg"
</item>
<list scramselect>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26)

/ selectionrate = always
</list>

<picture distractor1>
/ items = scrambledneutral
/ selectionrate = always
/ size= (values.scale-0mm,values.scale-0mm)
/ select = list.scramselect.nextvalue
</picture>

<picture distractor2>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor3>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor4>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor5>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor6>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor7>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor8>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor9>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor10>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor11>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor12>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor13>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angryfemaleRED>
/ items = angryfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angrymaleRED>
/ items = angrymaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemaleRED>
/ items = fearfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture fearmaleRED>
/ items = fearmaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angryfemale>
/ items = angryfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angrymale>
/ items = angrymale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemale>
/ items = fearfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearmale>
/ items = fearmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture neutralmalet>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)
</picture>

<picture neutralfemalet>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)

</picture>

<picture neutralfemale>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture neutralmale>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<shape blank>
/shape =rectangle
/color = (white)
/ size = (100%, 100%)
</shape>


<trial facestream1>
/ontrialbegin =[

list.scramselect.reset();
list.maleselect.reset();
list.femaleselect.reset();
trial.facestream1.clearstimulusframes();
values.T2pos=list.T1pos.nextvalue + list.T2lag.nextvalue;
trial.facestream1.setstimulustime(shape.blank, 100*1);
trial.facestream1.setstimulustime(shape.blank, 200*1);
trial.facestream1.setstimulustime(shape.blank, 300*1);
trial.facestream1.setstimulustime(shape.blank, 400*1);
trial.facestream1.setstimulustime(shape.blank, 500*1);
trial.facestream1.setstimulustime(shape.blank, 600*1);
trial.facestream1.setstimulustime(shape.blank, 700*1);
trial.facestream1.setstimulustime(shape.blank, 800*1);
trial.facestream1.setstimulustime(shape.blank, 900*1);
trial.facestream1.setstimulustime(shape.blank, 1000*1);
trial.facestream1.setstimulustime(shape.blank, 1100*1);
trial.facestream1.setstimulustime(shape.blank, 1200*1);
trial.facestream1.setstimulustime(shape.blank, 1300*1);
trial.facestream1.insertstimulustime(picture.distractor1, 100*1);
trial.facestream1.insertstimulustime(picture.distractor2, 200*1);
trial.facestream1.insertstimulustime(picture.distractor3, 300*1);
trial.facestream1.insertstimulustime(picture.distractor4, 400*1);
trial.facestream1.insertstimulustime(picture.distractor5, 500*1);
trial.facestream1.insertstimulustime(picture.distractor6, 600*1);
trial.facestream1.insertstimulustime(picture.distractor7, 700*1);
trial.facestream1.insertstimulustime(picture.distractor8, 800*1);
trial.facestream1.insertstimulustime(picture.distractor9, 900*1);
trial.facestream1.insertstimulustime(picture.distractor10, 1000*1);
trial.facestream1.insertstimulustime(picture.distractor11, 1100*1);
trial.facestream1.insertstimulustime(picture.distractor12, 1200*1);
trial.facestream1.insertstimulustime(picture.distractor13, 1300*1);
trial.facestream1.insertstimulustime(shape.blank, 1400*1);

trial.facestream1.setstimulustime(shape.blank, values.T2pos);
if (list.T2gender.nextvalue==1)
trial.facestream1.insertstimulustime(picture.neutralfemalet, values.T2pos)
else if (list.T2gender.nextvalue==2)
trial.facestream1.insertstimulustime(picture.neutralmalet, values.T2pos);
trial.facestream1.setstimulustime(shape.blank, list.T1pos.nextvalue);


if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.neutralfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue);

if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.neutralmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue);
]
/stimulustimes =[
]
/ validresponse = (44,49)
/ inputdevice = keyboard
/ iscorrectresponse = [(list.T2gender.nextvalue==2 && trial.facestream1.response == 49)||(list.T2gender.nextvalue==1 && trial.facestream1.response == 44)]

</trial>

<data>
/ columns = (
date,
time,
group,
subject,
trialcode,
blockcode,
blocknum,
trialnum,
latency,
response,
responsetext,
list.T1gender.currentvalue,
list.T2gender.currentvalue,
list.emotion.currentvalue
list.saliency.currentvalue,
list.T1pos.currentvalue,
list.T2lag.currentvalue,
values.T2pos,
list.rotatet.currentvalue,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,

)



</data>




<page instruct>
^^ Look for the tilted face.
^^ If it is female to the left (top on left) press Z
^^ If it is male to the left (top on rigt) press N
</page>

<page break>
^^ Please take a breather...
</page>

<text correcttext>
/items =("Correct")
/ txcolor = green
</text>

<text errortext>
/items =("Wrong")
/ txcolor = red
</text>

<trial break>
/ timeout = 0
</trial>

<block break>
/preinstructions = (break)
/trials=[1=break]
</block>


<block main>
/preinstructions = (instruct)
/trials=[1-96=noreplace(facestream1)]
</block>

<expt main>
/ onexptbegin = [
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
    
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
    
    var tcounter =0;
    
    while (CT1pos <2);
    {
    WT1pos =     100*(CT1pos +3);
    CT1pos +=1;
    
    while (Crotatet <2);
    {
    Wrotatet =     30*(Crotatet -0.5);
    Crotatet +=1;
    
        while (Cemotion<3);
        {
        Wemotion =     (Cemotion +1);
        Cemotion +=1;
    
            while (Csaliency<2);
            {
            Wsaliency =     (Csaliency +1);
            Csaliency +=1;
            
                while (CT2lag<2);
                {
                WT2lag =     (CT2lag*500)+200;
                CT2lag +=1;
                
                    while (CT1gender<2);
                    {
                    WT1gender =     (CT1gender +1);
                    CT1gender +=1;
                    {
                        while (CT2gender<2);
                        
                        WT2gender =     (CT2gender +1);
                        CT2gender +=1;
                        tcounter +=1;
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        list.T1pos.appenditem(WT1pos);
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>

Again, please comment your code. Specifically, the while() loops, since that is what you want help with

Syntax-wise, the whole thing is pretty broken. For example, you have a statement terminater after each while condition

while (CT1pos <2);


No ; belongs there.

This whole section here is wrong:


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Dave - 11/30/2023
Dave - 11/30/2023
Dave - 11/30/2023
kev_dent - 11/30/2023
Here is the full script, I am working with.
Basically, my goal is to use var type variables to populate a set of lists, these lists then will go on to control stimulus presentation.
Essentially the issue is that I can not get my code to populate my lists at all.
I copied the code from the programmers manual and can't achieve the same in my code.
Is there an example perhaps in the library that shows how to use var type variables to control stimulus presentation?
Thanks 
Kevin
<list rotate>
/items=(0)
/poolsize =14
/ selectionrate = always
</list>

<values>
/scale = 100
</values>



<list T1pos>
/ selectionrate = trial
/ items = ()


</list>

<list rotatet>
/ selectionrate = trial
/ items = ()
/select = list.T1pos.nextindex
</list>

<list emotion>
/ items = ()

/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list saliency>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2lag>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T1gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list T2gender>
/ items = ()
/ selectionrate = trial
/select = list.T1pos.nextindex
</list>

<list maleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<list femaleselect>
/items = (1,2,3,4,5,6,7,8,9,10,11,12,13)
/ selectionrate = always
</list>

<values>
/T2pos = 0
</values>

<item neutralfemale>
/1="WF01/WF01_NO.jpg"
/2="WF02/WF02_NO.jpg"
/3="WF03/WF03_NO.jpg"
/4="WF04/WF04_NO.jpg"
/5="WF05/WF05_NO.jpg"
/6="WF06/WF06_NO.jpg"
/7="WF07/WF07_NO.jpg"
/8="WF08/WF08_NO.jpg"
/9="WF09/WF09_NO.jpg"
/10="WF10/WF10_NO.jpg"
/11="WF11/WF11_NO.jpg"
/12="WF12/WF12_NO.jpg"
/13="WF13/WF13_NO.jpg"
</item>
<item neutralmale>
/1="WM01/WM01_NO.jpg"
/2="WM02/WM02_NO.jpg"
/3="WM03/WM03_NO.jpg"
/4="WM04/WM04_NO.jpg"
/5="WM05/WM05_NO.jpg"
/6="WM06/WM06_NO.jpg"
/7="WM07/WM07_NO.jpg"
/8="WM08/WM08_NO.jpg"
/9="WM09/WM09_NO.jpg"
/10="WM10/WM10_NO.jpg"
/11="WM11/WM11_NO.jpg"
/12="WM12/WM12_NO.jpg"
/13="WM13/WM13_NO.jpg"
</item>
<item neutralfemaleRED>
/1="WF01/WF01_REDs_NO.jpg"
/2="WF02/WF02_REDs_NO.jpg"
/3="WF03/WF03_REDs_NO.jpg"
/4="WF04/WF04_REDs_NO.jpg"
/5="WF05/WF05_REDs_NO.jpg"
/6="WF06/WF06_REDs_NO.jpg"
/7="WF07/WF07_REDs_NO.jpg"
/8="WF08/WF08_REDs_NO.jpg"
/9="WF09/WF09_REDs_NO.jpg"
/10="WF10/WF10_REDs_NO.jpg"
/11="WF11/WF11_REDs_NO.jpg"
/12="WF12/WF12_REDs_NO.jpg"
/13="WF13/WF13_REDs_NO.jpg"
</item>
<item neutralmaleRED>
/1="WM01/WM01_REDs_NO.jpg"
/2="WM02/WM02_REDs_NO.jpg"
/3="WM03/WM03_REDs_NO.jpg"
/4="WM04/WM04_REDs_NO.jpg"
/5="WM05/WM05_REDs_NO.jpg"
/6="WM06/WM06_REDs_NO.jpg"
/7="WM07/WM07_REDs_NO.jpg"
/8="WM08/WM08_REDs_NO.jpg"
/9="WM09/WM09_REDs_NO.jpg"
/10="WM10/WM10_REDs_NO.jpg"
/11="WM11/WM11_REDs_NO.jpg"
/12="WM12/WM12_REDs_NO.jpg"
/13="WM13/WM13_REDs_NO.jpg"
</item>
<item angryfemale>
/1="WF01/WF01_AO.jpg"
/2="WF02/WF02_AO.jpg"
/3="WF03/WF03_AO.jpg"
/4="WF04/WF04_AO.jpg"
/5="WF05/WF05_AO.jpg"
/6="WF06/WF06_AO.jpg"
/7="WF07/WF07_AO.jpg"
/8="WF08/WF08_AO.jpg"
/9="WF09/WF09_AC.jpg"
/10="WF10/WF10_AO.jpg"
/11="WF11/WF11_AO.jpg"
/12="WF12/WF12_AO.jpg"
/13="WF13/WF13_AO.jpg"
</item>

<item angrymale>
/1="WM01/WM01_AO.jpg"
/2="WM02/WM02_AO.jpg"
/3="WM03/WM03_AO.jpg"
/4="WM04/WM04_AO.jpg"
/5="WM05/WM05_AO.jpg"
/6="WM06/WM06_AO.jpg"
/7="WM07/WM07_AO.jpg"
/8="WM08/WM08_AO.jpg"
/9="WM09/WM09_AO.jpg"
/10="WM10/WM10_AO.jpg"
/11="WM11/WM11_AO.jpg"
/12="WM12/WM12_AO.jpg"
/13="WM13/WM13_AO.jpg"
</item>

<item fearfemale>
/1="WF01/WF01_FO.jpg"
/2="WF02/WF02_FO.jpg"
/3="WF03/WF03_FO.jpg"
/4="WF04/WF04_FO.jpg"
/5="WF05/WF05_FO.jpg"
/6="WF06/WF06_FO.jpg"
/7="WF07/WF07_FO.jpg"
/8="WF08/WF08_FO.jpg"
/9="WF09/WF09_FO.jpg"
/10="WF10/WF10_FO.jpg"
/11="WF11/WF11_FO.jpg"
/12="WF12/WF12_FO.jpg"
/13="WF13/WF13_FO.jpg"
</item>
<item fearmale>
/1="WM01/WM01_FO.jpg"
/2="WM02/WM02_FO.jpg"
/3="WM03/WM03_FO.jpg"
/4="WM04/WM04_FO.jpg"
/5="WM05/WM05_FO.jpg"
/6="WM06/WM06_FO.jpg"
/7="WM07/WM07_FO.jpg"
/8="WM08/WM08_FO.jpg"
/9="WM09/WM09_FO.jpg"
/10="WM10/WM10_FO.jpg"
/11="WM11/WM11_FO.jpg"
/12="WM12/WM12_FO.jpg"
/13="WM13/WM13_FO.jpg"
</item>

<item angryfemaleRED>
/1="WF01/WF01_REDs_AO.jpg"
/2="WF02/WF02_REDs_AO.jpg"
/3="WF03/WF03_REDs_AO.jpg"
/4="WF04/WF04_REDs_AO.jpg"
/5="WF05/WF05_REDs_AO.jpg"
/6="WF06/WF06_REDs_AO.jpg"
/7="WF07/WF07_REDs_AO.jpg"
/8="WF08/WF08_REDs_AO.jpg"
/9="WF09/WF09_REDs_AC.jpg"
/10="WF10/WF10_REDs_AO.jpg"
/11="WF11/WF11_REDs_AO.jpg"
/12="WF12/WF12_RED_AO.jpg"
/13="WF13/WF13_RED_AO.jpg"
</item>

<item angrymaleRED>
/1="WM01/WM01_REDs_AO.jpg"
/2="WM02/WM02_REDs_AO.jpg"
/3="WM03/WM03_REDs_AO.jpg"
/4="WM04/WM04_REDs_AO.jpg"
/5="WM05/WM05_REDs_AO.jpg"
/6="WM06/WM06_REDs_AO.jpg"
/7="WM07/WM07_REDs_AO.jpg"
/8="WM08/WM08_REDs_AO.jpg"
/9="WM09/WM09_REDs_AO.jpg"
/10="WM10/WM10_REDs_AO.jpg"
/11="WM11/WM11_REDs_AO.jpg"
/12="WM12/WM12_REDs_AO.jpg"
/13="WM13/WM13_REDs_AO.jpg"
</item>

<item fearfemaleRED>
/1="WF01/WF01_REDs_FO.jpg"
/2="WF02/WF02_REDs_FO.jpg"
/3="WF03/WF03_REDs_FO.jpg"
/4="WF04/WF04_REDs_FO.jpg"
/5="WF05/WF05_REDs_FO.jpg"
/6="WF06/WF06_REDs_FO.jpg"
/7="WF07/WF07_REDs_FO.jpg"
/8="WF08/WF08_REDs_FO.jpg"
/9="WF09/WF09_REDs_FO.jpg"
/10="WF10/WF10_REDs_FO.jpg"
/11="WF11/WF11_REDs_FO.jpg"
/12="WF12/WF12_RED_FO.jpg"
/13="WF13/WF13_RED_FO.jpg"
</item>
<item fearmaleRED>
/1="WM01/WM01_REDs_FO.jpg"
/2="WM02/WM02_REDs_FO.jpg"
/3="WM03/WM03_REDs_FO.jpg"
/4="WM04/WM04_REDs_FO.jpg"
/5="WM05/WM05_REDs_FO.jpg"
/6="WM06/WM06_REDs_FO.jpg"
/7="WM07/WM07_REDs_FO.jpg"
/8="WM08/WM08_REDs_FO.jpg"
/9="WM09/WM09_REDs_FO.jpg"
/10="WM10/WM10_REDs_FO.jpg"
/11="WM11/WM11_REDs_FO.jpg"
/12="WM12/WM12_REDs_FO.jpg"
/13="WM13/WM13_REDs_FO.jpg"
</item>

<item scrambledneutral>
/1="Scrm_data_KD/WF01_NO_S.jpg"
/2="Scrm_data_KD/WF02_NO_S.jpg"
/3="Scrm_data_KD/WF03_NO_S.jpg"
/4="Scrm_data_KD/WF04_NO_S.jpg"
/5="Scrm_data_KD/WF05_NO_S.jpg"
/6="Scrm_data_KD/WF06_NO_S.jpg"
/7="Scrm_data_KD/WF07_NO_S.jpg"
/8="Scrm_data_KD/WF08_NO_S.jpg"
/9="Scrm_data_KD/WF09_NO_S.jpg"
/10="Scrm_data_KD/WF10_NO_S.jpg"
/11="Scrm_data_KD/WF11_NO_S.jpg"
/12="Scrm_data_KD/WF12_NO_S.jpg"
/13="Scrm_data_KD/WF13_NO_S.jpg"
/14="Scrm_data_KD/WM01_NO_S.jpg"
/15="Scrm_data_KD/WM02_NO_S.jpg"
/16="Scrm_data_KD/WM03_NO_S.jpg"
/17="Scrm_data_KD/WM04_NO_S.jpg"
/18="Scrm_data_KD/WM05_NO_S.jpg"
/19="Scrm_data_KD/WM06_NO_S.jpg"
/20="Scrm_data_KD/WM07_NO_S.jpg"
/21="Scrm_data_KD/WM08_NO_S.jpg"
/22="Scrm_data_KD/WM09_NO_S.jpg"
/23="Scrm_data_KD/WM10_NO_S.jpg"
/24="Scrm_data_KD/WM11_NO_S.jpg"
/25="Scrm_data_KD/WM12_NO_S.jpg"
/26="Scrm_data_KD/WM13_NO_S.jpg"
</item>
<list scramselect>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26)

/ selectionrate = always
</list>

<picture distractor1>
/ items = scrambledneutral
/ selectionrate = always
/ size= (values.scale-0mm,values.scale-0mm)
/ select = list.scramselect.nextvalue
</picture>

<picture distractor2>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor3>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor4>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor5>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor6>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor7>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor8>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor9>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor10>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor11>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor12>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture distractor13>
/ items = scrambledneutral
/ selectionrate = always
/ select = list.scramselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angryfemaleRED>
/ items = angryfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture angrymaleRED>
/ items = angrymaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemaleRED>
/ items = fearfemaleRED
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture fearmaleRED>
/ items = fearmaleRED
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angryfemale>
/ items = angryfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture angrymale>
/ items = angrymale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearfemale>
/ items = fearfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture fearmale>
/ items = fearmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>
<picture neutralmalet>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)
</picture>

<picture neutralfemalet>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)
/rotation = (list.rotatet.nextvalue)

</picture>

<picture neutralfemale>
/ items = neutralfemale
/ selectionrate = always
/ select =list.femaleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<picture neutralmale>
/ items = neutralmale
/ selectionrate = always
/ select =list.maleselect.nextvalue
/ size= (values.scale-0mm,values.scale-0mm)

</picture>

<shape blank>
/shape =rectangle
/color = (white)
/ size = (100%, 100%)
</shape>


<trial facestream1>
/ontrialbegin =[

list.scramselect.reset();
list.maleselect.reset();
list.femaleselect.reset();
trial.facestream1.clearstimulusframes();
values.T2pos=list.T1pos.nextvalue + list.T2lag.nextvalue;
trial.facestream1.setstimulustime(shape.blank, 100*1);
trial.facestream1.setstimulustime(shape.blank, 200*1);
trial.facestream1.setstimulustime(shape.blank, 300*1);
trial.facestream1.setstimulustime(shape.blank, 400*1);
trial.facestream1.setstimulustime(shape.blank, 500*1);
trial.facestream1.setstimulustime(shape.blank, 600*1);
trial.facestream1.setstimulustime(shape.blank, 700*1);
trial.facestream1.setstimulustime(shape.blank, 800*1);
trial.facestream1.setstimulustime(shape.blank, 900*1);
trial.facestream1.setstimulustime(shape.blank, 1000*1);
trial.facestream1.setstimulustime(shape.blank, 1100*1);
trial.facestream1.setstimulustime(shape.blank, 1200*1);
trial.facestream1.setstimulustime(shape.blank, 1300*1);
trial.facestream1.insertstimulustime(picture.distractor1, 100*1);
trial.facestream1.insertstimulustime(picture.distractor2, 200*1);
trial.facestream1.insertstimulustime(picture.distractor3, 300*1);
trial.facestream1.insertstimulustime(picture.distractor4, 400*1);
trial.facestream1.insertstimulustime(picture.distractor5, 500*1);
trial.facestream1.insertstimulustime(picture.distractor6, 600*1);
trial.facestream1.insertstimulustime(picture.distractor7, 700*1);
trial.facestream1.insertstimulustime(picture.distractor8, 800*1);
trial.facestream1.insertstimulustime(picture.distractor9, 900*1);
trial.facestream1.insertstimulustime(picture.distractor10, 1000*1);
trial.facestream1.insertstimulustime(picture.distractor11, 1100*1);
trial.facestream1.insertstimulustime(picture.distractor12, 1200*1);
trial.facestream1.insertstimulustime(picture.distractor13, 1300*1);
trial.facestream1.insertstimulustime(shape.blank, 1400*1);

trial.facestream1.setstimulustime(shape.blank, values.T2pos);
if (list.T2gender.nextvalue==1)
trial.facestream1.insertstimulustime(picture.neutralfemalet, values.T2pos)
else if (list.T2gender.nextvalue==2)
trial.facestream1.insertstimulustime(picture.neutralmalet, values.T2pos);
trial.facestream1.setstimulustime(shape.blank, list.T1pos.nextvalue);


if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.neutralfemale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.angryfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==1)
trial.facestream1.insertstimulustime(picture.fearfemaleRED, list.T1pos.nextvalue);

if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==1 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.neutralmale, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 1 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.angrymaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 2 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue)
else if (list.emotion.nextvalue == 3 && list.saliency.nextvalue==2 && list.T1gender.nextvalue ==2)
trial.facestream1.insertstimulustime(picture.fearmaleRED, list.T1pos.nextvalue);
]
/stimulustimes =[
]
/ validresponse = (44,49)
/ inputdevice = keyboard
/ iscorrectresponse = [(list.T2gender.nextvalue==2 && trial.facestream1.response == 49)||(list.T2gender.nextvalue==1 && trial.facestream1.response == 44)]

</trial>

<data>
/ columns = (
date,
time,
group,
subject,
trialcode,
blockcode,
blocknum,
trialnum,
latency,
response,
responsetext,
list.T1gender.currentvalue,
list.T2gender.currentvalue,
list.emotion.currentvalue
list.saliency.currentvalue,
list.T1pos.currentvalue,
list.T2lag.currentvalue,
values.T2pos,
list.rotatet.currentvalue,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,
stimulusitem,

)



</data>




<page instruct>
^^ Look for the tilted face.
^^ If it is female to the left (top on left) press Z
^^ If it is male to the left (top on rigt) press N
</page>

<page break>
^^ Please take a breather...
</page>

<text correcttext>
/items =("Correct")
/ txcolor = green
</text>

<text errortext>
/items =("Wrong")
/ txcolor = red
</text>

<trial break>
/ timeout = 0
</trial>

<block break>
/preinstructions = (break)
/trials=[1=break]
</block>


<block main>
/preinstructions = (instruct)
/trials=[1-96=noreplace(facestream1)]
</block>

<expt main>
/ onexptbegin = [
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
    
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
    
    var tcounter =0;
    
    while (CT1pos <2);
    {
    WT1pos =     100*(CT1pos +3);
    CT1pos +=1;
    
    while (Crotatet <2);
    {
    Wrotatet =     30*(Crotatet -0.5);
    Crotatet +=1;
    
        while (Cemotion<3);
        {
        Wemotion =     (Cemotion +1);
        Cemotion +=1;
    
            while (Csaliency<2);
            {
            Wsaliency =     (Csaliency +1);
            Csaliency +=1;
            
                while (CT2lag<2);
                {
                WT2lag =     (CT2lag*500)+200;
                CT2lag +=1;
                
                    while (CT1gender<2);
                    {
                    WT1gender =     (CT1gender +1);
                    CT1gender +=1;
                    {
                        while (CT2gender<2);
                        
                        WT2gender =     (CT2gender +1);
                        CT2gender +=1;
                        tcounter +=1;
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        list.T1pos.appenditem(WT1pos);
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>

Again, please comment your code. Specifically, the while() loops, since that is what you want help with

Syntax-wise, the whole thing is pretty broken. For example, you have a statement terminater after each while condition

while (CT1pos <2);


No ; belongs there.

This whole section here is wrong:


So if you fix the broken syntax and other mistakes, the thing will run and do something with the lists, i.e. populate them.

Whether in the way you intended or not, I can't tell, since you have not laid out those things.

<expt main>
/ onexptbegin = [
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;

    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;

    var tcounter =0;

    while (CT1pos <2) {
        WT1pos =100*(CT1pos + 3);
        CT1pos +=1;
        while (Crotatet <2) {
            Wrotatet = 30*(Crotatet -0.5);
            Crotatet +=1;
            while (Cemotion<3) {
                Wemotion =(Cemotion +1);
                Cemotion +=1;
                while (Csaliency<2) {
                    Wsaliency =(Csaliency +1);
                    Csaliency +=1;
                    while (CT2lag<2) {
                        WT2lag =(CT2lag*500)+200;
                        CT2lag +=1;
                        while (CT1gender<2) {
                            WT1gender = (CT1gender +1);
                            CT1gender +=1;
                        //{ doesn't belong here
                            while (CT2gender<2) {
                                WT2gender = (CT2gender +1);
                                CT2gender +=1;
                                tcounter +=1;
                                list.rotatet.appenditem(Wrotatet);
                                list.emotion.appenditem(Wemotion);
                                list.saliency.appenditem(Wsaliency);
                                list.T2lag.appenditem(WT2lag);
                                list.T1gender.appenditem(WT1gender);
                                list.T2gender.appenditem(WT2gender);
                                list.T1pos.appenditem(WT1pos);
                            }
                        }
                    }
                }
            }
        }
    };
    //script.debugbreak();
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>

kev_dent
kev_dent
Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)
Group: Forum Members
Posts: 47, Visits: 153
Thanks Dave, I will see if I can correct the errors you point out and see if the code then does what I want.
Below for the code snippet that is critical I added some comments to specify what I'm aiming for.

<expt main>
/ onexptbegin = [
// set a bunch of "control variables to terminate control and terminate while loops"
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
// set a bunch of "write variables to write to the lists"
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
// set a variable to count the iterations
    var tcounter =0;

// nest a bunch of while loops to populate the lists
    while (CT1pos <2); //loop through 2 possible states
    {
    WT1pos =     100*(CT1pos +3);//convert control variable value to write variable value
    CT1pos +=1; //increment control state
    
    while (Crotatet <2);//loop through 2 possible states
    {
    Wrotatet =     30*(Crotatet -0.5);//convert control variable value to write variable value
    Crotatet +=1;//increment control state
    
        while (Cemotion<3);//loop through 3 possible states
        {
        Wemotion =     (Cemotion +1);//convert control variable value to write variable value
        Cemotion +=1;//increment control state
    
            while (Csaliency<2);//loop through 2 possible states
            {
            Wsaliency =     (Csaliency +1);//convert control variable value to write variable value
            Csaliency +=1;//increment control state
            
                while (CT2lag<2);//loop through 2 possible states
                {
                WT2lag =     (CT2lag*500)+200;//convert control variable value to write variable value
                CT2lag +=1;//increment control state
                
                    while (CT1gender<2);//loop through 2 possible states
                    {
                    WT1gender =     (CT1gender +1);//convert control variable value to write variable value
                    CT1gender +=1;//increment control state
                    {
                        while (CT2gender<2);//loop through 2 possible states
                        
                        WT2gender =     (CT2gender +1);//convert control variable value to write variable value
                        CT2gender +=1;//increment control state
                        tcounter +=1;//increment iteration counter
                        //write all the calculated values to the lists
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        list.T1pos.appenditem(WT1pos);
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
kev_dent - 11/30/2023
Thanks Dave, I will see if I can correct the errors you point out and see if the code then does what I want.
Below for the code snippet that is critical I added some comments to specify what I'm aiming for.

<expt main>
/ onexptbegin = [
// set a bunch of "control variables to terminate control and terminate while loops"
    var Crotatet = 0;
    var Cemotion = 0;
    var Csaliency = 0;
    var CT2lag = 0;
    var CT1gender = 0;
    var CT2gender = 0;
    var CT1pos = 0;
// set a bunch of "write variables to write to the lists"
    var Wrotatet = 0;
    var Wemotion = 0;
    var Wsaliency = 0;
    var WT2lag = 0;
    var WT1gender = 0;
    var WT2gender = 0;
    var WT1pos = 0;
// set a variable to count the iterations
    var tcounter =0;

// nest a bunch of while loops to populate the lists
    while (CT1pos <2); //loop through 2 possible states
    {
    WT1pos =     100*(CT1pos +3);//convert control variable value to write variable value
    CT1pos +=1; //increment control state
    
    while (Crotatet <2);//loop through 2 possible states
    {
    Wrotatet =     30*(Crotatet -0.5);//convert control variable value to write variable value
    Crotatet +=1;//increment control state
    
        while (Cemotion<3);//loop through 3 possible states
        {
        Wemotion =     (Cemotion +1);//convert control variable value to write variable value
        Cemotion +=1;//increment control state
    
            while (Csaliency<2);//loop through 2 possible states
            {
            Wsaliency =     (Csaliency +1);//convert control variable value to write variable value
            Csaliency +=1;//increment control state
            
                while (CT2lag<2);//loop through 2 possible states
                {
                WT2lag =     (CT2lag*500)+200;//convert control variable value to write variable value
                CT2lag +=1;//increment control state
                
                    while (CT1gender<2);//loop through 2 possible states
                    {
                    WT1gender =     (CT1gender +1);//convert control variable value to write variable value
                    CT1gender +=1;//increment control state
                    {
                        while (CT2gender<2);//loop through 2 possible states
                        
                        WT2gender =     (CT2gender +1);//convert control variable value to write variable value
                        CT2gender +=1;//increment control state
                        tcounter +=1;//increment iteration counter
                        //write all the calculated values to the lists
                        list.rotatet.appenditem(Wrotatet);
                        list.emotion.appenditem(Wemotion);
                        list.saliency.appenditem(Wsaliency);
                        list.T2lag.appenditem(WT2lag);
                        list.T1gender.appenditem(WT1gender);
                        list.T2gender.appenditem(WT2gender);
                        list.T1pos.appenditem(WT1pos);
                        }}}}}}}
]

/blocks = [1=main;2=break;3=main;4=break;5=main]
</expt>

Already posted a version with at least the various syntax mistakes (statement terminators where none belong, misplaced curly braces) upthread. This runs and does something. Whether it does the inteneded things or whether you have logic bugs you need to work out first, I can't say.
kev_dent
kev_dent
Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)Partner Member (726 reputation)
Group: Forum Members
Posts: 47, Visits: 153
Dear Dave,
Here is a simple script to illustrate the problem I wish to solve.
In this example I wish to generate the text 1 1, 1 2, 2 1, and 2 2 over 4 trials in a row, with 2 numbers per trial.
I would like to do this by populating the lists in the script programatically rather than hard coding them.
I'm not a programmer and can't seem to get it working.
Can you help by showing me how to get the code below to work, then I can scale up to a bigger set of loops?
Thanks 
Kevin

// aim of the script to generate 16 trials that show the following sequences of numbers
// 1 1
// 1 2
// 2 1
// 2 2

// attempting to do this by programmatically populating lists


// stmulus 1
<text thetext>
/items=("1","2")
/select =list.anumber.nextvalue

</text>
// stimulus 2
<text thetext2>
/items=("1","2")
/select =list.anumber2.nextvalue

</text>
//list to populate desired end state (1,1,2,2)
<list anumber>
/items=()
/selectionrate = always
/select = sequence
</list>
//list to populate desired end state (1,2,1,2)
<list anumber2>
/items=()
/selectionrate = always
/select = sequence
</list>

//loop through 2 states of c
//calculate the target variable for writing to the list w
// update the control variable to terminate the loop when required c    
//loop through 2 states of c2 (at each level of the prior loop c)
//calculate the target variable for writing to the list w2
// update the control variable to terminate the loop when required c2
// write the values when the final value is calculated w and w2

<expt e>
/ onexptbegin = [
var c =0;
var w =0;
var c2 =0;
var w2 =0;

while (c<2) {
    w = c+1;
    c +=1;
    
    while (c2<2) {
        w2 = c2+1;
        c2 +=1;
        
        list.anumber.appenditem(w);
        list.anumber2.appenditem(w2);
    }
    
            };
]



/ blocks = [1=b]

</expt>

<block b>
/trials=[1-4 =t]
</block>

<trial t>
/ posttrialpause = 100
/ pretrialpause = 100
/stimulustimes = [0=thetext; 200=thetext2]
/ inputdevice = keyboard
/ validresponse = (" ")
</trial>
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search