Millisecond Forums

Slider / surveypage issue - not able to proceed to next trial

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

By Gy997 - 4/18/2020

Hi, 

In one of my experiment blocks I'd like to present a sequence of trials containing a slider scale (eg one trial for emotional intensity and one for valence.) To do so, I'm using the surveypage as trial element containing two "questions", caption and slider. I don't know if it's correct to add the caption as question, but I did that because I wanted to manipulate the text caption size / position (which doesn't seem possible otherwise). The main problem is that when I run my script, it seems that even if I'm able to select one of the slider tick mark using the mouse, I am not able to proceed to the next trial / the experiment doesn't move on. I tried out different things, even deleted the caption question from the surveypage element but nothing changes. I wonder where is the problem? :( I tried to add  lbuttondblclk as /validresponse in the sliders element but I get this message "invalid syntax", so I really don't know how to solve this issue. Hope it wasn't too confusing/unclear, to explain myself better I attached some lines from my script where I defined block, the two surveypages and related sliders/captions. Thank you for your time and understanding!
 
<block ems>
/ trials = [1=emotionalintensity; 2= valence]
/ recorddata = true
</block>

<surveypage emotionalintensity>
/ questions = [1=textem; 2= emotionalintensity]
/ recorddata = true
/ ontrialend = [
    values.emotionalintensity= response
]
/ branch = [surveypage.valence]
/ timeout = (57)
</surveypage>


<slider emotionalintensity>
/ labels = ("1", "2", "3", "4", "5", "6", "7")
/ range = (1,7)
/ increment = 1
/ position = (10,50)
/ slidersize = (100, 100)
</slider>

<caption textem>
/ caption = "Please rate the emotional intensity of your thoughts"
/ subcaption = "(1= extremely low; 7=extremely high)"
/ txcolor = black
/ position = (30,30)
/ size = (90%, 50%)
/ fontstyle = ("Arial", 2.13%, false, false, false, false, 5, 1)
</caption>


<surveypage valence>
/ questions = [1= textva; 2=valence;]
/ recorddata = true
/ ontrialend = [
    values.valence = response
]
</surveypage>

<slider valence>
/ labels = ("1", "2", "3", "4", "5", "6", "7")
/ range = (1,7)
/ increment = 1
/ position = (10,50)
/ slidersize = (100, 100)
</slider>


<caption textva>
/ caption = "Please rate the emotional valence of your thoughts"
/ subcaption = "(1= extremely negative; 7=extremely positive)"
/ txcolor = black
/ position = (30,30)
/ size = (90%, 50%)
/ fontstyle = ("Arial", 2.13%, false, false, false, false, 5, 1)
</caption>

By Gy997 - 4/18/2020

Sorry, 

<surveypage emotionalintensity>
/ questions = [1=textem; 2= emotionalintensity]
/ recorddata = true
/ ontrialend = [
  values.emotionalintensity= response
]
/ branch = [surveypage.valence]
/ timeout = (57)

</surveypage>

Don't consider these two lines as I removed them in the latest version of the script. 
By Dave - 4/18/2020

Gy997 - 4/18/2020
Sorry, 

<surveypage emotionalintensity>
/ questions = [1=textem; 2= emotionalintensity]
/ recorddata = true
/ ontrialend = [
  values.emotionalintensity= response
]
/ branch = [surveypage.valence]
/ timeout = (57)

</surveypage>

Don't consider these two lines as I removed them in the latest version of the script. 

You've sized your <slider> elements such that the navigation button will be located off-screen and you have to scroll wayyyy down to get to it. Don't do this.

<slider emotionalintensity>
/ labels = ("1", "2", "3", "4", "5", "6", "7")
/ range = (1,7)
/ increment = 1
/ position = (10,50)
/ slidersize = (100, 100)
</slider>

<slider valence>
/ labels = ("1", "2", "3", "4", "5", "6", "7")
/ range = (1,7)
/ increment = 1
/ position = (10,50)
/ slidersize = (100, 100)
</slider>

As a side note,

/ ontrialend = [
  values.valence = response
]

will do nothing. It ought to read

/ ontrialend = [
  values.valence = slider.valence.response;
]



<block ems>
/ trials = [1=emotionalintensity;]
/ recorddata = true
</block>

<values>
/ valence = ""
/ emotionalintensity = ""
</values>

<surveypage emotionalintensity>
/ questions = [1=textem; 2= emotionalintensity]
/ recorddata = true
/ ontrialend = [
  values.emotionalintensity = slider.emotionalintensity.response;
]
/ branch = [surveypage.valence]
</surveypage>


<slider emotionalintensity>
/ labels = ("1", "2", "3", "4", "5", "6", "7")
/ range = (1,7)
/ increment = 1
/ position = (10,50)
/ slidersize = (90%, 30%)
</slider>

<caption textem>
/ caption = "Please rate the emotional intensity of your thoughts"
/ subcaption = "(1= extremely low; 7=extremely high)"
/ txcolor = black
/ position = (30,30)
/ size = (90%, 50%)
/ fontstyle = ("Arial", 2.13%, false, false, false, false, 5, 1)
</caption>


<surveypage valence>
/ questions = [1= textva; 2=valence;]
/ recorddata = true
/ ontrialend = [
  values.valence = slider.valence.response;
]
</surveypage>

<slider valence>
/ labels = ("1", "2", "3", "4", "5", "6", "7")
/ range = (1,7)
/ increment = 1
/ position = (10,50)
/ slidersize = (90%, 30%)
</slider>


<caption textva>
/ caption = "Please rate the emotional valence of your thoughts"
/ subcaption = "(1= extremely negative; 7=extremely positive)"
/ txcolor = black
/ position = (30,30)
/ size = (90%, 50%)
/ fontstyle = ("Arial", 2.13%, false, false, false, false, 5, 1)
</caption>
By Gy997 - 4/19/2020

Ohhh, right, sorry that was so dumb! Thank you so much.
I have another question, this could be trickier but it's quite an important part of the task I'm working on. I want to allow participants to press a key (such as the spacebar) whenever they experience an "intrusive thought" while they're doing a visual search task. In other words, they should be able to press both the key used for the self caught thoughts as well as the keys used to respond to the task in the same trial and I need to record that additional response. 
However, I don't know how/whether it is possible to allow multiple responses in a trial. Is there a way to record what participants press on the keyboard a part from the valid/correct responses or play around that in some way? Sorry if that sounds confusing.. Many thanks again for your time!
By Dave - 4/20/2020

Gy997 - 4/19/2020
Ohhh, right, sorry that was so dumb! Thank you so much.
I have another question, this could be trickier but it's quite an important part of the task I'm working on. I want to allow participants to press a key (such as the spacebar) whenever they experience an "intrusive thought" while they're doing a visual search task. In other words, they should be able to press both the key used for the self caught thoughts as well as the keys used to respond to the task in the same trial and I need to record that additional response. 
However, I don't know how/whether it is possible to allow multiple responses in a trial. Is there a way to record what participants press on the keyboard a part from the valid/correct responses or play around that in some way? Sorry if that sounds confusing.. Many thanks again for your time!

It's probably possible. You'll have to work with /isvalidresponse. See e.g. https://www.millisecond.com/forums/FindPost22899.aspx
By Gy997 - 4/20/2020

Thank you, I tried to add the /isvalidresponse to my trial but now all my trials are incorrect even if I press the correct keys, as if the other keys aren't even recorded.
Perhaps the structure of my trial helps to clarify the issue. I have 2 letters appearing on a horizontal line made of 6 spaces (erasers) plus another distractor letter appearing above/below the letters line. One of the two letters on the horizontal line is the target (in this trial it's is a K). Participant have to press key J whenever they see a K and that is stored as correct response. However, now that I've added to the script the code to store the number of times the spacebar is pressed, in the resulting data table the response column contains only "0" and all responses are marked as incorrect.. :( 

<trial set2KTARGET>
/ ontrialbegin = [
    values.valid = 0;
   values.spacebarscount = 0;
   values.latencies="";
    values.validcorrect = 0;
    values.trialcount += 1]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler1K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler2K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler3K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler4K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler5K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2targetK.nextvalue,500);]
/ ontrialbegin = [values.fillerhpos1 = list.s2filler1_hK.nextvalue]
/ ontrialbegin = [values.fillervpos1 = list.s2filler1_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos2 = list.s2filler2_hK.nextvalue]
/ ontrialbegin = [values.fillervpos2 = list.s2filler2_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos3 = list.s2filler3_hK.nextvalue]
/ ontrialbegin = [values.fillervpos3 = list.s2filler3_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos4 = list.s2filler4_hK.nextvalue]
/ ontrialbegin = [values.fillervpos4 = list.s2filler4_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos5 = list.s2filler5_hK.nextvalue]
/ ontrialbegin = [values.fillervpos5 = list.s2filler5_vK.nextvalue]
/ ontrialbegin = [values.Ktargetpos_h = list.s2target_hK.nextvalue]
/ ontrialbegin = [values.Ktargetpos_v = list.s2target_vK.nextvalue]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.set2distractorK.nextvalue,500);]
/ ontrialbegin = [values.distractor = list.set2distractorK.currentvalue;]
/ ontrialbegin = [
    if (contains(list.set2distractorK.currentvalue, ".K")) expressions.category = "congruent"
  else if (contains(list.set2distractorK.currentvalue, ".H")) expressions.category = "incongruent";
]
/ ontrialbegin = [
    if (expressions.category== "congruent") values.count_congruent += 1;
  else if (expressions.category== "incongruent") values.count_incongruent += 1;
]
/ ontrialend = [trial.set2KTARGET.resetstimulusframes(); ]
/ stimulustimes = [1=fixation; 500=fixationcover; 600=sequence (eraser1, eraser2, eraser3, eraser4, eraser5, eraser6, eraserleft, eraserright)]
/ validresponse = (36, 23, 57)
/ correctresponse = (36)
/ response = timeout(1900)
/ beginresponsetime = 100
/ ontrialend = [
    if (trial.set2KTARGET.latency >= parameters.minimum_latency)
        values.valid = 1;
    if (values.valid == 1) {
        if (trial.set2KTARGET.correct) {
            values.validcorrect = 1;
            values.sumcorrect += 1;
            values.sumrt += trial.set2KTARGET.latency
            if (expressions.category == "congruent") {
                values.sumcorrect_congruent += 1;
                values.sumrt_congruent += trial.set2KTARGET.latency;
                list.latencies_congruent.insertitem(trial.set2KTARGET.latency, 1);
                list.latencies.insertitem(trial.set2KTARGET.latency, 1);
            } else {
                values.sumcorrect_incongruent += 1;
                values.sumrt_incongruent += trial.set2KTARGET.latency;
                list.latencies_incongruent.insertitem(trial.set2KTARGET.latency, 1);
                list.latencies.insertitem(trial.set2KTARGET.latency, 1);
            }
        }
    } ;
    list.accuracy.insertitem(values.validcorrect, 1);
    values.testeracc = list.accuracy.currentindex
    if (expressions.category == "congruent") {
        list.accuracy_congruent.insertitem(values.validcorrect, 1);
    } else {
        list.accuracy_incongruent.insertitem(values.validcorrect, 1);
    };
]
/ ontrialend= [values.TrialNum = values.TrialNum + 1]
/ isvalidresponse = [if(trial.set2KTARGET.response==57){values.spacebarscount += 1; values.latencies=concat(concat(values.latencies, trial.set2KTARGET.latency),","); false}; ]
/ responseinterrupt = trial
</trial>
By Dave - 4/20/2020

Gy997 - 4/20/2020
Thank you, I tried to add the /isvalidresponse to my trial but now all my trials are incorrect even if I press the correct keys, as if the other keys aren't even recorded.
Perhaps the structure of my trial helps to clarify the issue. I have 2 letters appearing on a horizontal line made of 6 spaces (erasers) plus another distractor letter appearing above/below the letters line. One of the two letters on the horizontal line is the target (in this trial it's is a K). Participant have to press key J whenever they see a K and that is stored as correct response. However, now that I've added to the script the code to store the number of times the spacebar is pressed, in the resulting data table the response column contains only "0" and all responses are marked as incorrect.. :( 

<trial set2KTARGET>
/ ontrialbegin = [
    values.valid = 0;
   values.spacebarscount = 0;
   values.latencies="";
    values.validcorrect = 0;
    values.trialcount += 1]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler1K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler2K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler3K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler4K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler5K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2targetK.nextvalue,500);]
/ ontrialbegin = [values.fillerhpos1 = list.s2filler1_hK.nextvalue]
/ ontrialbegin = [values.fillervpos1 = list.s2filler1_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos2 = list.s2filler2_hK.nextvalue]
/ ontrialbegin = [values.fillervpos2 = list.s2filler2_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos3 = list.s2filler3_hK.nextvalue]
/ ontrialbegin = [values.fillervpos3 = list.s2filler3_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos4 = list.s2filler4_hK.nextvalue]
/ ontrialbegin = [values.fillervpos4 = list.s2filler4_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos5 = list.s2filler5_hK.nextvalue]
/ ontrialbegin = [values.fillervpos5 = list.s2filler5_vK.nextvalue]
/ ontrialbegin = [values.Ktargetpos_h = list.s2target_hK.nextvalue]
/ ontrialbegin = [values.Ktargetpos_v = list.s2target_vK.nextvalue]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.set2distractorK.nextvalue,500);]
/ ontrialbegin = [values.distractor = list.set2distractorK.currentvalue;]
/ ontrialbegin = [
    if (contains(list.set2distractorK.currentvalue, ".K")) expressions.category = "congruent"
  else if (contains(list.set2distractorK.currentvalue, ".H")) expressions.category = "incongruent";
]
/ ontrialbegin = [
    if (expressions.category== "congruent") values.count_congruent += 1;
  else if (expressions.category== "incongruent") values.count_incongruent += 1;
]
/ ontrialend = [trial.set2KTARGET.resetstimulusframes(); ]
/ stimulustimes = [1=fixation; 500=fixationcover; 600=sequence (eraser1, eraser2, eraser3, eraser4, eraser5, eraser6, eraserleft, eraserright)]
/ validresponse = (36, 23, 57)
/ correctresponse = (36)
/ response = timeout(1900)
/ beginresponsetime = 100
/ ontrialend = [
    if (trial.set2KTARGET.latency >= parameters.minimum_latency)
        values.valid = 1;
    if (values.valid == 1) {
        if (trial.set2KTARGET.correct) {
            values.validcorrect = 1;
            values.sumcorrect += 1;
            values.sumrt += trial.set2KTARGET.latency
            if (expressions.category == "congruent") {
                values.sumcorrect_congruent += 1;
                values.sumrt_congruent += trial.set2KTARGET.latency;
                list.latencies_congruent.insertitem(trial.set2KTARGET.latency, 1);
                list.latencies.insertitem(trial.set2KTARGET.latency, 1);
            } else {
                values.sumcorrect_incongruent += 1;
                values.sumrt_incongruent += trial.set2KTARGET.latency;
                list.latencies_incongruent.insertitem(trial.set2KTARGET.latency, 1);
                list.latencies.insertitem(trial.set2KTARGET.latency, 1);
            }
        }
    } ;
    list.accuracy.insertitem(values.validcorrect, 1);
    values.testeracc = list.accuracy.currentindex
    if (expressions.category == "congruent") {
        list.accuracy_congruent.insertitem(values.validcorrect, 1);
    } else {
        list.accuracy_incongruent.insertitem(values.validcorrect, 1);
    };
]
/ ontrialend= [values.TrialNum = values.TrialNum + 1]
/ isvalidresponse = [if(trial.set2KTARGET.response==57){values.spacebarscount += 1; values.latencies=concat(concat(values.latencies, trial.set2KTARGET.latency),","); false}; ]
/ responseinterrupt = trial
</trial>

You need to code your /isvalidresponse logic such that *only* space bar presses are designated as "false", and the others return "true" (and terminate the trial).
By Dave - 4/20/2020

Dave - 4/20/2020
Gy997 - 4/20/2020
Thank you, I tried to add the /isvalidresponse to my trial but now all my trials are incorrect even if I press the correct keys, as if the other keys aren't even recorded.
Perhaps the structure of my trial helps to clarify the issue. I have 2 letters appearing on a horizontal line made of 6 spaces (erasers) plus another distractor letter appearing above/below the letters line. One of the two letters on the horizontal line is the target (in this trial it's is a K). Participant have to press key J whenever they see a K and that is stored as correct response. However, now that I've added to the script the code to store the number of times the spacebar is pressed, in the resulting data table the response column contains only "0" and all responses are marked as incorrect.. :( 

<trial set2KTARGET>
/ ontrialbegin = [
    values.valid = 0;
   values.spacebarscount = 0;
   values.latencies="";
    values.validcorrect = 0;
    values.trialcount += 1]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler1K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler2K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler3K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler4K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler5K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2targetK.nextvalue,500);]
/ ontrialbegin = [values.fillerhpos1 = list.s2filler1_hK.nextvalue]
/ ontrialbegin = [values.fillervpos1 = list.s2filler1_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos2 = list.s2filler2_hK.nextvalue]
/ ontrialbegin = [values.fillervpos2 = list.s2filler2_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos3 = list.s2filler3_hK.nextvalue]
/ ontrialbegin = [values.fillervpos3 = list.s2filler3_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos4 = list.s2filler4_hK.nextvalue]
/ ontrialbegin = [values.fillervpos4 = list.s2filler4_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos5 = list.s2filler5_hK.nextvalue]
/ ontrialbegin = [values.fillervpos5 = list.s2filler5_vK.nextvalue]
/ ontrialbegin = [values.Ktargetpos_h = list.s2target_hK.nextvalue]
/ ontrialbegin = [values.Ktargetpos_v = list.s2target_vK.nextvalue]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.set2distractorK.nextvalue,500);]
/ ontrialbegin = [values.distractor = list.set2distractorK.currentvalue;]
/ ontrialbegin = [
    if (contains(list.set2distractorK.currentvalue, ".K")) expressions.category = "congruent"
  else if (contains(list.set2distractorK.currentvalue, ".H")) expressions.category = "incongruent";
]
/ ontrialbegin = [
    if (expressions.category== "congruent") values.count_congruent += 1;
  else if (expressions.category== "incongruent") values.count_incongruent += 1;
]
/ ontrialend = [trial.set2KTARGET.resetstimulusframes(); ]
/ stimulustimes = [1=fixation; 500=fixationcover; 600=sequence (eraser1, eraser2, eraser3, eraser4, eraser5, eraser6, eraserleft, eraserright)]
/ validresponse = (36, 23, 57)
/ correctresponse = (36)
/ response = timeout(1900)
/ beginresponsetime = 100
/ ontrialend = [
    if (trial.set2KTARGET.latency >= parameters.minimum_latency)
        values.valid = 1;
    if (values.valid == 1) {
        if (trial.set2KTARGET.correct) {
            values.validcorrect = 1;
            values.sumcorrect += 1;
            values.sumrt += trial.set2KTARGET.latency
            if (expressions.category == "congruent") {
                values.sumcorrect_congruent += 1;
                values.sumrt_congruent += trial.set2KTARGET.latency;
                list.latencies_congruent.insertitem(trial.set2KTARGET.latency, 1);
                list.latencies.insertitem(trial.set2KTARGET.latency, 1);
            } else {
                values.sumcorrect_incongruent += 1;
                values.sumrt_incongruent += trial.set2KTARGET.latency;
                list.latencies_incongruent.insertitem(trial.set2KTARGET.latency, 1);
                list.latencies.insertitem(trial.set2KTARGET.latency, 1);
            }
        }
    } ;
    list.accuracy.insertitem(values.validcorrect, 1);
    values.testeracc = list.accuracy.currentindex
    if (expressions.category == "congruent") {
        list.accuracy_congruent.insertitem(values.validcorrect, 1);
    } else {
        list.accuracy_incongruent.insertitem(values.validcorrect, 1);
    };
]
/ ontrialend= [values.TrialNum = values.TrialNum + 1]
/ isvalidresponse = [if(trial.set2KTARGET.response==57){values.spacebarscount += 1; values.latencies=concat(concat(values.latencies, trial.set2KTARGET.latency),","); false}; ]
/ responseinterrupt = trial
</trial>

You need to code your /isvalidresponse logic such that *only* space bar presses are designated as "false", and the others return "true" (and terminate the trial).

Here's a stripped down example:

<values>
/ spacebarscount = 0
/ latencies = ""
</values>

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

<trial example>
/ ontrialbegin = [
    values.spacebarscount = 0;
    values.latencies = "";
]
/ validresponse = (36, 23, 57)
/ isvalidresponse = [
    if(trial.example.response==57) {
    values.spacebarscount += 1;
    values.latencies=concat(concat(values.latencies, trial.example.latency),",");
    false
    } else if (trial.example.response==23 || trial.example.response == 36) {
        true;
    };
]
/ correctresponse = (36)
/ response = timeout(1900)
/ beginresponsetime = 100
</trial>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct values.spacebarscount values.latencies)
/ separatefiles = true
</data>

By Gy997 - 4/20/2020

Thank you so much for your kind help and your patience, it works like a charm!! :)