Values in stimulustimes attribute


Author
Message
reg_002
reg_002
Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)
Group: Forum Members
Posts: 13, Visits: 65
Hi, 

I want to refer to values in the stimulustimes attribute, specifically, in the name of a certain variable.
However, referring to it via <%values.value %> as I would do in a text does not seem to work.

Is there any other way to refer to the value of a certain value ? 

For instance: 

<picture man1>
/ items = ("man1.jpg")
</picture>

<picture man2>
/ items = ("man2.jpg")
</picture>

<values>
/ valueA=1
</values>

<trial firsttrial>
/ stimulustimes = [0=man<% values.value1 %>] 
/ ontrialend = values.valueA1=2 ]
</trial>


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: 13K, Visits: 104K
reg_002 - Sunday, February 19, 2017
Hi, 

I want to refer to values in the stimulustimes attribute, specifically, in the name of a certain variable.
However, referring to it via <%values.value %> as I would do in a text does not seem to work.

Is there any other way to refer to the value of a certain value ? 

For instance: 

<picture man1>
/ items = ("man1.jpg")
</picture>

<picture man2>
/ items = ("man2.jpg")
</picture>

<values>
/ valueA=1
</values>

<trial firsttrial>
/ stimulustimes = [0=man<% values.value1 %>] 
/ ontrialend = values.valueA1=2 ]
</trial>


You cannot use values like that. The way to do this is to use the <trial> element's insertstimulustime() function like so:

<trial firsttrial>
/ ontrialbegin = [if (values.valueA == 1) trial.firsttrial.insertstimulustime(picture.man1, 0); ]
/ ontrialbegin = [if (values.valueA == 2) trial.firsttrial.insertstimulustime(picture.man2, 0); ]
...
/ ontrialend = [trial.firsttrial.resetstimulusframes(); values.valueA += 1]
</trial>

However, why don't you simply use the value for item *selection* in a <picture> element, i.e.

<picture man>
/ items = manitems
/ select = values.valueA
</picture>

<item manitems>
/ 1 = "man1.jpg"
/ 2 = "man2.jpg"
</item>

with

<trial firsttrial>
/ stimulustimes = [0=man]
/ ontrialend = [values.valueA += 1]
...
</trial>

reg_002
reg_002
Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)
Group: Forum Members
Posts: 13, Visits: 65
Dave - Sunday, February 19, 2017
reg_002 - Sunday, February 19, 2017
Thank you for your quick response ! 

Sorry, I tried to simplify the problem to be able to explain what I meant. 
I think your first solution might still work though.

The problem is that I want to use that value in many different stimulustimes with the value constantly being updated. 

Here's part of the script: 

<values>
/ prev_health = 4
/ prev_approach = 1
/ prev_good = 1
</values>

<trial cdt3trialmanvekpos_vek>
/ branch =[if(values.prev_approach==1 && values.prev_good==1) {trial.cdt3trialmanvekpos_vek1}if(values.prev_approach==0 && values.prev_good==1) {trial.cdt3trialmanvekpos_vek2}if(values.prev_approach==1 && values.prev_good==0) {trial.cdt3trialmanvekpos_vek3}if(values.prev_approach==0 && values.prev_good==0) {trial.cdt3trialmanvekpos_vek4}]
</trial>

<trial cdt3trialmanvekpos_vek1>
/ pretrialpause = 100
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>, hb, great1; 125 = man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health %>_1, hb, great1; 250= man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>_2, hb, great1;375= man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health+1 %>, hb, great1;500=man<% values.prev_health+1 %>_stand, healthbar<% values.prev_health+1 %>, hb; 750= man<% values.prev_health+1 %>_open1, healthbar<% values.prev_health+1 %>, hb; 1000= man<% values.prev_health+1 %>_open2, healthbar<% values.prev_health+1 %>, hb; 1250= man<% values.prev_health+1 %>_vekte, healthbar<% values.prev_health+1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek1.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek1.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek1.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek2>
/ pretrialpause = 100
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>, hb, great2; 125 = man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health %>_1, hb, great2; 250= man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>_2, hb, great2;375= man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health+1 %>, hb, great2;500=man<% values.prev_health+1 %>_stand, healthbar<% values.prev_health+1 %>, hb; 750= man<% values.prev_health+1 %>_open1, healthbar<% values.prev_health+1 %>, hb; 1000= man<% values.prev_health+1 %>_open2, healthbar<% values.prev_health+1 %>, hb; 1250= man<% values.prev_health+1 %>_vekte, healthbar<% values.prev_health+1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek2.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek2.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek2.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek3>
/ pretrialpause = 100
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health-1 %>_neg1, healthbar<% values.prev_health %>, hb, sick1; 125 = man<% values.prev_health-1 %>_neg2, healthbar<% values.prev_health %>_2, hb, sick1; 250= man<% values.prev_health-1 %>_neg3, healthbar<% values.prev_health %>_1, hb, sick1;375= man<% values.prev_health-1 %>_neg4, healthbar<% values.prev_health-1 %>, hb, sick1;500=man<% values.prev_health-1 %>_stand, healthbar<% values.prev_health-1 %>, hb; 750= man<% values.prev_health-1 %>_open1, healthbar<% values.prev_health-1 %>, hb; 1000= man<% values.prev_health-1 %>_open2, healthbar<% values.prev_health-1 %>, hb; 1250= man<% values.prev_health-1 %>_vekte, healthbar<% values.prev_health-1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek3.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek3.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek3.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek4>
/ pretrialpause = 100
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health-1 %>_neg1, healthbar<% values.prev_health %>, hb, sick2; 125 = man<% values.prev_health-1 %>_neg2, healthbar<% values.prev_health %>_2, hb, sick2; 250= man<% values.prev_health-1 %>_neg3, healthbar<% values.prev_health %>_1, hb, sick2;375= man<% values.prev_health-1 %>_neg4, healthbar<% values.prev_health-1 %>, hb, sick2;500=man<% values.prev_health-1 %>_stand, healthbar<% values.prev_health-1 %>, hb; 750= man<% values.prev_health-1 %>_open1, healthbar<% values.prev_health-1 %>, hb; 1000= man<% values.prev_health-1 %>_open2, healthbar<% values.prev_health-1 %>, hb; 1250= man<% values.prev_health-1 %>_vekte, healthbar<% values.prev_health-1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek4.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek4.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek4.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek_app>
/ stimulustimes = [0=man<% values.prev_health %>_approachvekte1, healthbar<% values.prev_health %>, hb; 125=man<% values.prev_health+1 %>_approachvekte2, healthbar<% values.prev_health+1 %>, hb;250=man<% values.prev_health+1 %>_approachvekte3, healthbar<% values.prev_health+1 %>, hb;375=man<% values.prev_health+1 %>_approachvekte4, healthbar<% values.prev_health+1 %>, hb;500=man<% values.prev_health+1 %>_approachvekte5, healthbar<% values.prev_health+1 %>, hb;625=man<% values.prev_health+1 %>_approachvekte6, healthbar<% values.prev_health+1 %>, hb;750=man<% values.prev_health+1 %>_approachvekte7, healthbar<% values.prev_health+1 %>, hb]
/ posttrialpause = 100
/ responseinterrupt = trial
/ recorddata = false
/ timeout = 1000
</trial>

<trial cdt3trialmanvekpos_vek_av>
/ stimulustimes = [0=man<% values.prev_health %>_avoidvekte1, healthbar<% values.prev_health %>, hb; 125=man<% values.prev_health+1 %>_avoidvekte2, healthbar<% values.prev_health+1 %>, hb;250=man<% values.prev_health+1 %>_avoidvekte3, healthbar<% values.prev_health+1 %>, hb;375=man<% values.prev_health+1 %>_avoidvekte4, healthbar<% values.prev_health+1 %>, hb;500=man<% values.prev_health+1 %>_avoidvekte5, healthbar<% values.prev_health+1 %>, hb;625=man<% values.prev_health+1 %>_avoidvekte6, healthbar<% values.prev_health+1 %>, hb;750=man<% values.prev_health+1 %>_avoidvekte7, healthbar<% values.prev_health+1 %>, hb]
/ posttrialpause = 100
/ responseinterrupt = trial
/ recorddata = false
/ timeout = 1000
</trial>


Note: this is only a small part of the trial elements that I have in the script (and of the stimuli).
So for that reason it would have been really easy to be able to use <% value %> but if it can't be done then I'll try to get it to work with the insertstimulustime attribute.

Thanks again, 

Pieter






Hi, 

I want to refer to values in the stimulustimes attribute, specifically, in the name of a certain variable.
However, referring to it via <%values.value %> as I would do in a text does not seem to work.

Is there any other way to refer to the value of a certain value ? 

For instance: 

<picture man1>
/ items = ("man1.jpg")
</picture>

<picture man2>
/ items = ("man2.jpg")
</picture>

<values>
/ valueA=1
</values>

<trial firsttrial>
/ stimulustimes = [0=man<% values.value1 %>] 
/ ontrialend = values.valueA1=2 ]
</trial>


You cannot use values like that. The way to do this is to use the <trial> element's insertstimulustime() function like so:

<trial firsttrial>
/ ontrialbegin = [if (values.valueA == 1) trial.firsttrial.insertstimulustime(picture.man1, 0); ]
/ ontrialbegin = [if (values.valueA == 2) trial.firsttrial.insertstimulustime(picture.man2, 0); ]
...
/ ontrialend = [trial.firsttrial.resetstimulusframes(); values.valueA += 1]
</trial>

However, why don't you simply use the value for item *selection* in a <picture> element, i.e.

<picture man>
/ items = manitems
/ select = values.valueA
</picture>

<item manitems>
/ 1 = "man1.jpg"
/ 2 = "man2.jpg"
</item>

with

<trial firsttrial>
/ stimulustimes = [0=man]
/ ontrialend = [values.valueA += 1]
...
</trial>



reg_002
reg_002
Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)Partner Member (689 reputation)
Group: Forum Members
Posts: 13, Visits: 65
Dave - Sunday, February 19, 2017
reg_002 - Sunday, February 19, 2017
Hi, 

I want to refer to values in the stimulustimes attribute, specifically, in the name of a certain variable.
However, referring to it via <%values.value %> as I would do in a text does not seem to work.

Is there any other way to refer to the value of a certain value ? 

For instance: 

<picture man1>
/ items = ("man1.jpg")
</picture>

<picture man2>
/ items = ("man2.jpg")
</picture>

<values>
/ valueA=1
</values>

<trial firsttrial>
/ stimulustimes = [0=man<% values.value1 %>] 
/ ontrialend = values.valueA1=2 ]
</trial>


You cannot use values like that. The way to do this is to use the <trial> element's insertstimulustime() function like so:

<trial firsttrial>
/ ontrialbegin = [if (values.valueA == 1) trial.firsttrial.insertstimulustime(picture.man1, 0); ]
/ ontrialbegin = [if (values.valueA == 2) trial.firsttrial.insertstimulustime(picture.man2, 0); ]
...
/ ontrialend = [trial.firsttrial.resetstimulusframes(); values.valueA += 1]
</trial>

However, why don't you simply use the value for item *selection* in a <picture> element, i.e.

<picture man>
/ items = manitems
/ select = values.valueA
</picture>

<item manitems>
/ 1 = "man1.jpg"
/ 2 = "man2.jpg"
</item>

with

<trial firsttrial>
/ stimulustimes = [0=man]
/ ontrialend = [values.valueA += 1]
...
</trial>

Thank you for your quick response ! 

Sorry, I tried to simplify the problem to be able to explain what I meant so the problem is not as simple as I explained it to be. 

I think your first solution might still work though.
The problem is that I want to use that value in many different stimulustimes with the value constantly being updated. 

Here's part of the script: 

<values>
/ prev_health = 4
/ prev_approach = 1
/ prev_good = 1
</values>

<trial cdt3trialmanvekpos_vek> 
/ branch =[if(values.prev_approach==1 && values.prev_good==1) {trial.cdt3trialmanvekpos_vek1}if(values.prev_approach==0 && values.prev_good==1) {trial.cdt3trialmanvekpos_vek2}if(values.prev_approach==1 && values.prev_good==0) {trial.cdt3trialmanvekpos_vek3}if(values.prev_approach==0 && values.prev_good==0) {trial.cdt3trialmanvekpos_vek4}]
</trial>

<trial cdt3trialmanvekpos_vek1> 
/ pretrialpause = 100 
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>, hb, great1; 125 = man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health %>_1, hb, great1; 250= man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>_2, hb, great1;375= man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health+1 %>, hb, great1;500=man<% values.prev_health+1 %>_stand, healthbar<% values.prev_health+1 %>, hb; 750= man<% values.prev_health+1 %>_open1, healthbar<% values.prev_health+1 %>, hb; 1000= man<% values.prev_health+1 %>_open2, healthbar<% values.prev_health+1 %>, hb; 1250= man<% values.prev_health+1 %>_vekte, healthbar<% values.prev_health+1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek1.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek1.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek1.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek2> 
/ pretrialpause = 100 
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>, hb, great2; 125 = man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health %>_1, hb, great2; 250= man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>_2, hb, great2;375= man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health+1 %>, hb, great2;500=man<% values.prev_health+1 %>_stand, healthbar<% values.prev_health+1 %>, hb; 750= man<% values.prev_health+1 %>_open1, healthbar<% values.prev_health+1 %>, hb; 1000= man<% values.prev_health+1 %>_open2, healthbar<% values.prev_health+1 %>, hb; 1250= man<% values.prev_health+1 %>_vekte, healthbar<% values.prev_health+1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek2.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek2.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek2.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek3> 
/ pretrialpause = 100 
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health-1 %>_neg1, healthbar<% values.prev_health %>, hb, sick1; 125 = man<% values.prev_health-1 %>_neg2, healthbar<% values.prev_health %>_2, hb, sick1; 250= man<% values.prev_health-1 %>_neg3, healthbar<% values.prev_health %>_1, hb, sick1;375= man<% values.prev_health-1 %>_neg4, healthbar<% values.prev_health-1 %>, hb, sick1;500=man<% values.prev_health-1 %>_stand, healthbar<% values.prev_health-1 %>, hb; 750= man<% values.prev_health-1 %>_open1, healthbar<% values.prev_health-1 %>, hb; 1000= man<% values.prev_health-1 %>_open2, healthbar<% values.prev_health-1 %>, hb; 1250= man<% values.prev_health-1 %>_vekte, healthbar<% values.prev_health-1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek3.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek3.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek3.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek4> 
/ pretrialpause = 100 
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health-1 %>_neg1, healthbar<% values.prev_health %>, hb, sick2; 125 = man<% values.prev_health-1 %>_neg2, healthbar<% values.prev_health %>_2, hb, sick2; 250= man<% values.prev_health-1 %>_neg3, healthbar<% values.prev_health %>_1, hb, sick2;375= man<% values.prev_health-1 %>_neg4, healthbar<% values.prev_health-1 %>, hb, sick2;500=man<% values.prev_health-1 %>_stand, healthbar<% values.prev_health-1 %>, hb; 750= man<% values.prev_health-1 %>_open1, healthbar<% values.prev_health-1 %>, hb; 1000= man<% values.prev_health-1 %>_open2, healthbar<% values.prev_health-1 %>, hb; 1250= man<% values.prev_health-1 %>_vekte, healthbar<% values.prev_health-1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek4.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek4.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek4.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek_app> 
/ stimulustimes = [0=man<% values.prev_health %>_approachvekte1, healthbar<% values.prev_health %>, hb; 125=man<% values.prev_health+1 %>_approachvekte2, healthbar<% values.prev_health+1 %>, hb;250=man<% values.prev_health+1 %>_approachvekte3, healthbar<% values.prev_health+1 %>, hb;375=man<% values.prev_health+1 %>_approachvekte4, healthbar<% values.prev_health+1 %>, hb;500=man<% values.prev_health+1 %>_approachvekte5, healthbar<% values.prev_health+1 %>, hb;625=man<% values.prev_health+1 %>_approachvekte6, healthbar<% values.prev_health+1 %>, hb;750=man<% values.prev_health+1 %>_approachvekte7, healthbar<% values.prev_health+1 %>, hb]
/ posttrialpause = 100
/ responseinterrupt = trial
/ recorddata = false
/ timeout = 1000
</trial>

<trial cdt3trialmanvekpos_vek_av> 
/ stimulustimes = [0=man<% values.prev_health %>_avoidvekte1, healthbar<% values.prev_health %>, hb; 125=man<% values.prev_health+1 %>_avoidvekte2, healthbar<% values.prev_health+1 %>, hb;250=man<% values.prev_health+1 %>_avoidvekte3, healthbar<% values.prev_health+1 %>, hb;375=man<% values.prev_health+1 %>_avoidvekte4, healthbar<% values.prev_health+1 %>, hb;500=man<% values.prev_health+1 %>_avoidvekte5, healthbar<% values.prev_health+1 %>, hb;625=man<% values.prev_health+1 %>_avoidvekte6, healthbar<% values.prev_health+1 %>, hb;750=man<% values.prev_health+1 %>_avoidvekte7, healthbar<% values.prev_health+1 %>, hb]
/ posttrialpause = 100
/ responseinterrupt = trial
/ recorddata = false
/ timeout = 1000
</trial>


Note: this is only a small part of the trial elements that I have in the script (and of the stimuli).
So for that reason it would have been really easy to be able to use <% value %> but if it can't be done then I'll try to get it to work with the insertstimulustime attribute.

Thanks again, 

Pieter

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: 13K, Visits: 104K
reg_002 - Monday, February 20, 2017
Dave - Sunday, February 19, 2017
reg_002 - Sunday, February 19, 2017
Hi, 

I want to refer to values in the stimulustimes attribute, specifically, in the name of a certain variable.
However, referring to it via <%values.value %> as I would do in a text does not seem to work.

Is there any other way to refer to the value of a certain value ? 

For instance: 

<picture man1>
/ items = ("man1.jpg")
</picture>

<picture man2>
/ items = ("man2.jpg")
</picture>

<values>
/ valueA=1
</values>

<trial firsttrial>
/ stimulustimes = [0=man<% values.value1 %>] 
/ ontrialend = values.valueA1=2 ]
</trial>


You cannot use values like that. The way to do this is to use the <trial> element's insertstimulustime() function like so:

<trial firsttrial>
/ ontrialbegin = [if (values.valueA == 1) trial.firsttrial.insertstimulustime(picture.man1, 0); ]
/ ontrialbegin = [if (values.valueA == 2) trial.firsttrial.insertstimulustime(picture.man2, 0); ]
...
/ ontrialend = [trial.firsttrial.resetstimulusframes(); values.valueA += 1]
</trial>

However, why don't you simply use the value for item *selection* in a <picture> element, i.e.

<picture man>
/ items = manitems
/ select = values.valueA
</picture>

<item manitems>
/ 1 = "man1.jpg"
/ 2 = "man2.jpg"
</item>

with

<trial firsttrial>
/ stimulustimes = [0=man]
/ ontrialend = [values.valueA += 1]
...
</trial>

Thank you for your quick response ! 

Sorry, I tried to simplify the problem to be able to explain what I meant so the problem is not as simple as I explained it to be. 

I think your first solution might still work though.
The problem is that I want to use that value in many different stimulustimes with the value constantly being updated. 

Here's part of the script: 

<values>
/ prev_health = 4
/ prev_approach = 1
/ prev_good = 1
</values>

<trial cdt3trialmanvekpos_vek> 
/ branch =[if(values.prev_approach==1 && values.prev_good==1) {trial.cdt3trialmanvekpos_vek1}if(values.prev_approach==0 && values.prev_good==1) {trial.cdt3trialmanvekpos_vek2}if(values.prev_approach==1 && values.prev_good==0) {trial.cdt3trialmanvekpos_vek3}if(values.prev_approach==0 && values.prev_good==0) {trial.cdt3trialmanvekpos_vek4}]
</trial>

<trial cdt3trialmanvekpos_vek1> 
/ pretrialpause = 100 
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>, hb, great1; 125 = man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health %>_1, hb, great1; 250= man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>_2, hb, great1;375= man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health+1 %>, hb, great1;500=man<% values.prev_health+1 %>_stand, healthbar<% values.prev_health+1 %>, hb; 750= man<% values.prev_health+1 %>_open1, healthbar<% values.prev_health+1 %>, hb; 1000= man<% values.prev_health+1 %>_open2, healthbar<% values.prev_health+1 %>, hb; 1250= man<% values.prev_health+1 %>_vekte, healthbar<% values.prev_health+1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek1.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek1.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek1.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek2> 
/ pretrialpause = 100 
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>, hb, great2; 125 = man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health %>_1, hb, great2; 250= man<% values.prev_health+1 %>_pos1, healthbar<% values.prev_health %>_2, hb, great2;375= man<% values.prev_health+1 %>_pos2, healthbar<% values.prev_health+1 %>, hb, great2;500=man<% values.prev_health+1 %>_stand, healthbar<% values.prev_health+1 %>, hb; 750= man<% values.prev_health+1 %>_open1, healthbar<% values.prev_health+1 %>, hb; 1000= man<% values.prev_health+1 %>_open2, healthbar<% values.prev_health+1 %>, hb; 1250= man<% values.prev_health+1 %>_vekte, healthbar<% values.prev_health+1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek2.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek2.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek2.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek3> 
/ pretrialpause = 100 
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health-1 %>_neg1, healthbar<% values.prev_health %>, hb, sick1; 125 = man<% values.prev_health-1 %>_neg2, healthbar<% values.prev_health %>_2, hb, sick1; 250= man<% values.prev_health-1 %>_neg3, healthbar<% values.prev_health %>_1, hb, sick1;375= man<% values.prev_health-1 %>_neg4, healthbar<% values.prev_health-1 %>, hb, sick1;500=man<% values.prev_health-1 %>_stand, healthbar<% values.prev_health-1 %>, hb; 750= man<% values.prev_health-1 %>_open1, healthbar<% values.prev_health-1 %>, hb; 1000= man<% values.prev_health-1 %>_open2, healthbar<% values.prev_health-1 %>, hb; 1250= man<% values.prev_health-1 %>_vekte, healthbar<% values.prev_health-1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek3.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek3.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek3.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek4> 
/ pretrialpause = 100 
/ validkeys = (200,208)
/ stimulustimes = [0=man<% values.prev_health-1 %>_neg1, healthbar<% values.prev_health %>, hb, sick2; 125 = man<% values.prev_health-1 %>_neg2, healthbar<% values.prev_health %>_2, hb, sick2; 250= man<% values.prev_health-1 %>_neg3, healthbar<% values.prev_health %>_1, hb, sick2;375= man<% values.prev_health-1 %>_neg4, healthbar<% values.prev_health-1 %>, hb, sick2;500=man<% values.prev_health-1 %>_stand, healthbar<% values.prev_health-1 %>, hb; 750= man<% values.prev_health-1 %>_open1, healthbar<% values.prev_health-1 %>, hb; 1000= man<% values.prev_health-1 %>_open2, healthbar<% values.prev_health-1 %>, hb; 1250= man<% values.prev_health-1 %>_vekte, healthbar<% values.prev_health-1 %>, hb]
/ branch = [if(cdt3trialmanvekpos_vek4.response==200) {trial.cdt3trialmanvekpos_vek_app} else {trial.cdt3trialmanvekpos_vek_av}]
/ beginresponsetime = 1250
/ ontrialend = [if (values.prev_good==1&&values.prev_health<7) {values.prev_health=values.prev_health+1} if (values.prev_good==0&&values.prev_health>1) {values.prev_health=values.prev_health-1}; if(cdt3trialmanvekpos_vek4.response==200){values.prev_approach=1} else {values.prev_approach=0};if(cdt3trialmanvekpos_vek4.response==200){values.prev_good=1} else {values.prev_good=0} ]
</trial>

<trial cdt3trialmanvekpos_vek_app> 
/ stimulustimes = [0=man<% values.prev_health %>_approachvekte1, healthbar<% values.prev_health %>, hb; 125=man<% values.prev_health+1 %>_approachvekte2, healthbar<% values.prev_health+1 %>, hb;250=man<% values.prev_health+1 %>_approachvekte3, healthbar<% values.prev_health+1 %>, hb;375=man<% values.prev_health+1 %>_approachvekte4, healthbar<% values.prev_health+1 %>, hb;500=man<% values.prev_health+1 %>_approachvekte5, healthbar<% values.prev_health+1 %>, hb;625=man<% values.prev_health+1 %>_approachvekte6, healthbar<% values.prev_health+1 %>, hb;750=man<% values.prev_health+1 %>_approachvekte7, healthbar<% values.prev_health+1 %>, hb]
/ posttrialpause = 100
/ responseinterrupt = trial
/ recorddata = false
/ timeout = 1000
</trial>

<trial cdt3trialmanvekpos_vek_av> 
/ stimulustimes = [0=man<% values.prev_health %>_avoidvekte1, healthbar<% values.prev_health %>, hb; 125=man<% values.prev_health+1 %>_avoidvekte2, healthbar<% values.prev_health+1 %>, hb;250=man<% values.prev_health+1 %>_avoidvekte3, healthbar<% values.prev_health+1 %>, hb;375=man<% values.prev_health+1 %>_avoidvekte4, healthbar<% values.prev_health+1 %>, hb;500=man<% values.prev_health+1 %>_avoidvekte5, healthbar<% values.prev_health+1 %>, hb;625=man<% values.prev_health+1 %>_avoidvekte6, healthbar<% values.prev_health+1 %>, hb;750=man<% values.prev_health+1 %>_avoidvekte7, healthbar<% values.prev_health+1 %>, hb]
/ posttrialpause = 100
/ responseinterrupt = trial
/ recorddata = false
/ timeout = 1000
</trial>


Note: this is only a small part of the trial elements that I have in the script (and of the stimuli).
So for that reason it would have been really easy to be able to use <% value %> but if it can't be done then I'll try to get it to work with the insertstimulustime attribute.

Thanks again, 

Pieter

As explained previously, you can't use values like that (in /stimulustimes).

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search