Millisecond Forums

single response trial, multiple responses - clicking with mouse on textfields

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

By Kuba - 2/18/2020

Hi 
i got a dichotic listening experiment (a modification of the syllables task by K. Borchert https://www.millisecond.com/download/library/dichoticlistening/):
i simultaneously present two syllables (a syllable pair), each one to a different ear and (would like to) ask the participants to indicate which syllable they heard in which ear. I got a response screen with two circles consisting of 6 text fields (text) containing respective sylablle names . The left circular arrangement of the six text fields is for the left ear and the right one for the right ear, respectively. The participant should be able to  select with the mouse a syllable text field in the "right circle" and a syllable text field in the "left circle". (<trial dichoticresponseRLF>), in whatever order. And i would like to see which one he clicked and the respective response latencies.
But for now the response trial <trial dichoticresponseRLF> terminates after one mouse click.
Problem: i tried to follow the solutions on how to gather multiple respnses for one trial (like https://www.millisecond.com/forums/Topic18181.aspx or https://www.millisecond.com/forums/Topic15810.aspx#15812)...but they mostly relate to  numerical sacncode values or........i just can't grasp the values and the isvalidresponse logic of these solutions. 
Any hints? please help:) maybe a different experiment/response construction logic? (i'm not particularly fixated on this one, though the graphical solution and mouse selection functionality is nice)

Cheers
Kuba

-----------------
important code chunks of my script are below

<values>
/completed = 0
/left = 0
/right = 0
/selectedpair = 0
/syllL1hposition = 10
...
/syllR6hposition = 90
/syllR6vposition = 65
/instructions = 0
/response = 0
</values>

<item syllables>
/1 = "ba.wav"
/2 = "da.wav"
/3 = "pa.wav"
/4 = "ta.wav"
/5 = "ga.wav"
/6 = "ka.wav"
</item>

<sound left>
/items = syllables
/select = values.left
/pan = -10000
/ playthrough = true
</sound>

<sound right>
...

****** the sylablle text fields******* example

<text syllL1>
/items = ("ba")
/hposition = values.syllL1hposition
/vposition = values.syllL1vposition
/txbgcolor = (green)
/ txcolor = (0, 0, 0)
/size = (8%, 6%)
/ fontstyle = ("Arial", 5%, true, false, false, false, 5, 1)
/ vjustify = center
/hjustify = center
</text>
...

<list syllablespairsRLF>
/items = (11, 22, 33, 44, 55, 66,
12, 13, 14, 15, 16, 21, 23, 24, 25, 26, 31, 32, 34, 35, 36, 41, 42, 43, 45, 46, 51, 52, 53, 54, 56, 61, 62, 63, 64, 65,
12, 13, 14, 15, 16, 21, 23, 24, 25, 26, 31, 32, 34, 35, 36, 41, 42, 43, 45, 46, 51, 52, 53, 54, 56, 61, 62, 63, 64, 65,
12, 13, 14, 15, 16, 21, 23, 24, 25, 26, 31, 32, 34, 35, 36, 41, 42, 43, 45, 46, 51, 52, 53, 54, 56, 61, 62, 63, 64, 65)
/replace = false
</list>
...

<list hRLF_L_positions>
/items = (10, 10, 25, 25, 40, 40)
/replace = false
/selectionrate = always
</list>

<list vRLF_L_positions>
/items = (35, 65, 20, 80, 35, 65)
/selectionmode = list.hRLF_L_positions.currentindex
/selectionrate = always
</list>
......

<trial screenassignmentdual>
/ontrialbegin = [values.syllL1hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL1vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL2hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL2vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL3hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL3vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL4hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL4vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL5hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL5vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL6hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL6vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllR1hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR1vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR2hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR2vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR3hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR3vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR4hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR4vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR5hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR5vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR6hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR6vposition = list.vRLF_R_positions.nextvalue]
/timeout = (0)
/recorddata = false
</trial>

<trial dichoticRLF>
/ontrialbegin = [values.selectedpair = list.syllablespairsRLF.nextvalue]
/ontrialbegin = [values.left = substring(values.selectedpair, 0, 1)]
/ontrialbegin = [values.right = substring(values.selectedpair, 1, 1)]
/stimulustimes = [0 =left, right]
/response = dichoticresponseRLF
/posttrialpause = values.dichotic_posttrialpause
/responseinterrupt = trial
/branch = [trial.dichoticresponseRLF]
/recorddata = false
</trial>

<values>
/ first_key = 0
/ first_key_latency = 0
/ second_key = 0
/ second_key_latency = 0
/ correctkeys = ""
</values>

<trial dichoticresponseRLF>
/ ontrialbegin = [values.first_key= 0; values.first_key_latency=0;
  values.second_key= 0; values.second_key_latency = 0; values.correctkeys = "syllL1, syllL2,syllL3, syllL4, syllL5, syllL6, syllR1, syllR2,syllR3, syllR4, syllR5, syllR6"]
/stimulustimes = [0 = syllL1, syllL2, syllL3, syllL4, syllL5, syllL6, syllR1, syllR2, syllR3, syllR4, syllR5, syllR6, instruction]
/ validresponse = (syllL1, syllL2, syllL3, syllL4, syllL5, syllL6, syllR1, syllR2, syllR3, syllR4, syllR5, syllR6)
/ isvalidresponse = [if(values.first_key== 0) {
  values.first_key=trial.dichoticresponseRLF.response;
  values.first_key_latency=trial.dichoticresponseRLF.latency;
  false; };
  if (values.first_key != 0 && trial.dichoticresponseRLF.latency>values.first_key_latency) {
  values.second_key=trial.dichoticresponseRLF.response;
  values.second_key_latency = trial.dichoticresponseRLF.latency;
  false; };
  values.first_key != 0 && values.second_key != 0]
/ iscorrectresponse = [contains(values.correctkeys, values.first_key) && contains(values.correctkeys, values.second_key)]
/ recorddata = true
/posttrialpause = values.dichoticresponse_posttrialpause
</trial>

<block RLF>
/trials = [1 = fixation; 2-97 = noreplace(dichoticRLF)]
</block>

<expt >
/blocks = [1 = dualresponseassignment; 2 = RLF]
/onexptend = [values.completed = 1]
</expt>
By Dave - 2/18/2020

Kuba - 2/18/2020
Hi 
i got a dichotic listening experiment (a modification of the syllables task by K. Borchert https://www.millisecond.com/download/library/dichoticlistening/):
i simultaneously present two syllables (a syllable pair), each one to a different ear and (would like to) ask the participants to indicate which syllable they heard in which ear. I got a response screen with two circles consisting of 6 text fields (text) containing respective sylablle names . The left circular arrangement of the six text fields is for the left ear and the right one for the right ear, respectively. The participant should be able to  select with the mouse a syllable text field in the "right circle" and a syllable text field in the "left circle". (<trial dichoticresponseRLF>), in whatever order. And i would like to see which one he clicked and the respective response latencies.
But for now the response trial <trial dichoticresponseRLF> terminates after one mouse click.
Problem: i tried to follow the solutions on how to gather multiple respnses for one trial (like https://www.millisecond.com/forums/Topic18181.aspx or https://www.millisecond.com/forums/Topic15810.aspx#15812)...but they mostly relate to  numerical sacncode values or........i just can't grasp the values and the isvalidresponse logic of these solutions. 
Any hints? please help:) maybe a different experiment/response construction logic? (i'm not particularly fixated on this one, though the graphical solution and mouse selection functionality is nice)

Cheers
Kuba

-----------------
important code chunks of my script are below

<values>
/completed = 0
/left = 0
/right = 0
/selectedpair = 0
/syllL1hposition = 10
...
/syllR6hposition = 90
/syllR6vposition = 65
/instructions = 0
/response = 0
</values>

<item syllables>
/1 = "ba.wav"
/2 = "da.wav"
/3 = "pa.wav"
/4 = "ta.wav"
/5 = "ga.wav"
/6 = "ka.wav"
</item>

<sound left>
/items = syllables
/select = values.left
/pan = -10000
/ playthrough = true
</sound>

<sound right>
...

****** the sylablle text fields******* example

<text syllL1>
/items = ("ba")
/hposition = values.syllL1hposition
/vposition = values.syllL1vposition
/txbgcolor = (green)
/ txcolor = (0, 0, 0)
/size = (8%, 6%)
/ fontstyle = ("Arial", 5%, true, false, false, false, 5, 1)
/ vjustify = center
/hjustify = center
</text>
...

<list syllablespairsRLF>
/items = (11, 22, 33, 44, 55, 66,
12, 13, 14, 15, 16, 21, 23, 24, 25, 26, 31, 32, 34, 35, 36, 41, 42, 43, 45, 46, 51, 52, 53, 54, 56, 61, 62, 63, 64, 65,
12, 13, 14, 15, 16, 21, 23, 24, 25, 26, 31, 32, 34, 35, 36, 41, 42, 43, 45, 46, 51, 52, 53, 54, 56, 61, 62, 63, 64, 65,
12, 13, 14, 15, 16, 21, 23, 24, 25, 26, 31, 32, 34, 35, 36, 41, 42, 43, 45, 46, 51, 52, 53, 54, 56, 61, 62, 63, 64, 65)
/replace = false
</list>
...

<list hRLF_L_positions>
/items = (10, 10, 25, 25, 40, 40)
/replace = false
/selectionrate = always
</list>

<list vRLF_L_positions>
/items = (35, 65, 20, 80, 35, 65)
/selectionmode = list.hRLF_L_positions.currentindex
/selectionrate = always
</list>
......

<trial screenassignmentdual>
/ontrialbegin = [values.syllL1hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL1vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL2hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL2vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL3hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL3vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL4hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL4vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL5hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL5vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL6hposition = list.hRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllL6vposition = list.vRLF_L_positions.nextvalue]
/ontrialbegin = [values.syllR1hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR1vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR2hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR2vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR3hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR3vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR4hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR4vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR5hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR5vposition = list.vRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR6hposition = list.hRLF_R_positions.nextvalue]
/ontrialbegin = [values.syllR6vposition = list.vRLF_R_positions.nextvalue]
/timeout = (0)
/recorddata = false
</trial>

<trial dichoticRLF>
/ontrialbegin = [values.selectedpair = list.syllablespairsRLF.nextvalue]
/ontrialbegin = [values.left = substring(values.selectedpair, 0, 1)]
/ontrialbegin = [values.right = substring(values.selectedpair, 1, 1)]
/stimulustimes = [0 =left, right]
/response = dichoticresponseRLF
/posttrialpause = values.dichotic_posttrialpause
/responseinterrupt = trial
/branch = [trial.dichoticresponseRLF]
/recorddata = false
</trial>

<values>
/ first_key = 0
/ first_key_latency = 0
/ second_key = 0
/ second_key_latency = 0
/ correctkeys = ""
</values>

<trial dichoticresponseRLF>
/ ontrialbegin = [values.first_key= 0; values.first_key_latency=0;
  values.second_key= 0; values.second_key_latency = 0; values.correctkeys = "syllL1, syllL2,syllL3, syllL4, syllL5, syllL6, syllR1, syllR2,syllR3, syllR4, syllR5, syllR6"]
/stimulustimes = [0 = syllL1, syllL2, syllL3, syllL4, syllL5, syllL6, syllR1, syllR2, syllR3, syllR4, syllR5, syllR6, instruction]
/ validresponse = (syllL1, syllL2, syllL3, syllL4, syllL5, syllL6, syllR1, syllR2, syllR3, syllR4, syllR5, syllR6)
/ isvalidresponse = [if(values.first_key== 0) {
  values.first_key=trial.dichoticresponseRLF.response;
  values.first_key_latency=trial.dichoticresponseRLF.latency;
  false; };
  if (values.first_key != 0 && trial.dichoticresponseRLF.latency>values.first_key_latency) {
  values.second_key=trial.dichoticresponseRLF.response;
  values.second_key_latency = trial.dichoticresponseRLF.latency;
  false; };
  values.first_key != 0 && values.second_key != 0]
/ iscorrectresponse = [contains(values.correctkeys, values.first_key) && contains(values.correctkeys, values.second_key)]
/ recorddata = true
/posttrialpause = values.dichoticresponse_posttrialpause
</trial>

<block RLF>
/trials = [1 = fixation; 2-97 = noreplace(dichoticRLF)]
</block>

<expt >
/blocks = [1 = dualresponseassignment; 2 = RLF]
/onexptend = [values.completed = 1]
</expt>

Could you please provide code that's actually complete enough to run? Given everything that's missing from the snippets you posted, it's impossible for me to make sense of.
By Kuba - 2/18/2020

Dave - 2/18/2020

Could you please provide code that's actually complete enough to run? Given everything that's missing from the snippets you posted, it's impossible for me to make sense of.

Hi Dave,
sure, here it is.

Kuba
By Dave - 2/18/2020

Kuba - 2/18/2020
Dave - 2/18/2020

Could you please provide code that's actually complete enough to run? Given everything that's missing from the snippets you posted, it's impossible for me to make sense of.

Hi Dave,
sure, here it is.

Kuba

Thank you. Could you please provide the files the script requires to run, too?
By Kuba - 2/18/2020

Dave - 2/18/2020

Thank you. Could you please provide the files the script requires to run, too?
Sure
i could not upload them to the forum
but see my dropbox folder to access the six syllables (wav files).
https://www.dropbox.com/sh/sagnehsamyjhwoy/AAB5SzCVSXhBlHVLJxsIJDuMa?dl=0

Cheers
kuba
By Dave - 2/18/2020

Kuba - 2/18/2020
Dave - 2/18/2020

Thank you. Could you please provide the files the script requires to run, too?
Sure
i could not upload them to the forum
but see my dropbox folder to access the six syllables (wav files).
https://www.dropbox.com/sh/sagnehsamyjhwoy/AAB5SzCVSXhBlHVLJxsIJDuMa?dl=0

Cheers
kuba

Thank you again. See the attached revision for how I would go about it.
By Kuba - 2/19/2020

Dave - 2/18/2020
Kuba - 2/18/2020
Dave - 2/18/2020

Thank you. Could you please provide the files the script requires to run, too?
Sure
i could not upload them to the forum
but see my dropbox folder to access the six syllables (wav files).
https://www.dropbox.com/sh/sagnehsamyjhwoy/AAB5SzCVSXhBlHVLJxsIJDuMa?dl=0

Cheers
kuba

Thank you again. See the attached revision for how I would go about it.

Works perfectly. Thank you very much Dave!

kuba