Millisecond Forums

list of cues

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

By Lucie1043 - 7/1/2016

Hi,

I've had a few questions lately and you've been very helpful! 
In this experiment, participants need to solve a problem. They can click on a button to request some more informations to figure out the correct answer. They can get as many as 6 cues.
Those 6 cues are provided in a random order and they are part of a pool of 20 cues.
Each cue provided must stay on the screen (this way, the participant doesn't have to memorize it). Moreover, each cue provided has a special location the screen (I am wondering of I should create counter elements here...)

Thanks in advance!

Lucie

By Dave - 7/1/2016

I'm afraid your description is too unspecific to say anything useful or provide any example code.

- What kind(s) of problem(s) are participants supposed to solve and how? What is the response modality?
- You say there's a pool of 20 cues and participants can request a maximum of 6. You further state that "each cue [...] has a special location the screen." So, are there 6 or 20 locations? What are those locations and how do they relate to the respective cue?
By Dave - 7/1/2016

Despite the various open questions and blank spots (cf. previous response), perhaps this rough sketch will be useful as a basis for you to work from:

<block myblock>
/ trials = [1=showproblem]
</block>

<values>
/ cuecount = 0
</values>

<trial showproblem>
/ inputdevice = mouse
/ stimulusframes = [1=problemstim, hintsreceived, requestcue, solveproblem]
/ validresponse = (requestcue, solveproblem)
/ branch = [if (trial.showproblem.response == "solveproblem") openended.entersolution]
/ branch = [if (trial.showproblem.response == "requestcue" && values.cuecount < 6) trial.givecue else openended.entersolution]
</trial>

<trial givecue>
/ ontrialbegin = [values.cuecount += 1; ]
/ stimulusframes = [1=cuestim]
/ validresponse = (0)
/ trialduration = 0
/ branch = [trial.showproblem]
</trial>

<openended entersolution>
/ stimulusframes = [1=clearscreen, problemstim, entersolutionstim]
/ validresponse = (anyresponse)
/ correctresponse = ("solution")
</openended>

<text problemstim>
/ items = ("[THE PROBLEM]")
/ erase = false
/ position = (50%, 10%)
</text>

<text cuestim>
/ items = cueitems
/ erase = false
/ hposition = list.cue_x.nextvalue
/ vposition = list.cue_y.nextvalue
</text>

<item cueitems>
/ 1 = "Cue A"
/ 2 = "Cue B"
/ 3 = "Cue C"
/ 4 = "Cue D"
/ 5 = "Cue E"
/ 6 = "Cue F"
/ 7 = "Cue G"
/ 8 = "Cue H"
/ 9 = "Cue I"
/ 10 = "Cue J"
/ 11 = "Cue K"
/ 12 = "Cue L"
/ 13 = "Cue M"
/ 14 = "Cue N"
/ 15 = "Cue O"
/ 16 = "Cue P"
/ 17 = "Cue Q"
/ 18 = "Cue R"
/ 19 = "Cue S"
/ 20 = "Cue T"
</item>

<text requestcue>
/ items = ("Give me a hint!")
/ txbgcolor = (grey)
/ erase = false
/ size = (20%, 10%)
/ vjustify = center
/ position = (35%, 85%)
</text>

<text solveproblem>
/ items = ("I know the solution!")
/ txbgcolor = (grey)
/ erase = false
/ size = (20%, 10%)
/ vjustify = center
/ position = (65%, 85%)
</text>

<text entersolutionstim>
/ items = ("Please enter the solution:")
/ erase = false
/ position = (50%, 40%)
</text>

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

<list cue_x>
/ items = (25%, 50%, 75%, 25%, 50%, 75%)
/ selectionmode = sequence
</list>

<list cue_y>
/ items = (40%, 40%, 40%, 60%, 60%, 60%)
/ selectionmode = list.cue_x.currentindex
</list>

<text hintsreceived>
/ items = ("(Hints received: <%values.cuecount%>.)")
/ position = (50%, 15%)
/ erase = false
</text>

By Lucie1043 - 7/2/2016

Thank you! I can definitely use your script as a basis for the script I am writing.

I just have one more question. Participants are supposed to solve 4 problems from a pool of 10 problems. At the moment, every time I request a cue, the problem changes. How could I keep the same problem until the participant solve it?

Thanks again,
Lucie
By Dave - 7/3/2016

Set up a <list> containing the item numbers for the 10 problems (1 to 10). Start each "round" with a "start" trial that does nothing but select an item number from that <list> and stores it in a <values> entry. Use that value for selection in the "problem" stimulus element.

Here's an extension of the previous example to 2 problems. (I suppose there are different sets of cues pertaining to each problem, so that has to be worked into the script as well):

<block myblock>
/ trials = [1-2=starttrial]
</block>

<values>
/ problemnumber = 0
/ cuenumber = 0
/ cuecount = 0
</values>

<trial starttrial>
/ ontrialbegin = [values.problemnumber = list.problemitems.nextindex; values.cuecount = 0; text.cuestim.resetselection();
    list.cue_x.reset(); list.cue_y.reset();]
/ validresponse = (0)
/ branch = [trial.showproblem]
/ trialduration = 0
/ recorddata = false
</trial>

<trial showproblem>
/ inputdevice = mouse
/ stimulusframes = [1=problemstim, hintsreceived, requestcue, solveproblem]
/ validresponse = (requestcue, solveproblem)
/ branch = [if (trial.showproblem.response == "solveproblem") openended.entersolution]
/ branch = [if (trial.showproblem.response == "requestcue" && values.cuecount < 6) trial.givecue else openended.entersolution]
</trial>

<trial givecue>
/ ontrialbegin = [values.cuecount += 1; values.cuenumber = list.cueitems.nextvalue; ]
/ stimulusframes = [1=cuestim]
/ validresponse = (0)
/ trialduration = 0
/ branch = [trial.showproblem]
</trial>

<openended entersolution>
/ stimulusframes = [1=clearscreen, problemstim, entersolutionstim]
/ validresponse = (anyresponse)
/ correctresponse = ("solution")
</openended>

<text problemstim>
/ items = ("Problem A", "Problem B")
/ erase = false
/ position = (50%, 10%)
/ select = values.problemnumber
</text>

<text cuestim>
/ items = cueitems
/ erase = false
/ select = values.cuenumber
/ hposition = list.cue_x.nextvalue
/ vposition = list.cue_y.nextvalue
</text>

<item cueitems>
/ 1 = "PA Cue A"
/ 2 = "PA Cue B"
/ 3 = "PA Cue C"
/ 4 = "PA Cue D"
/ 5 = "PA Cue E"
/ 6 = "PA Cue F"
/ 7 = "PA Cue G"
/ 8 = "PA Cue H"
/ 9 = "PA Cue I"
/ 10 = "PA Cue J"
/ 11 = "PA Cue K"
/ 12 = "PA Cue L"
/ 13 = "PA Cue M"
/ 14 = "PA Cue N"
/ 15 = "PA Cue O"
/ 16 = "PA Cue P"
/ 17 = "PA Cue Q"
/ 18 = "PA Cue R"
/ 19 = "PA Cue S"
/ 20 = "PA Cue T"

/ 21 = "PB Cue A"
/ 22 = "PB Cue B"
/ 23 = "PB Cue C"
/ 24 = "PB Cue D"
/ 25 = "PB Cue E"
/ 26 = "PB Cue F"
/ 27 = "PB Cue G"
/ 28 = "PB Cue H"
/ 29 = "PB Cue I"
/ 30 = "PB Cue J"
/ 31 = "PB Cue K"
/ 32 = "PB Cue L"
/ 33 = "PB Cue M"
/ 34 = "PB Cue N"
/ 35 = "PB Cue O"
/ 36 = "PB Cue P"
/ 37 = "PB Cue Q"
/ 38 = "PB Cue R"
/ 39 = "PB Cue S"
/ 40 = "PB Cue T"
</item>

<text requestcue>
/ items = ("Give me a hint!")
/ txbgcolor = (grey)
/ erase = false
/ size = (20%, 10%)
/ vjustify = center
/ position = (35%, 85%)
</text>

<text solveproblem>
/ items = ("I know the solution!")
/ txbgcolor = (grey)
/ erase = false
/ size = (20%, 10%)
/ vjustify = center
/ position = (65%, 85%)
</text>

<text entersolutionstim>
/ items = ("Please enter the solution:")
/ position = (50%, 40%)
</text>

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

<list cue_x>
/ items = (25%, 50%, 75%, 25%, 50%, 75%)
/ selectionmode = sequence
</list>

<list cue_y>
/ items = (40%, 40%, 40%, 60%, 60%, 60%)
/ selectionmode = list.cue_x.currentindex
</list>

<text hintsreceived>
/ items = ("(Hints received: <%values.cuecount%>.)")
/ position = (50%, 15%)
/ erase = false
</text>

<list problemitems>
/ poolsize = 2
</list>

//list of lists of cues pertaining to the different problems
<list cueitems>
/ items = (list.pa_cueitems.nextvalue, list.pb_cueitems.nextvalue)
/ selectionmode = values.problemnumber
</list>

//cue items pertaining to problem A are item numbers 1 to 20
<list pa_cueitems>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
</list>

//cue items pertaining to problem B are item numbers 21 to 40
<list pb_cueitems>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
</list>

By Lucie1043 - 7/13/2016

Thanks to your numerous advices, I am nearly done programing this experiment! Nevertheless, I am still facing different issues I haven't been able to solve by myself yet.

#1 : I need to define a correct answer with each problem BUT I also need to associate a text element with a picture element and a value. 
When I do that I don't get the right answers anymore : 

<values>
/ problemnumber = 0
</values>


<list answers1>

/ items = ("no", "no","yes", "yes")
/ selectionmode =text.problemstim_frame.currentindex
</list>

<text problemstim_frame>

/ items =problemitem_frame

/ fontstyle =("Arial", 15pt, true)

/ txcolor = (255, 0,0)

/ position = (50, 30)

/ select =picture.problemstim_stimuli.currentitemnumber

/ erase = false

</text>

 

<picture problemstim_stimuli>

/ items =problemitem_stimuli

/ position = (50, 30)

/ select =values.problemnumber

/ erase = false

</picture>

 

If I do that instead, it works fine but it isn't associated with a value anymore : 

<picture Question_0click>
/ items = question_0click
/ position = (50, 30)
/ select = text.question_opposite_0click.currentindex
</picture>

<text question_opposite_0click>
/ items = question_opposite_0click
/ fontstyle = ("Arial", 15pt, true)
/ txcolor = (255, 0, 0)
/ position = (50, 30)
/ select = noreplace
</text>

What do you think?


#2 : The second problem I can't solve is about the timer. I only want to reset the timer when a <trial showproblem>  is starting (not when I ask for a cue).

<block myblock>
/ trials = [1=showproblem]
</block>

<values>
/ cuecount = 0
/ tasktimeout = 60000
/ tasktimeoutleft = 0
</values>

<trial showproblem>
/ ontrialbegin = [values.tasktimeoutleft = values.tasktimeout- trial.showproblem.elapsedtime]
/ inputdevice = mouse
/ stimulusframes = [1=problemstim, hintsreceived, requestcue, solveproblem, timer]
/ validresponse = (requestcue, solveproblem)
/ timeout = values.tasktimeoutleft
/ branch = [if (trial.showproblem.response == "solveproblem") openended.entersolution]
/ branch = [if (trial.showproblem.response == "requestcue" && values.cuecount < 6) trial.givecue else openended.entersolution]
</trial>

<trial givecue>
/ ontrialbegin = [values.cuecount += 1; ]
/ stimulusframes = [1=cuestim]
/ validresponse = (0)
/ trialduration = 0
/ branch = [trial.showproblem]
</trial>

<clock Timer>
/ mode = timer
/ resetrate = trial
/ erase = false
/ txcolor = (0, 255, 0)
/ txbgcolor = black
/ timeout = values.tasktimeout
/ position = (90%, 90%)
/ format = "mm:ss"
</clock>

#3 : My last problem concerns a likert scale I want to include. 
Every 5 problems, I want to know if the participant is confident in the final answer ("yes" , "no") he just provided, before giving him a feedback on his performance ("congratulations", "you loose"). 

<values>
/ instructionnumber = 0
/ problemnumber = 0
/ cuenumber = 0
/ cuecount = 0
/ points_available = 100
/ problem_number = 1
/ numberoftries = 0
/ score = 0
</values>

<trial starttrial>
/ ontrialbegin = [values.instructionnumber = list.instructionitems.nextindex ; values.problemnumber = list.problemitems.nextindex;
values.cuecount = 0; text.cuestim_frame.resetselection(); picture.cuestim_stimuli.resetselection() ; list.cue_x.reset(); list.cue_y.reset();
values.points_available = 100; values.numberoftries = 0; values.problem_number = list.problemitems.nextindex ]
/ validresponse = (0)
/ branch = [trial.showproblem]
/ trialduration = 0
/ recorddata = false
</trial>


<trial showproblem>
/ ontrialbegin = [values.numberoftries += 1]
/ ontrialbegin = [if (values.numberoftries > 1) values.points_available -= list.subtractpoints.nextindex; ]
/ ontrialend = [if (trial.showproblem.correct) values.score += values.points_available; ]
/ inputdevice = mouse
/ stimulusframes = [1= instructionframe, instruction1_stimuli, instruction2_stimuli,instruction1_frame, instruction2_frame, problemstim_stimuli,
problemstim_frame, Is, ?, requestcue, yes, no, points, hintsreceived]
/ validresponse = (requestcue, yes, no)
/ iscorrectresponse = [trial.showproblem.response == list.answers1.nextvalue]
/ branch = [if (trial.showproblem.correct) trial.congratulation]
/ branch = [if ( trial.showproblem.response == "yes" || trial.showproblem.response =="no" && values.problem_number = 5) likert.valence]
/ branch = [if (trial.showproblem.response == "requestcue" && values.cuecount < 6) trial.givecue else trial.error]
</trial>

<item confidencescale>
/1 = "How confident are you that your answer is correct?"
</item>

<text confidencescale>
/ items = confidencescale
/ position = (50, 10)
</text>

<likert valence>
/ stimulusframes = [1 = confidencescale]
/ anchors = [1 = "Not at all confident"; 4= "Moderately confident"; 7= "Very confident"]
/ numpoints = 7
/ anchorwidth=150px
/ inputdevice = mouse
/ branch = [trial.congratulations]
</likert>

<trial congratulations>
/ stimulusframes = [1=clearscreen, congratulations, next]
/ inputdevice = mouse
/ validresponse = ("next")
</trial>

<trial error>
/ stimulusframes = [1=clearscreen, error, next]
/ inputdevice = mouse
/ validresponse = ("next")
</trial>

Thanks again for your help!
Lucie
By Dave - 7/13/2016

Re. #1: You simply use the <values> entry you populate at the start of every round for selection in all relevant elements.

<list answers1>
/ items = ("no", "no","yes", "yes")
/ selectionmode =values.problemnumber
</list>

<text problemstim_frame>

/ items =problemitem_frame

/ fontstyle =("Arial", 15pt, true)

/ txcolor = (255, 0,0)

/ position = (50, 30)

/ select =values.problemnumber

/ erase = false

</text>

Re. #2: I don't understand what you want to do with the timer. To simply reset it, you do

<trial showproblem>
/ ontrialbegin = [clock.timer.resettime(); ]
...
</trial>

Re. #3: This /branch does not appear to make sense:

/ branch = [if ( trial.showproblem.response == "yes" || trial.showproblem.response =="no" && values.problem_number = 5) likert.valence]

(1) values.problem_number just replicates what you already have with values.problemnumber:

<trial starttrial>
/ ontrialbegin = [values.instructionnumber = list.instructionitems.nextindex ; values.problemnumber = list.problemitems.nextindex;
values.cuecount = 0; text.cuestim_frame.resetselection(); picture.cuestim_stimuli.resetselection() ; list.cue_x.reset(); list.cue_y.reset();
values.points_available = 100; values.numberoftries = 0; values.problem_number = list.problemitems.nextindex ]
...
</trial>

It *does not* reflect a *count* of the problems administered so far; as discussed previously, it represents the *item number* of the particular problem selected for that "round" of the game.

If you want a count, you need to implement one, i.e., you need to do

<values>
/ problemcount = 0
...
</values>

<trial starttrial>
/ ontrialbegin = [...; values.problemcount += 1]
...
</trial>

Then you can /branch to your likert based on whether that count is a multiple of 5:

/ branch = [if ( trial.showproblem.response != "requestcue" && mod(values.problemcount,5)==0 ) likert.valence]
By Lucie1043 - 7/13/2016

I've been looking for a solution for ages and when I finally see it, it always looks so simple, thanks!

#2 : On the contrary, I want the timer to keep running until the participant gives his answer to the problem.
At the moment, the timer resets every time I ask for a cue  (<trial.givecue>).
By Dave - 7/13/2016

If you want the timer to be displayed & ticking down across all trials for a given problem, you should display it via the <block>'s /bgstim like so:

<expt>
/ blocks = [1-2 = problemblock]
</expt>

<block problemblock>
/ bgstim = (timer)
/ trials = [1=starttrial]
</block>

<clock timer>
/ mode = timer
/ timeout = values.timeout
/ erase = false
/ position = (80%, 5%)
</clock>

<values>
/ timeout = 20000
/ problemnumber = 0
/ cuenumber = 0
/ cuecount = 0
</values>

<trial starttrial>
/ ontrialbegin = [values.problemnumber = list.problemitems.nextindex; values.cuecount = 0; text.cuestim.resetselection();
    list.cue_x.reset(); list.cue_y.reset();]
/ validresponse = (0)
/ branch = [trial.showproblem]
/ trialduration = 0
/ recorddata = false
</trial>

<trial showproblem>
/ inputdevice = mouse
/ stimulusframes = [1=problemstim, hintsreceived, requestcue, solveproblem]
/ validresponse = (requestcue, solveproblem)
/ branch = [if (trial.showproblem.response == "solveproblem") openended.entersolution]
/ branch = [if (trial.showproblem.response == "requestcue" && values.cuecount < 6) trial.givecue else openended.entersolution]
</trial>

<trial givecue>
/ ontrialbegin = [values.cuecount += 1; values.cuenumber = list.cueitems.nextvalue; ]
/ stimulusframes = [1=cuestim]
/ validresponse = (0)
/ trialduration = 0
/ branch = [trial.showproblem]
</trial>

<openended entersolution>
/ stimulusframes = [1=clearscreen, problemstim, entersolutionstim]
/ validresponse = (anyresponse)
/ correctresponse = ("solution")
</openended>

<text problemstim>
/ items = ("Problem A", "Problem B")
/ erase = false
/ position = (50%, 10%)
/ select = values.problemnumber
</text>

<text cuestim>
/ items = cueitems
/ erase = false
/ select = values.cuenumber
/ hposition = list.cue_x.nextvalue
/ vposition = list.cue_y.nextvalue
</text>

<item cueitems>
/ 1 = "PA Cue A"
/ 2 = "PA Cue B"
/ 3 = "PA Cue C"
/ 4 = "PA Cue D"
/ 5 = "PA Cue E"
/ 6 = "PA Cue F"
/ 7 = "PA Cue G"
/ 8 = "PA Cue H"
/ 9 = "PA Cue I"
/ 10 = "PA Cue J"
/ 11 = "PA Cue K"
/ 12 = "PA Cue L"
/ 13 = "PA Cue M"
/ 14 = "PA Cue N"
/ 15 = "PA Cue O"
/ 16 = "PA Cue P"
/ 17 = "PA Cue Q"
/ 18 = "PA Cue R"
/ 19 = "PA Cue S"
/ 20 = "PA Cue T"

/ 21 = "PB Cue A"
/ 22 = "PB Cue B"
/ 23 = "PB Cue C"
/ 24 = "PB Cue D"
/ 25 = "PB Cue E"
/ 26 = "PB Cue F"
/ 27 = "PB Cue G"
/ 28 = "PB Cue H"
/ 29 = "PB Cue I"
/ 30 = "PB Cue J"
/ 31 = "PB Cue K"
/ 32 = "PB Cue L"
/ 33 = "PB Cue M"
/ 34 = "PB Cue N"
/ 35 = "PB Cue O"
/ 36 = "PB Cue P"
/ 37 = "PB Cue Q"
/ 38 = "PB Cue R"
/ 39 = "PB Cue S"
/ 40 = "PB Cue T"
</item>

<text requestcue>
/ items = ("Give me a hint!")
/ txbgcolor = (grey)
/ erase = false
/ size = (20%, 10%)
/ vjustify = center
/ position = (35%, 85%)
</text>

<text solveproblem>
/ items = ("I know the solution!")
/ txbgcolor = (grey)
/ erase = false
/ size = (20%, 10%)
/ vjustify = center
/ position = (65%, 85%)
</text>

<text entersolutionstim>
/ items = ("Please enter the solution:")
/ position = (50%, 40%)
</text>

<shape clearscreen>
/ color = (white)
/ shape = rectangle
/ size = (100%, 80%)
/ erase = false
</shape>

<list cue_x>
/ items = (25%, 50%, 75%, 25%, 50%, 75%)
/ selectionmode = sequence
</list>

<list cue_y>
/ items = (40%, 40%, 40%, 60%, 60%, 60%)
/ selectionmode = list.cue_x.currentindex
</list>

<text hintsreceived>
/ items = ("(Hints received: <%values.cuecount%>.)")
/ position = (50%, 15%)
/ erase = false
</text>

<list problemitems>
/ poolsize = 2
</list>

//list of lists of cues pertaining to the different problems
<list cueitems>
/ items = (list.pa_cueitems.nextvalue, list.pb_cueitems.nextvalue)
/ selectionmode = values.problemnumber
</list>

//cue items pertaining to problem A are item numbers 1 to 20
<list pa_cueitems>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
</list>

//cue items pertaining to problem B are item numbers 21 to 40
<list pb_cueitems>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
</list>
By Lucie1043 - 7/14/2016

It is working great! Thanks a lot!