Millisecond Forums

Conditions going off when script run from the website

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

By Zooahh - 2/4/2015

Hi,

I set up a Simon task experiment and everything is perfectly fine in terms of number of conditions,etc...when I run the task on my computer. 

In more details, I am supposed to have:
-40 incongruent trials: 20 of condition 1 and 20 of condition 4
-40 congruent trials: 20 of condition 2 and 20 of condition 3
-40 neutral trials: 20 of condition 5 and 20 of condition 6

But once I upload the script on the website and run it from the website, the number of conditions go off. For example, I get 40 incongruent trials but 18 of condition 1 and 22 of condition 4...
I really don't know the reason for that, so here is the script of the task I set up:

<defaults>
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Cambria", 3.5%, false)
/canvasaspectratio = (4,3)
/ screencolor = (white)
</defaults>

<data>
/file = "Simon_rawdata.iqdat"
/ columns = [date time subject blockcode blocknum trialcode trialnum response values.cresp values.stimtype latency correct numcorrect percentcorrect meanlatency stimulusonset
script.elapsedtime]
/ separatefiles = true
</data>


<values>
/ cresp = 0
/ stimtype = 0
/fontsize_fixation = 8%
</values>

<expt>
/ preinstructions = (intro01)
/ postinstructions = (end)
/ blocks = [1=simonpracticeblock; 2=simontestblock]
</expt>


<block simonpracticeblock>
/ trials = [1-12=noreplace(congruenttrial,incongruenttrial, neutraltrial)]
/ errormessage = (errormessage, 500)
/ correctmessage = (correctmessage, 500)
/ bgstim = (leftinstruct,rightinstruct)
</block>

<block simontestblock>
/ preinstructions = (test)
/ trials = [1-120=noreplace(congruenttrial,incongruenttrial,neutraltrial)]
</block>

<text leftinstruct>
/ items = ("Z = UP")
/ hposition = 15
/ vposition = 95
/ fontstyle = ("Cambria", 3.00%, true)
/ erase = false
</text>

<text rightinstruct>
/ items= ("M = DOWN")
/ hposition = 85
/ vposition = 95
/ fontstyle = ("Cambria", 3.00%, true)
/ erase = false
</text>

<trial congruenttrial>
/ ontrialbegin = [if(script.currentblock=="practiceblock")
{
values.stimtype=counter.pcongruentstimtype.selectedvalue;
values.cresp=counter.pcongruentcresp.selectedvalue;
}
else
{
values.stimtype=counter.congruentstimtype.selectedvalue;
values.cresp=counter.congruentcresp.selectedvalue;
}]
/ posttrialpause = 500
/ stimulustimes = [0=fixation, leftinstruct,rightinstruct;500=blank, leftinstruct,rightinstruct; 1000=stimulus, leftinstruct, rightinstruct]
/ responsetime = 1000
/ validresponse = (anyresponse)
/ iscorrectresponse = [trial.congruenttrial.response==values.cresp]
</trial>

<trial incongruenttrial>
/ ontrialbegin = [if(script.currentblock=="practiceblock")
{
values.stimtype=counter.pincongruentstimtype.selectedvalue;
values.cresp=counter.pincongruentcresp.selectedvalue;
}
else
{
values.stimtype=counter.incongruentstimtype.selectedvalue;
values.cresp=counter.incongruentcresp.selectedvalue;
}]
/ posttrialpause = 500
/ stimulustimes = [0=fixation, leftinstruct,rightinstruct; 500=blank, leftinstruct,rightinstruct; 1000=stimulus, leftinstruct, rightinstruct]
/ responsetime = 1000
/ validresponse = (anyresponse)
/ iscorrectresponse = [trial.incongruenttrial.response==values.cresp]
</trial>

<trial neutraltrial>
/ ontrialbegin = [if(script.currentblock=="practiceblock")
{
values.stimtype=counter.pneutralstimtype.selectedvalue;
values.cresp=counter.pneutralcresp.selectedvalue;
}
else
{
values.stimtype=counter.neutralstimtype.selectedvalue;
values.cresp=counter.neutralcresp.selectedvalue;
}]
/ posttrialpause = 500
/ stimulustimes = [0=fixation, leftinstruct,rightinstruct; 500=blank, leftinstruct,rightinstruct; 1000=stimulus, leftinstruct, rightinstruct]
/ responsetime = 1000
/ validresponse = (anyresponse)
/ iscorrectresponse = [trial.neutraltrial.response==values.cresp]
</trial>

<text fixation>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", values.fontsize_fixation, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
/ erase = true (white)
</text>

<shape blank>
/ shape = rectangle
/ color = (white)
/ position = (50%,50%)
/ size = (100%,100%)
/ erase = false
</shape>

<picture stimulus>
/ items = stimitems
/ select = values.stimtype
/ erase = true(white)
</picture>


<item stimitems>
/ 1 = "LD_Arrowb.BMP"
/ 2 = "LU_Arrowb.BMP"
/ 3 = "RD_Arrowb.BMP"
/ 4 = "RU_Arrowb.BMP"
/ 5 = "MD_Arrowb.BMP"
/ 6 = "MU_Arrowb.BMP"
</item>

<text errormessage>
/ items = (" ERROR ")
/ txcolor = (255,0,0)
</text>

<text correctmessage>
/ items = (" CORRECT ")
/ txcolor = (0,255,0)
</text>

<counter congruentstimtype>
/ items = (2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3)
/ select = noreplace
/ selectionrate = trial
</counter>

<counter congruentcresp>
/ items = (44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50)
/ select = current(congruentstimtype)
</counter>

<counter pcongruentstimtype>
/ items = (2,3)
/ select = noreplace
/ selectionrate = trial
</counter>

<counter pcongruentcresp>
/ items = (44,50)
/ select = current(pcongruentstimtype)
</counter>

<counter incongruentstimtype>
/ items = (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4)
/ select = noreplace
/ selectionrate = trial
</counter>

<counter incongruentcresp>
/ items = (50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44)
/ select = current(incongruentstimtype)
</counter>

<counter pincongruentstimtype>
/ items = (1,4)
/ select = noreplace
/ selectionrate = trial
</counter>

<counter pincongruentcresp>
/ items = (50,44)
/ select = current(pincongruentstimtype)
</counter>

<counter neutralstimtype>
/ items = (5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6)
/ select = noreplace
/ selectionrate = trial
</counter>

<counter neutralcresp>
/ items = (50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44)
/ select = current(neutralstimtype)
</counter>

<counter pneutralstimtype>
/ items = (5,6)
/ select = noreplace
/ selectionrate = trial
</counter>

<counter pneutralcresp>
/ items = (50,44)
/ select = current(pneutralstimtype)
</counter>

<instruct>
/windowsize = (90%, 90%)
/finishlabel = "<SPACEBAR> to start"
/nextkey = (57)
/prevkey = (28)
/prevlabel = "<ENTER> to go back"
/nextlabel = "<SPACEBAR> to continue"
</instruct>

<page intro01>
THE "UP/DOWN ARROWS" TASK
^^In this task, you will see an arrow pointing UP or DOWN.
^This arrow could appear on the left or the right side of the screen.
^^Your task is to decide whether the arrow is pointing UP or DOWN.
^^Press "z" with one hand if the arrow is pointing UP.
^Press "m" with the other hand if the arrow is pointing DOWN.
^^Please respond as fast and accurately as possible!
^^Press the spacebar to move on to the practice.
</page>

<page test>
^This concludes the practice phase.
^^Please keep in mind:
^^^^Press "z" if the arrow is pointing UP, regardless of its position on the screen.
^Press "m" if the arrow is pointing DOWN, regardless of its position on the screen
^^^^Please try to respond as fast and accurately as possible!
^^^^Press the spacebar to start the test phase.
</page>

<page end>
^This concludes the "Up/Down Arrows" Task.
^^Thanks for participating!
</page>

Thank you very much!

By Dave - 2/4/2015

The highlighted statement will never be executed because the condition will never evaluate to true:

<trial congruenttrial>
/ ontrialbegin = [if(script.currentblock=="practiceblock")
{
values.stimtype=counter.pcongruentstimtype.selectedvalue;
values.cresp=counter.pcongruentcresp.selectedvalue;
}

else
{
values.stimtype=counter.congruentstimtype.selectedvalue;
values.cresp=counter.congruentcresp.selectedvalue;
}]
...
</trial>

There is no <block> called "practiceblock" in your script, the respective block is called "simonpracticeblock". Thus you'll always sample from the <counter> elements designated for the test-block, never from those designated for the practice-block.

Beyond that I am (a) unable to spot any mistake that would cause conditions to "go off" and (b) unable to reproduce conditions "going off" empirically. The test-block will give exactly 40 congruent (20 x stimtype 2, 20 x stimtype 3) , 40 incongruent (20 x stimtype 1, 20 x stimtype 4) and 40 neutral (20 x stimtype 5, 20 x stimtype 6) trials.
By Zooahh - 2/4/2015

Thank you!