Sequence with random start point


Author
Message
Nesard
Nesard
Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)
Group: Forum Members
Posts: 17, Visits: 153
Hi,


I need help creating a task that seems to be very complicated. I'd appreciate your help.

I need to create an experiment where there will be 4 circles in the screen, one after another from left to right. 3 of them will be white and 1 will be highlighted in red. Each circle will have a number assigned (1, 2 3 and 4). The subject has to press the number of the highlighted circle as fast as he can, and every time he does it right, the highlighted circle will change. If he does it wrong, he will hear a beep.

The sequence for the highlighted circles is this: 3-1-4-3-2-4-2-1-3-4-1. I need to run this sequence until the subject has complete 100 trials (1 trial = 1 successful attempt to press the correct number for the higlighted circle). Every 100 trials will be 1 block, and I need to run 12 blocks. Every time a block starts, i has to start at a random point in this sequence.

I hope it is clear what I need to do. Thanks!
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
This should give you the basic idea:

<values>
/ listposition = 1
/ correctcount = 0
/ trialcount = 0
/ highlight = 0
/ correctkey = 0
</values>

<expt>
/ blocks = [1-12 = circleblock]
</expt>


<block circleblock>
/ preinstructions = (start)
/ screencolor = black
/ stop = [values.correctcount==100]
/ onblockbegin = [values.correctcount=0; values.trialcount=0;
    values.listposition = list.startposition.nextindex-1; ]
/ trials = [1=circletrial]
</block>

<trial circletrial>
/ ontrialbegin = [shape.c1.color=white; shape.c2.color=white; shape.c3.color=white; shape.c4.color=white; ]
/ ontrialbegin = [if (trial.circletrial.correct || values.trialcount<=0) {values.listposition+=1; values.listposition = mod(values.listposition-1,11)+1;
    values.highlight=list.circlesequence.nextvalue; }
    ]
/ ontrialbegin = [if (values.highlight==1) {values.correctkey=2; shape.c1.color=red; }
    else if (values.highlight==2) {values.correctkey=3; shape.c2.color=red; }
    else if (values.highlight==3) {values.correctkey=4; shape.c3.color=red; }
    else if (values.highlight==4) {values.correctkey=5; shape.c4.color=red; }
    ]
/ ontrialend = [values.trialcount+=1; values.correctcount+=trial.circletrial.correct; ]
/ stimulusframes = [1=c1, c2, c3, c4, debug]
/ validresponse = (2,3,4,5)
/ iscorrectresponse = [trial.circletrial.response==values.correctkey]
/ branch = [trial.circletrial]
/ errormessage = (systembeep, 200)
</trial>


<list startposition>
/ poolsize = 11
/ selectionmode = random
/ replace = true
</list>

<list circlesequence>
/ items = (3,1,4,3,2,4,2,1,3,4,1)
/ selectionmode = values.listposition
</list>

<shape c1>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ color = white
/ erase = false
</shape>

<shape c2>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ color = white
/ erase = false
</shape>

<shape c3>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ color = white
/ erase = false
</shape>

<shape c4>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ color = white
/ erase = false
</shape>

<text debug>
/ items = ("position=<%values.listposition%> | highlight=<%values.highlight%> | trialcount=<%values.trialcount%> | correctcount=<%values.correctcount%>")
/ position = (50%, 10%)
/ erase = false
/ txcolor = red
/ txbgcolor = black
/ size = (50%, 10%)
</text>

<page start>
^start of new block
</page>


Nesard
Nesard
Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)
Group: Forum Members
Posts: 17, Visits: 153
Awsome, thanks!!
Nesard
Nesard
Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)
Group: Forum Members
Posts: 17, Visits: 153
Hi,

I've been trying to complete my experiment with the code you gave me, but I haven't be able to do some things, I'd appreciate if you can point in the right path:

- Put an X inside the highlighted circle
- Change the 1, 2, 3, 4 keys for the V, B, N, M keys.
- Show latency after each block.
- Show percentage errors after each block
- Set an 250 ms interval between the final of each trial and the beginning of the next one.

Thanks.
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
Actually, the required changes are pretty minimal:

<values>
/ listposition = 1
/ correctcount = 0
/ trialcount = 0
/ highlight = 0
/ correctkey = 0
/ x1 = 1
/ x2 = 1
/ x3 = 1
/ x4 = 1
</values>

<expt>
/ blocks = [1-12 = circleblock]
</expt>


<block circleblock>
/ preinstructions = (start)
/ postinstructions = (end)
/ screencolor = black
/ stop = [values.correctcount==10]
/ onblockbegin = [values.correctcount=0; values.trialcount=0;
    values.listposition = list.startposition.nextindex-1; ]
/ trials = [1=circletrial]
</block>

<trial circletrial>
/ ontrialbegin = [shape.c1.color=white; shape.c2.color=white; shape.c3.color=white; shape.c4.color=white;
    values.x1=1; values.x2=1; values.x3=1; values.x4=1; ]
/ ontrialbegin = [if (trial.circletrial.correct || values.trialcount<=0) {values.listposition+=1; values.listposition = mod(values.listposition-1,11)+1;
    values.highlight=list.circlesequence.nextvalue; }
    ]
/ ontrialbegin = [if (values.highlight==1) {values.correctkey=47; shape.c1.color=red; values.x1=2; }
    else if (values.highlight==2) {values.correctkey=48; shape.c2.color=red; values.x2=2; }
    else if (values.highlight==3) {values.correctkey=49; shape.c3.color=red; values.x3=2; }
    else if (values.highlight==4) {values.correctkey=50; shape.c4.color=red; values.x4=2;}
    ]
/ ontrialend = [values.trialcount+=1; values.correctcount+=trial.circletrial.correct; ]
/ stimulusframes = [1=c1, c2, c3, c4 x1, x2, x3, x4, debug]
/ validresponse = (47,48,49,50)
/ iscorrectresponse = [trial.circletrial.response==values.correctkey]
/ branch = [if(trial.circletrial.correct) trial.iti else trial.circletrial]
/ errormessage = (systembeep, 200)
</trial>

<trial iti>
/ stimulusframes = [1=blankscreen]
/ trialduration = 250
/ validresponse = (0)
/ recorddata = false
/ branch = [trial.circletrial]
</trial>

<shape blankscreen>
/ color = black
/ shape = rectangle
/ erase = false
/ size = (100%, 100%)
</shape>


<list startposition>
/ poolsize = 11
/ selectionmode = random
/ replace = true
</list>

<list circlesequence>
/ items = (3,1,4,3,2,4,2,1,3,4,1)
/ selectionmode = values.listposition
</list>

<shape c1>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ color = white
/ erase = false
</shape>

<shape c2>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ color = white
/ erase = false
</shape>

<shape c3>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ color = white
/ erase = false
</shape>

<shape c4>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ color = white
/ erase = false
</shape>

<text x1>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ select = values.x1
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x2>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ select = values.x2
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x3>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ select = values.x3
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x4>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ select = values.x4
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text debug>
/ items = ("position=<%values.listposition%> | highlight=<%values.highlight%> | trialcount=<%values.trialcount%> | correctcount=<%values.correctcount%>")
/ position = (50%, 10%)
/ erase = false
/ txcolor = red
/ txbgcolor = black
/ size = (50%, 10%)
</text>

<page start>
^start of new block
</page>

<page end>
^end of block
^stats:
^mean latency: <%trial.circletrial.meanlatency%> ms
^error rate: <%(1-(values.correctcount/values.trialcount))*100%> %
</page>


Nesard
Nesard
Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)
Group: Forum Members
Posts: 17, Visits: 153
Hi,

Based on your response I've been trying to make the second part of the experiment, but I'm having some troubles. I'd apprecciate if you can help me.

I need to use the sequence  4,3,1,2,4,1,3,2,1,4,2,3 to create 24 blocks. Each block should have 6 consecutive items of this sequence (each item is a number of this sequence, and each number of this sequence is the position of the X on the rectangles in the screen, as discussed in my last post). The first block should start in the position 1 of the sequence and end in position 6, the second block in the position 2 of the sequence and end in position 7, and so on. So the first 8 blocks would look like this:

Block1: 4,3,1,2,4,1
Block2: 3,1,2,4,1,3
Block3: 1,2,4,1,3,2
Block4: 2,4,1,3,2,1
Block5: 4,1,3,2,1,4
Block6: 1,3,2,1,4,2
Block6: 3,2,1,4,2,3
Block7: 2,1,4,2,3,4
Block8: 1,4,2,3,4,3

Then, I need to show this 24 blocks in random order. Could you tell me how can I do this?
Thanks.







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
Adjust <list startposition> accordingly:

<values>
/ listposition = 1
/ correctcount = 0
/ trialcount = 0
/ highlight = 0
/ correctkey = 0
/ x1 = 1
/ x2 = 1
/ x3 = 1
/ x4 = 1
</values>

<expt>
/ blocks = [1-24 = circleblock]
</expt>


<block circleblock>
/ preinstructions = (start)
/ postinstructions = (end)
/ screencolor = black
/ stop = [values.correctcount==6]
/ onblockbegin = [values.correctcount=0; values.trialcount=0;
    values.listposition = list.startposition.nextindex-1; ]
/ trials = [1=circletrial]
</block>

<trial circletrial>
/ ontrialbegin = [shape.c1.color=white; shape.c2.color=white; shape.c3.color=white; shape.c4.color=white;
    values.x1=1; values.x2=1; values.x3=1; values.x4=1; ]
/ ontrialbegin = [if (trial.circletrial.correct || values.trialcount<=0) {values.listposition+=1; values.listposition = mod(values.listposition-1,12)+1;
    values.highlight=list.circlesequence.nextvalue; }
    ]
/ ontrialbegin = [if (values.highlight==1) {values.correctkey=47; shape.c1.color=red; values.x1=2; }
    else if (values.highlight==2) {values.correctkey=48; shape.c2.color=red; values.x2=2; }
    else if (values.highlight==3) {values.correctkey=49; shape.c3.color=red; values.x3=2; }
    else if (values.highlight==4) {values.correctkey=50; shape.c4.color=red; values.x4=2;}
    ]
/ ontrialend = [values.trialcount+=1; values.correctcount+=trial.circletrial.correct; ]
/ stimulusframes = [1=c1, c2, c3, c4 x1, x2, x3, x4, debug]
/ validresponse = (47,48,49,50)
/ iscorrectresponse = [trial.circletrial.response==values.correctkey]
/ branch = [if(trial.circletrial.correct) trial.iti else trial.circletrial]
/ errormessage = (systembeep, 200)
</trial>

<trial iti>
/ stimulusframes = [1=blankscreen]
/ trialduration = 250
/ validresponse = (0)
/ recorddata = false
/ branch = [trial.circletrial]
</trial>

<shape blankscreen>
/ color = black
/ shape = rectangle
/ erase = false
/ size = (100%, 100%)
</shape>

<list startposition>
/ poolsize = 12
/ selectionmode = sequence
</list>


<list circlesequence>
/ items = (4,3,1,2,4,1,3,2,1,4,2,3)
/ selectionmode = values.listposition
</list>

<shape c1>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ color = white
/ erase = false
</shape>

<shape c2>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ color = white
/ erase = false
</shape>

<shape c3>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ color = white
/ erase = false
</shape>

<shape c4>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ color = white
/ erase = false
</shape>

<text x1>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ select = values.x1
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x2>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ select = values.x2
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x3>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ select = values.x3
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x4>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ select = values.x4
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text debug>
/ items = ("position=<%values.listposition%> | highlight=<%values.highlight%> | trialcount=<%values.trialcount%> | correctcount=<%values.correctcount%>")
/ position = (50%, 10%)
/ erase = false
/ txcolor = red
/ txbgcolor = black
/ size = (50%, 10%)
</text>

<page start>
^start of new block
</page>

<page end>
^end of block
^stats:
^mean latency: <%trial.circletrial.meanlatency%> ms
^error rate: <%(1-(values.correctcount/values.trialcount))*100%> %
</page>

Finally,

> "I need to show this 24 blocks in random order."

 doesn't make sense in light of that fact that you previously state you want start positions to be selected *sequentially*

> "The first block should start in the position 1 of the sequence and end in position 6, the second block in the position 2 of the sequence
> and end in position 7, and so on."

The selection cannot be both sequential and random at the same time. So what is it supposed to be?

FWIW, if you want to sample the start positions *randomly* such that you get startposition 1 twice across 24 blocks, startposition 2 twice across 24 blocks, etc. in random order, change <list startposition> to

<list startposition>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12)
/ selectionmode = random
/ replace = false
</list>

and

<block circleblock>
/ preinstructions = (start)
/ postinstructions = (end)
/ screencolor = black
/ stop = [values.correctcount==6]
/ onblockbegin = [values.correctcount=0; values.trialcount=0;
    values.listposition = list.startposition.nextvalue-1; ]
/ trials = [1=circletrial]
</block>

[NOTE: POST EDITED TO MAKE TWO MINOR CORRECTIONS TO THE CODE]

Edited 9 Years Ago by Dave
Nesard
Nesard
Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)
Group: Forum Members
Posts: 17, Visits: 153
Hi,

I have a code you gave me a few months ago and I need to modify it. This code has 24 blocks. Each block shows a 6-item sequence. These blocks are based on the 12-items sequence that is defined on the  <list circlesequence>. I need to modify the code this way:
1. It should use two sequences, not just one. Sequence 1 is the one that is already there in <list circlesequence> (4,3,1,2,4,1,3,2,1,4,2,3) and Sequence 2 should be 3,1,2,3,2,4,1,2,1,4,3,2.
2. 12 blocks should be based on Sequence 1 and another 12 blocks should be based on Sequence 2.
3. Blocks should be showed randomly. That is, no more than 3 blocks based on Sequence 1 or Sequence 2 should be appear in a row.

This is the code I have:

<values>
/ listposition = 1
/ correctcount = 0
/ trialcount = 0
/ highlight = 0
/ correctkey = 0
/ x1 = 1
/ x2 = 1
/ x3 = 1
/ x4 = 1
</values>

<expt>
/ blocks = [1-24 = circleblock]
</expt>

<block circleblock>
/ preinstructions = (start)
/ postinstructions = (end)
/ screencolor = black
/ stop = [values.correctcount==6]
/ onblockbegin = [values.correctcount=0; values.trialcount=0;
  values.listposition = list.startposition.nextvalue-1; ]
/ trials = [1=circletrial]
</block>

<trial circletrial>
/ ontrialbegin = [shape.c1.color=white; shape.c2.color=white; shape.c3.color=white; shape.c4.color=white;
  values.x1=1; values.x2=1; values.x3=1; values.x4=1; ]
/ ontrialbegin = [if (trial.circletrial.correct || values.trialcount<=0) {values.listposition+=1; values.listposition = mod(values.listposition-1,12)+1;
  values.highlight=list.circlesequence.nextvalue; }
  ]
/ ontrialbegin = [if (values.highlight==1) {values.correctkey=47; shape.c1.color=red; values.x1=2; }
  else if (values.highlight==2) {values.correctkey=48; shape.c2.color=red; values.x2=2; }
  else if (values.highlight==3) {values.correctkey=49; shape.c3.color=red; values.x3=2; }
  else if (values.highlight==4) {values.correctkey=50; shape.c4.color=red; values.x4=2;}
  ]
/ ontrialend = [values.trialcount+=1; values.correctcount+=trial.circletrial.correct; ]
/ stimulusframes = [1=c1, c2, c3, c4 x1, x2, x3, x4, debug]
/ validresponse = (47,48,49,50)
/ iscorrectresponse = [trial.circletrial.response==values.correctkey]
/ branch = [if(trial.circletrial.correct) trial.iti else trial.circletrial]
/ errormessage = (systembeep, 200)
</trial>

<trial iti>
/ stimulusframes = [1=blankscreen]
/ trialduration = 250
/ validresponse = (0)
/ recorddata = false
/ branch = [trial.circletrial]
</trial>

<shape blankscreen>
/ color = black
/ shape = rectangle
/ erase = false
/ size = (100%, 100%)
</shape>

<list startposition>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12)
/ selectionmode = random
/ replace = false
</list>

<list circlesequence>
/ items = (4,3,1,2,4,1,3,2,1,4,2,3)
/ selectionmode = values.listposition
</list>

<shape c1>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ color = white
/ erase = false
</shape>

<shape c2>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ color = white
/ erase = false
</shape>

<shape c3>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ color = white
/ erase = false
</shape>

<shape c4>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ color = white
/ erase = false
</shape>

<text x1>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ select = values.x1
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x2>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ select = values.x2
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x3>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ select = values.x3
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x4>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ select = values.x4
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text debug>
/ items = ("position=<%values.listposition%> | highlight=<%values.highlight%> | trialcount=<%values.trialcount%> | correctcount=<%values.correctcount%>")
/ position = (50%, 10%)
/ erase = false
/ txcolor = red
/ txbgcolor = black
/ size = (50%, 10%)
</text>

<page start>
^start of new block
</page>

<page end>
^end of block
^stats:
^mean latency: <%trial.circletrial.meanlatency%> ms
^error rate: <%(1-(values.correctcount/values.trialcount))*100%> %

Thanks!!
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
<values>
/ sequencenumber = 0
/ listposition = 1
/ correctcount = 0
/ trialcount = 0
/ highlight = 0
/ correctkey = 0
/ x1 = 1
/ x2 = 1
/ x3 = 1
/ x4 = 1
</values>

<expt>
/ blocks = [1-24 = circleblock]
</expt>

<block circleblock>
/ preinstructions = (start)
/ postinstructions = (end)
/ screencolor = black
/ stop = [values.correctcount==6]
/ onblockbegin = [values.sequencenumber = list.sequencetype.nextvalue; ]
/ onblockbegin = [values.correctcount=0; values.trialcount=0;
  values.listposition = list.startposition.nextvalue-1; ]
/ trials = [1=circletrial]
</block>

<trial circletrial>
/ ontrialbegin = [shape.c1.color=white; shape.c2.color=white; shape.c3.color=white; shape.c4.color=white;
  values.x1=1; values.x2=1; values.x3=1; values.x4=1; ]
/ ontrialbegin = [if (trial.circletrial.correct || values.trialcount<=0) {values.listposition+=1; values.listposition = mod(values.listposition-1,12)+1;
  values.highlight=list.circlesequence.nextvalue; }
  ]
/ ontrialbegin = [if (values.highlight==1) {values.correctkey=47; shape.c1.color=red; values.x1=2; }
  else if (values.highlight==2) {values.correctkey=48; shape.c2.color=red; values.x2=2; }
  else if (values.highlight==3) {values.correctkey=49; shape.c3.color=red; values.x3=2; }
  else if (values.highlight==4) {values.correctkey=50; shape.c4.color=red; values.x4=2;}
  ]
/ ontrialend = [values.trialcount+=1; values.correctcount+=trial.circletrial.correct; ]
/ stimulusframes = [1=c1, c2, c3, c4 x1, x2, x3, x4, debug]
/ validresponse = (47,48,49,50)
/ iscorrectresponse = [trial.circletrial.response==values.correctkey]
/ branch = [if(trial.circletrial.correct) trial.iti else trial.circletrial]
/ errormessage = (systembeep, 200)
</trial>

<trial iti>
/ stimulusframes = [1=blankscreen]
/ trialduration = 250
/ validresponse = (0)
/ recorddata = false
/ branch = [trial.circletrial]
</trial>

<shape blankscreen>
/ color = black
/ shape = rectangle
/ erase = false
/ size = (100%, 100%)
</shape>

<list startposition>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12)
/ selectionmode = random
/ replace = false
</list>

<list sequencetype>
/ items = (1,2)
/ poolsize = 24
/ maxrunsize = 3
</list>


<list circlesequence>
/ items = (list.circlesequence_1.nextvalue, list.circlesequence_2.nextvalue)
/ selectionmode = values.sequencenumber
</list>


<list circlesequence_1>
/ items = (4,3,1,2,4,1,3,2,1,4,2,3)
/ selectionmode = values.listposition
</list>

<list circlesequence_2>
/ items = (3,1,2,3,2,4,1,2,1,4,3,2)
/ selectionmode = values.listposition
</list>


<shape c1>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ color = white
/ erase = false
</shape>

<shape c2>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ color = white
/ erase = false
</shape>

<shape c3>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ color = white
/ erase = false
</shape>

<shape c4>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ color = white
/ erase = false
</shape>

<text x1>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ select = values.x1
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x2>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ select = values.x2
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x3>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ select = values.x3
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x4>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ select = values.x4
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text debug>
/ items = ("sequence #= <%values.sequencenumber%> | position=<%values.listposition%> | highlight=<%values.highlight%> | trialcount=<%values.trialcount%> | correctcount=<%values.correctcount%>")
/ position = (50%, 10%)
/ erase = false
/ txcolor = red
/ txbgcolor = black
/ size = (50%, 10%)
</text>

<page start>
^start of new block
</page>

<page end>
^end of block
^stats:
^mean latency: <%trial.circletrial.meanlatency%> ms
^error rate: <%(1-(values.correctcount/values.trialcount))*100%> %
</page>
Nesard
Nesard
Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)Esteemed Member (2.4K reputation)
Group: Forum Members
Posts: 17, Visits: 153
Hi,

I need to put two Likert questions at the end of each <block circleblock>. The questions are <likert ratingquestionA> and <likert ratingquestionB>. Bellow is the code with the modifications I've made but haven't be able to get it working. Could you please help me?

Thanks.

<values>
/ sequencenumber = 0
/ listposition = 1
/ correctcount = 0
/ trialcount = 0
/ highlight = 0
/ correctkey = 0
/ x1 = 1
/ x2 = 1
/ x3 = 1
/ x4 = 1
</values>

<expt>
/ blocks = [1-24 = circleblock]
</expt>

<block circleblock>
/ preinstructions = (start)
/ postinstructions = (end)
/ screencolor = black
/ stop = [values.correctcount==6]
/ onblockbegin = [values.sequencenumber = list.sequencetype.nextvalue; ]
/ onblockbegin = [values.correctcount=0; values.trialcount=0;
values.listposition = list.startposition.nextvalue-1; ]
/ trials = [1 = circletrial; 2 = ratingquestionA; 3 = ratingquestionB]
</block>

//Likert
<likert ratingquestionA>
/ anchors = [1="NUEVA"; 2="VIEJA"]
/ stimulusframes = [1 = likertP1]
/ mouse=true
/ numpoints=2
/ position= (50, 80)
/ fontstyle = ("Arial", 16px)
</likert>

<likert ratingquestionB>
/ anchors = [1="MUY SEGURO"; 2="RELATIVAMENTE SEGURO"; 3="SUPONGO"]
/ stimulusframes = [1 = likertP2]
/ mouse=true
/ numpoints=3
/ position= (50, 80)
/ fontstyle = ("Arial", 16px)
</likert>

<text likertP1>
/size = (500, 70)
/items = likertP1
/position = (50, 50)
/halign = center
/select = sequence
</text>

<text likertP2>
/size = (500, 70)
/items = likertP2
/position = (50, 50)
/halign = center
/select = sequence
</text>

<item likertP1>
/1 = "Piensas que la secuencia que acabas de ver es..."
</item>

<item likertP2>
/1 = "¿Qué tan seguro estás de tu respuesta?"
</item>
//END LIKERT


<trial circletrial>
/ ontrialbegin = [shape.c1.color=white; shape.c2.color=white; shape.c3.color=white; shape.c4.color=white;
values.x1=1; values.x2=1; values.x3=1; values.x4=1; ]
/ ontrialbegin = [if (trial.circletrial.correct || values.trialcount<=0) {values.listposition+=1; values.listposition = mod(values.listposition-1,12)+1;
values.highlight=list.circlesequence.nextvalue; }
]
/ ontrialbegin = [if (values.highlight==1) {values.correctkey=47; shape.c1.color=red; values.x1=2; }
else if (values.highlight==2) {values.correctkey=48; shape.c2.color=red; values.x2=2; }
else if (values.highlight==3) {values.correctkey=49; shape.c3.color=red; values.x3=2; }
else if (values.highlight==4) {values.correctkey=50; shape.c4.color=red; values.x4=2;}
]
/ ontrialend = [values.trialcount+=1; values.correctcount+=trial.circletrial.correct; ]
/ stimulusframes = [1=c1, c2, c3, c4 x1, x2, x3, x4, debug]
/ validresponse = (47,48,49,50)
/ iscorrectresponse = [trial.circletrial.response==values.correctkey]
/ branch = [if(trial.circletrial.correct) trial.iti else trial.circletrial]
/ errormessage = (systembeep, 200)
</trial>

<trial iti>
/ stimulusframes = [1=blankscreen]
/ trialduration = 250
/ validresponse = (0)
/ recorddata = false
/ branch = [trial.circletrial]
</trial>

<shape blankscreen>
/ color = black
/ shape = rectangle
/ erase = false
/ size = (100%, 100%)
</shape>

<list startposition>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12)
/ selectionmode = random
/ replace = false
</list>

<list sequencetype>
/ items = (1,2)
/ poolsize = 24
/ maxrunsize = 3
</list>

<list circlesequence>
/ items = (list.circlesequence_1.nextvalue, list.circlesequence_2.nextvalue)
/ selectionmode = values.sequencenumber
</list>

<list circlesequence_1>
/ items = (3,1,4,3,2,4,2,1,3,4,1,2)
/ selectionmode = values.listposition
</list>

<list circlesequence_2>
/ items = (4,3,1,2,4,1,3,2,1,4,2,3)
/ selectionmode = values.listposition
</list>

<shape c1>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ color = white
/ erase = false
</shape>

<shape c2>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ color = white
/ erase = false
</shape>

<shape c3>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ color = white
/ erase = false
</shape>

<shape c4>
/ shape = circle
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ color = white
/ erase = false
</shape>

<text x1>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (20%, 50%)
/ select = values.x1
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x2>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (40%, 50%)
/ select = values.x2
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x3>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (60%, 50%)
/ select = values.x3
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text x4>
/ items = (" ", "X")
/ size = (10%, 0.10*display.width)
/ position = (80%, 50%)
/ select = values.x4
/ txcolor = white
/ txbgcolor = transparent
/ erase = false
/ hjustify = center
/ vjustify = center
</text>

<text debug>
/ items = ("sequence #= <%values.sequencenumber%> | position=<%values.listposition%> | highlight=<%values.highlight%> | trialcount=<%values.trialcount%> | correctcount=<%values.correctcount%>")
/ position = (50%, 10%)
/ erase = false
/ txcolor = red
/ txbgcolor = black
/ size = (50%, 10%)
</text>

<page start>
^start of new block
</page>

<page end>
^end of block
^stats:
^mean latency: <%trial.circletrial.meanlatency%> ms
^error rate: <%(1-(values.correctcount/values.trialcount))*100%> %
</page>


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search