<ep>
<! Using mip cursoron and off and maybe clipcursor with feedback>
<id #keyboard> <vm desktop> <!branchdiagnostics> <cr>
<fd 20> <!default frame duration specifies how long each block in a pattern is displayed for>
<bgc 0,0,0> <dwc 255,255,255> <wfbo>
<2Did mouse checkoverlapping block1,.1,.2,.3,.4 block1,.1,.2,.3,.4  block2,.1,.2,.3,.4  block3,.1,.2,.3,.4  block4,.1,.2,.3,.4  block5,.1,.2,.3,.4  block6,.1,.2,.3,.4  block7,.1,.2,.3,.4  block8,.1,.2,.3,.4  block9,.1,.2,.3,.4> <!coords of buttons are dummys as we update them later>
<!2Did windowstouch checkoverlapping block1,.1,.2,.3,.4 block1,.1,.2,.3,.4  block2,.1,.2,.3,.4  block3,.1,.2,.3,.4  block4,.1,.2,.3,.4  block5,.1,.2,.3,.4  block6,.1,.2,.3,.4  block7,.1,.2,.3,.4  block8,.1,.2,.3,.4  block9,.1,.2,.3,.4> 
<inst hardmargin>
<eop> 
0 <inst .1, .1, .95> 
"This ", "is ", "a ", "corsi block tapping task. ", "It ", "should ", "be ", "run ", "with ", "the ", "Unicode ", "option ", "on ", "otherwise ", "the ", "target ", "boxes ", "won’t ", "be ", "squares ", "but ", "will ", "instead ", "be ", "vertical ", "bars ", "(|) ", "and ", "it ", "also ", "requires ", "DMDX ", "version ", "6.0.1.0.";
~1 <xyjustification center> 
<macro .hwb. 6> <! half the width of a block on the screen for hit detection * 100>
<macro .fm. 4> <! fontmultipliers to achieve said size when using ■ to draw a block>
<macro .mpx. 15> <! minimum proximity center to center of blocks * 100>;
!these generate the items that perform the task, the item number in .itm. will be the item that gathers RTs in the output, there will be more than one of them for the tasks where the number of blocks (.nb.) is more than one and they will ascend by one for each RT gathered;
!~1 <macro .itm. 100> <macro .nb. 1> <call 999>;
1 "Two blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 200> <macro .nb. 2> <call 999>;
1 "Two blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 210> <macro .nb. 2> <call 999>;
1 "Two blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 220> <macro .nb. 2> <call 999>;
1 "Three blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 300> <macro .nb. 3> <call 999>;
1 "Three blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 310> <macro .nb. 3> <call 999>;
1 "Three blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 320> <macro .nb. 3> <call 999>;
1 "Four blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 400> <macro .nb. 4> <call 999>;
1 "Four blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 410> <macro .nb. 4> <call 999>;
1 "Four blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 420> <macro .nb. 4> <call 999>;
1 "Five blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 500> <macro .nb. 5> <call 999>;
1 "Five blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 510> <macro .nb. 5> <call 999>;
1 "Five blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 520> <macro .nb. 5> <call 999>;
1 "Six blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 600> <macro .nb. 6> <call 999>;
1 "Six blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 610> <macro .nb. 6> <call 999>;
1 "Six blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 620> <macro .nb. 6> <call 999>;
1 "Seven blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 700> <macro .nb. 7> <call 999>;
1 "Seven blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 710> <macro .nb. 7> <call 999>;
1 "Seven blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 720> <macro .nb. 7> <call 999>;
1 "Eight blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 800> <macro .nb. 8> <call 999>;
1 "Eight blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 810> <macro .nb. 8> <call 999>;
1 "Eight blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 820> <macro .nb. 8> <call 999>;
1 "Nine blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 900> <macro .nb. 9> <call 999>;
1 "Nine blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 910> <macro .nb. 9> <call 999>;
1 "Nine blocks, Ready..." <msfd 500> / ;
~1 <macro .itm. 920> <macro .nb. 9> <call 999>;
0 "Done.” <lastframe>;

~999 <!so first up we'll put our blocks in a grid (screen pos * 100)> 
<set c100=25> <set c101=25>
<set c102=50> <set c103=25>
<set c104=75> <set c105=25>
<set c106=25> <set c107=50>
<set c108=50> <set c109=50>
<set c110=75> <set c111=50> 
<set c112=25> <set c113=75>
<set c114=50> <set c115=75>
<set c116=75> <set c117=75>
<set c1=12> <!number of deformation iterations, make it 2 when branchdiagnostics is on because this can take a while, otherwise 10 or so looks good>;
~1000 <set c2=0> <!counter for deforming each block>;
~1001 <macro set .nxi. = 100 + 2 * c2>
<macro set .nyi. = 101 + 2 * c2>;
~1 <macro set .nx. = c~.nxi. + (random 2 * ~.mpx.) - ~.mpx.>
<macro set .ny. = c~.nyi. + (random 2 * ~.mpx.) - ~.mpx.>;
~1 <bi 1100, ~.nx. .lt. ~.mpx. / 2> <!see if it’s off the screen>;
~1 <bi 1100, ~.ny. .lt. ~.mpx. / 2>;
~1 <bi 1100, ~.nx. .gt. 100 - ~.mpx. / 2>;
~1 <bi 1100, ~.ny. .gt. 100 - ~.mpx. / 2>;
~1 <set c3=0> <!see if it’s too close to any other block>;
~1010 <bi 1020, c2 .eq. c3>;
~1 <macro set .xi. = 100 + 2 * c3>
<macro set .yi. = 101 + 2 * c3>;
~1 <bi 1020, (abs ~.nx. – c~.xi.) .gt. ~.mpx.>; 
~1 <bi 1020, (abs ~.ny. – c~.yi.) .gt. ~.mpx.>;
~1 <bu 1100> <!too close to another block so discard this iteration>;
~1020 <inc c3> <bi -1010, c3 .lt. 9> <!keep looping till compared all blocks>;
~1 <set c~.nxi. = ~.nx.> <!doesn’t overlap so store new cords>
<set c~.nyi. = ~.ny.>;
~1100 <inc c2> <bi -1001, c2 .lt. 9> <!keep looping till deformed all blocks>;
~1 <dec c1> <bi -1000, c1 .gt. 0> <!keep deforming stuff but good>;	
~1 <!because xy can’t take counters gonna load all those in macros (not to mention being unable to represent numbers less than 1 with counters and having to put leading zeroes on integers less than 10, ho hum)>
<macro fxpset 2 .b1x. = c100> <macro fxpset 2 .b1y. = c101> 
<macro fxpset 2 .b2x. = c102> <macro fxpset 2 .b2y. = c103>
<macro fxpset 2 .b3x. = c104> <macro fxpset 2 .b3y. = c105> 
<macro fxpset 2 .b4x. = c106> <macro fxpset 2 .b4y. = c107>
<macro fxpset 2 .b5x. = c108> <macro fxpset 2 .b5y. = c109> 
<macro fxpset 2 .b6x. = c110> <macro fxpset 2 .b6y. = c111> 
<macro fxpset 2 .b7x. = c112> <macro fxpset 2 .b7y. = c113> 
<macro fxpset 2 .b8x. = c114> <macro fxpset 2 .b8y. = c115> 
<macro fxpset 2 .b9x. = c116> <macro fxpset 2 .b9y. = c117>
<set c120=0> <set c121=1> <set c122=2> <set c123=3> <set c124=4> <set c125=5> <set c126=6> <set c127=7> <set c128=8> <set c1=0>
<!this is our list of blocks to flash, next we shuffle it>;
~1200 <macro set i=120 + (random 9)> <macro set j=120 + c1>;
~1 <set c2=c~j> <set c~j = c~i> <set c~i = c2> <inc c1> <bi -1200, c1 .lt. 9>;
1 <!blank screen before> <mip cursoroff> / <set c1=0> <!next flash each block up to .nb.>;
~1300 <macro .wc1. 0,0,255> <macro .wc2. 0,0,255> <macro .wc3. 0,0,255> <macro .wc4. 0,0,255> <macro .wc5. 0,0,255> <macro .wc6. 0,0,255> <macro .wc7. 0,0,255> <macro .wc8. 0,0,255> <macro .wc9. 0,0,255> <macro set i = 120 + c1>;
~1 <set c2 = 1310 + c~i>;
~1 <ib c2> <!make our selected block yellow, all others already set blue>;
~1310  <macro .wc1. 255,255,0> <bu 1400>;
~1311  <macro .wc2. 255,255,0> <bu 1400>;
~1312  <macro .wc3. 255,255,0> <bu 1400>;
~1313  <macro .wc4. 255,255,0> <bu 1400>;
~1314  <macro .wc5. 255,255,0> <bu 1400>;
~1315  <macro .wc6. 255,255,0> <bu 1400>;
~1316  <macro .wc7. 255,255,0> <bu 1400>;
~1317  <macro .wc8. 255,255,0> <bu 1400>;
~1318  <macro .wc9. 255,255,0>;
1400 <dfm ~.fm. STAT> <wc ~.wc1.> <xy ~.b1x., ~.b1y.> "■", <wc ~.wc2.> <xy ~.b2x., ~.b2y.> "■", <wc ~.wc3.> <xy ~.b3x., ~.b3y.> "■", <wc ~.wc4.> <xy ~.b4x., ~.b4y.> "■", <wc ~.wc5.> <xy ~.b5x., ~.b5y.> "■", <wc ~.wc6.> <xy ~.b6x., ~.b6y.> "■", <wc ~.wc7.> <xy ~.b7x., ~.b7y.> "■", <wc ~.wc8.> <xy ~.b8x., ~.b8y.> "■", <wc ~.wc9.> <xy ~.b9x., ~.b9y.> "■" / !;
~1 <inc c1> <bi -1300, c1 .lt. ~.nb.> <!keep flashing the requested number of blocks>;
~1 <mip cursoron> <mip clipcursor .5,.5,.51,.51> <mip clipcursor 0,0,1,1>
<!branchdiagnostics> <set c1= 0> <!set the rects of blocks>; 
~1500 <macro set .nxi. = 100 + 2 * c1>
<macro set .nyi. = 101 + 2 * c1>;
~1 <!build macros for left, top, right, bottom rect>
<macro fxpset 2 l = c~.nxi. - ~.hwb.> <macro fxpset 2 t = c~.nyi. - ~.hwb.> 
<macro fxpset 2 r = c~.nxi. + ~.hwb.> <macro fxpset 2 b = c~.nyi. + ~.hwb.>
<macro set i=c1 + 1>;
~1 <sbr +block~i, ~l, ~t, ~r, ~b> <inc c1> <bi -1500, c1 .lt. 9> <!keep looping till updated all block rects>;
~1 <set c1 = 0> m.dly.++ m.co.+<co>+ <!use co/cco so we don’t miss a response between items as it’s a bit nebulous when an RT is appropriate> <macro .wc1. 0,0,255> <macro .wc2. 0,0,255> <macro .wc3. 0,0,255> <macro .wc4. 0,0,255> <macro .wc5. 0,0,255> <macro .wc6. 0,0,255> <macro .wc7. 0,0,255> <macro .wc8. 0,0,255> <macro .wc9. 0,0,255>  <!loop around .nb. times mapping correct response from c120..8>;
~1600 <umpr> <umnr> <macro set i=120 + c1> <set c2=0>;
~1610 <macro set b=c2 + 1>;
~1 <bi 1612, c~i .eq. c2>;
~1 <mnr +block~b> <bu 1613>;
~1612 <mpr +block~b>;
~1613 <inc c2> <bi -1610, c2 .lt. 9>;
+~.itm. ~.dly. <dfm ~.fm. STAT> <wc ~.wc1.> <xy ~.b1x., ~.b1y.> "■", <wc ~.wc2.> <xy ~.b2x., ~.b2y.> "■", <wc ~.wc3.> <xy ~.b3x., ~.b3y.> "■", <wc ~.wc4.> <xy ~.b4x., ~.b4y.> "■", <wc ~.wc5.> <xy ~.b5x., ~.b5y.> "■", <wc ~.wc6.> <xy ~.b6x., ~.b6y.> "■", <wc ~.wc7.> <xy ~.b7x., ~.b7y.> "■", <wc ~.wc8.> <xy ~.b8x., ~.b8y.> "■", <wc ~.wc9.> <xy ~.b9x., ~.b9y.> "■" <dfm 1.0> ~.co. <biw 1999>;
~1 <!provide some positive feedback by drawing the box yellow next time around> <macro set i=120 + c1> <set c2=0>;
~1710 <macro set b=c2 + 1>;
~1 <bi 1712, c~i .eq. c2>;
~1 <macro .wc~b. 0,0,255> <bu 1713>;
~1712 <macro .wc~b. 255,255,0>;
~1713 <inc c2> <bi -1710, c2 .lt. 9>;
~1 m.dly.+ <delay 2>+ m.co.+<cco>+ <macro yikwid> <macro set .itm. = ~.itm. + 1> <inc c1> <bi -1600, c1 .lt. ~.nb.> <!keep testing the requested number of blocks>;
1 <!if they got it right provide some closure by drawing the last box yellow> <delay 2> <dfm ~.fm. STAT> <wc ~.wc1.> <xy ~.b1x., ~.b1y.> "■", <wc ~.wc2.> <xy ~.b2x., ~.b2y.> "■", <wc ~.wc3.> <xy ~.b3x., ~.b3y.> "■", <wc ~.wc4.> <xy ~.b4x., ~.b4y.> "■", <wc ~.wc5.> <xy ~.b5x., ~.b5y.> "■", <wc ~.wc6.> <xy ~.b6x., ~.b6y.> "■", <wc ~.wc7.> <xy ~.b7x., ~.b7y.> "■", <wc ~.wc8.> <xy ~.b8x., ~.b8y.> "■", <wc ~.wc9.> <xy ~.b9x., ~.b9y.> "■" <dfm 1.0> / ;
~1999 <return> <branchdiagnostics 0>;

0 "oops...”;