Millisecond Forums

string comparison

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

By jens - 3/20/2015

Hello,

I am programming a dot-probe experiment. Probes will be "F" or "J" and appear either on the left or the right side of the screen. I like to check for the correctness of the answer which I tried to achieve in the following manner.

<text probe.right>
/ items = ("F","F","F","F","F","F","F","J","J","J","J","J","J","J","F","F","F","F","F","F","F","J","J","J","J","J","J","J")
/ select = noreplace
</text>

<trial t.pos.word.right>
/ ontrialbegin = [if (list.posi.probe.pos.right.nextvalue == 1) {text.probe.right.hposition = values.links; values.pos = values.links}
                                                            else {text.probe.right.hposition = values.rechts; values.pos = values.rechts}]
/ ontrialbegin = [if (text.probe.right.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}]
/ stimulusframes = [ 1 = fixation; 30 = maske; 31 = pos.word.right.tar, pos.word.right.dis; 42 = maske; 43 = probe.right]
/ validresponse = ("F", "J")
/ iscorrectresponse = [trial.t.pos.word.right.response == values.korrekt]
/ timeout = 3000
</trial>

However, values.korrekt evaluates always to 36 probably because "if(text.probe.right.nextvalue == "F") is always wrong. Suggestions are welcome.

Best wishes Jens


By jens - 3/20/2015

Hello,

I keep on finding a solution. The following seems to work:

<list probe.right.l>
/ items = ("F", "J")
/ poolsize = 14
</list>

<trial t.pos.word.right>
/ ontrialbegin = [if (list.posi.probe.pos.right.nextvalue == 1) {text.probe.right.hposition = values.links; values.pos = values.links}
                                                            else {text.probe.right.hposition = values.rechts; values.pos = values.rechts}]
/ ontrialbegin = [if (list.probe.right.l.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}]
/ stimulusframes = [ 1 = fixation; 30 = maske; 31 = pos.word.right.tar, pos.word.right.dis; 42 = maske; 43 = probe.right]
/ validresponse = ("F", "J")
/ iscorrectresponse = [trial.t.pos.word.right.response == values.korrekt]
/ timeout = 3000
</trial>

Am I mistaken?

Best wishes Jens
By Dave - 3/20/2015

For stimulus elements (<text>, <picture>, etc.) the nextvalue property is identical to the nextindex property. I.e., what it returns is not the item ("F", "J"), but the item's numerical index (e.g. 1 for the 1st item listed, 17 for the 17th, etc.). Hence your check

/ ontrialbegin = [if (list.probe.right.l.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}

necessarily fails and values.korrekt is always set to 36.

Only in for <list> elements do nextvalue and nextindex reflect different things.
By jens - 3/20/2015

So,

/ ontrialbegin = [if (list.probe.right.l.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}
as well as
/ ontrialbegin = [if (text.probe.right.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}]
fail?
Best Jens
By Dave - 3/20/2015

No. As I said in my previous response, nextvalue does what you want in case of <list> elements. It returns the item, not the index number. nextindex returns the index.

Another way to fix your code is to use the <text>'s currentitem property in /iscorrectresponse.


<text probe.right>
/ items = ("F","F","F","F","F","F","F","J","J","J","J","J","J","J","F","F","F","F","F","F","F","J","J","J","J","J","J","J")
/ select = noreplace
</text>

<trial t.pos.word.right>
/ stimulusframes = [ 1 = probe.right]
/ validresponse = ("F", "J")
/ iscorrectresponse = [if (text.probe.right.currentitem == "F") {values.korrekt = 33} else {values.korrekt = 36}; trial.t.pos.word.right.response == values.korrekt]
</trial>

<values>
/ korrekt = ""
</values>

<block myblock>
/trials = [1-28 = t.pos.word.right]
</block>


By jens - 3/20/2015

Hello,

thank a lot. I misunderstood your first reply.

Best Jens.