Millisecond Forums

Picking trial layout based on random variable

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

By nashby - 7/15/2013

Hello so I am trying to get the stimulus frames in a trial to change dependent on the value of a randomly drawn number. Below should convey what I am trying to do although its clear the code is wrong ( I have tried multiple versions of below with no luck).



Thanks in advance of any help.



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




/ stimulusframes = [1= option1, option2, option1t, option2t, option1b, option2b, option1o, option1bo, option2o, option2bo, totals, outcomes, selectinstructions], if values.side <= 50

else

{1= option1, option2, option1k, option2k, option1bk, option2bk, option1ok, option1bok, option2ok, option2bok, totals, outcomes, selectinstructions;}]

By Dave - 7/15/2013

You can't do this in the /stimulusframes attribute directly. Instead you need to work with the setstimulusframe and/or insertstimulusframe function(s). Details are available in the documentation.


However, it might be way easier to simply use different <trial> elements.


Edit: Here's a quick, basic example:


<values>
/ myvalue = 1
</values>

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [if(values.myvalue==1){
    trial.mytrial.insertstimulusframe(text.b1,1);
    } else {
    trial.mytrial.insertstimulusframe(text.b2,1);
    }]
/ stimulustimes = [0=a,c]
/ ontrialend = [trial.mytrial.resetstimulusframes()]
/ validresponse = (57)
</trial>

<text a>
/ items = ("A")
/ position = (25%, 50%)
</text>

<text b1>
/ items = ("B1")
/ position = (50%, 50%)
</text>

<text b2>
/ items = ("B2")
/ position = (50%, 50%)
</text>

<text c>
/ items = ("C")
/ position = (75%, 50%)
</text>

By nashby - 7/16/2013

Thanks, used set stimulus frames and that works.