Problems with string functions


Author
Message
Clusi
Clusi
New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)
Group: Forum Members
Posts: 8, Visits: 19
Hello everyone,
I am computing a learning task in which participants have to recall target words that were previously paired with cue words. As the later tasks depend on the learning task, I want to make sure that participants recalled at least 50% "correct" before continuing the study. This all happens online, so I need to automatize this process. The /iscorrectresponse element works fine, but I think it is too restrictive given the time pressured responses. --> i want to allow for spelling mistakes. Thus, I essentially would like to combine multiple string functions (e.g., correct length +- 1 letter, contains the start, and/or contains the end letters).

However, I am struggling with the correct coding of the expressions attributes. I have tried to put this in any imaginable format but the output just doesn't fit what I want it to look like. So, the rows marked in bold are what I currently came up with, but they don't work properly.

<item real_response_word>
/1 = "HOUR"
/2 = "NECKLACE"
/3 = "COTTON"
/4 = "BOURBON"
/5 = "CIGAR"
</item>

<item real_cue_word>
/1 = "ERRAND"
/2 = "CLUSTER"
/3 = "SNAG"
/4 = "RELIEF"
/5 = "VICE"
</item>

<item shorter_response_word>
/1 = "HOU"
/2 = "NECK"
/3 = "COT"
/4 = "BOUR"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>


<text type_response_word>
/items = ("Type in the RESPONSE word")
/position = (50%, 70%)
/ fontstyle = ("Arial", 5%)
</text>

<text focuspoint>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", 8%)
</text>


<text cue_word_testfeedback>
/ items = real_cue_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ select = noreplacenorepeat
</text>

<text response_word_testfeedback>
/ items = real_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
  toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2 || 0 <= expressions.length_correct_response - expressions.length_personal_response <2 ) values.correct_length = values.correct_length+1]
</openended>

<expressions>
/length_personal_response = length(openended.testfeedback_phase.response)
/length_correct_response = length(item.real_response_word.item(text.cue_word_testfeedback.currentindex))

</expressions>

<values>
/trial_correct = 0
/trial_number = 0
/correct_length = 0
</values>

<summarydata>
/ columns = (values.trial_correct, values.trial_number, values.correct_length)
</summarydata>

feedback
<trial testfeedback_phase_feedback_cycle1>
/stimulustimes = [200=response_word_testfeedback]
/timeout = 2200
/ posttrialpause = 300
</trial>

<block testfeedback_phase>
/ trials = [1-5= sequence(openended.testfeedback_phase, trial.testfeedback_phase_feedback_cycle1)]
</block>

<expt 01testfeedback>
/ blocks = [1=block.testfeedback_phase]
/ stop = [if (values.trial_number == 4 && values.trial_correct<=2)]
</expt>

Thank you all for your help :)

Kind regards,

Clusi

Clusi
Clusi
New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)
Group: Forum Members
Posts: 8, Visits: 19
Clusi - 9/2/2020
Hello everyone,
I am computing a learning task in which participants have to recall target words that were previously paired with cue words. As the later tasks depend on the learning task, I want to make sure that participants recalled at least 50% "correct" before continuing the study. This all happens online, so I need to automatize this process. The /iscorrectresponse element works fine, but I think it is too restrictive given the time pressured responses. --> i want to allow for spelling mistakes. Thus, I essentially would like to combine multiple string functions (e.g., correct length +- 1 letter, contains the start, and/or contains the end letters).

However, I am struggling with the correct coding of the expressions attributes. I have tried to put this in any imaginable format but the output just doesn't fit what I want it to look like. So, the rows marked in bold are what I currently came up with, but they don't work properly.

<item real_response_word>
/1 = "HOUR"
/2 = "NECKLACE"
/3 = "COTTON"
/4 = "BOURBON"
/5 = "CIGAR"
</item>

<item real_cue_word>
/1 = "ERRAND"
/2 = "CLUSTER"
/3 = "SNAG"
/4 = "RELIEF"
/5 = "VICE"
</item>

<item shorter_response_word>
/1 = "HOU"
/2 = "NECK"
/3 = "COT"
/4 = "BOUR"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>


<text type_response_word>
/items = ("Type in the RESPONSE word")
/position = (50%, 70%)
/ fontstyle = ("Arial", 5%)
</text>

<text focuspoint>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", 8%)
</text>


<text cue_word_testfeedback>
/ items = real_cue_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ select = noreplacenorepeat
</text>

<text response_word_testfeedback>
/ items = real_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
  toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2 || 0 <= expressions.length_correct_response - expressions.length_personal_response <2 ) values.correct_length = values.correct_length+1]
</openended>

<expressions>
/length_personal_response = length(openended.testfeedback_phase.response)
/length_correct_response = length(item.real_response_word.item(text.cue_word_testfeedback.currentindex))

</expressions>

<values>
/trial_correct = 0
/trial_number = 0
/correct_length = 0
</values>

<summarydata>
/ columns = (values.trial_correct, values.trial_number, values.correct_length)
</summarydata>

feedback
<trial testfeedback_phase_feedback_cycle1>
/stimulustimes = [200=response_word_testfeedback]
/timeout = 2200
/ posttrialpause = 300
</trial>

<block testfeedback_phase>
/ trials = [1-5= sequence(openended.testfeedback_phase, trial.testfeedback_phase_feedback_cycle1)]
</block>

<expt 01testfeedback>
/ blocks = [1=block.testfeedback_phase]
/ stop = [if (values.trial_number == 4 && values.trial_correct<=2)]
</expt>

Thank you all for your help :)

Kind regards,

Clusi

I have also tried to tear the /ontrialend command apart into if else attributes, but that also returns a value of 4 no matter the amount of letters in the participants' answers:
/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2)
                {
                values.correct_length = values.correct_length+1;
                }
                else if (0 <= expressions.length_correct_response - expressions.length_personal_response <2)
                {
                values.correct_length = values.correct_length+1
                }
                else
                {
                values.correct_length = values.correct_length
                }
                ]

Dave
Dave
Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)
Group: Administrators
Posts: 10K, Visits: 59K
Clusi - 9/2/2020
Clusi - 9/2/2020
Hello everyone,
I am computing a learning task in which participants have to recall target words that were previously paired with cue words. As the later tasks depend on the learning task, I want to make sure that participants recalled at least 50% "correct" before continuing the study. This all happens online, so I need to automatize this process. The /iscorrectresponse element works fine, but I think it is too restrictive given the time pressured responses. --> i want to allow for spelling mistakes. Thus, I essentially would like to combine multiple string functions (e.g., correct length +- 1 letter, contains the start, and/or contains the end letters).

However, I am struggling with the correct coding of the expressions attributes. I have tried to put this in any imaginable format but the output just doesn't fit what I want it to look like. So, the rows marked in bold are what I currently came up with, but they don't work properly.

<item real_response_word>
/1 = "HOUR"
/2 = "NECKLACE"
/3 = "COTTON"
/4 = "BOURBON"
/5 = "CIGAR"
</item>

<item real_cue_word>
/1 = "ERRAND"
/2 = "CLUSTER"
/3 = "SNAG"
/4 = "RELIEF"
/5 = "VICE"
</item>

<item shorter_response_word>
/1 = "HOU"
/2 = "NECK"
/3 = "COT"
/4 = "BOUR"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>


<text type_response_word>
/items = ("Type in the RESPONSE word")
/position = (50%, 70%)
/ fontstyle = ("Arial", 5%)
</text>

<text focuspoint>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", 8%)
</text>


<text cue_word_testfeedback>
/ items = real_cue_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ select = noreplacenorepeat
</text>

<text response_word_testfeedback>
/ items = real_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
  toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2 || 0 <= expressions.length_correct_response - expressions.length_personal_response <2 ) values.correct_length = values.correct_length+1]
</openended>

<expressions>
/length_personal_response = length(openended.testfeedback_phase.response)
/length_correct_response = length(item.real_response_word.item(text.cue_word_testfeedback.currentindex))

</expressions>

<values>
/trial_correct = 0
/trial_number = 0
/correct_length = 0
</values>

<summarydata>
/ columns = (values.trial_correct, values.trial_number, values.correct_length)
</summarydata>

feedback
<trial testfeedback_phase_feedback_cycle1>
/stimulustimes = [200=response_word_testfeedback]
/timeout = 2200
/ posttrialpause = 300
</trial>

<block testfeedback_phase>
/ trials = [1-5= sequence(openended.testfeedback_phase, trial.testfeedback_phase_feedback_cycle1)]
</block>

<expt 01testfeedback>
/ blocks = [1=block.testfeedback_phase]
/ stop = [if (values.trial_number == 4 && values.trial_correct<=2)]
</expt>

Thank you all for your help :)

Kind regards,

Clusi

I have also tried to tear the /ontrialend command apart into if else attributes, but that also returns a value of 4 no matter the amount of letters in the participants' answers:
/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2)
                {
                values.correct_length = values.correct_length+1;
                }
                else if (0 <= expressions.length_correct_response - expressions.length_personal_response <2)
                {
                values.correct_length = values.correct_length+1
                }
                else
                {
                values.correct_length = values.correct_length
                }
                ]

The correct formulation is something along the below lines:

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) >= 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
</openended>
Clusi
Clusi
New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)
Group: Forum Members
Posts: 8, Visits: 19
Dave - 9/2/2020
Clusi - 9/2/2020
Clusi - 9/2/2020
Hello everyone,
I am computing a learning task in which participants have to recall target words that were previously paired with cue words. As the later tasks depend on the learning task, I want to make sure that participants recalled at least 50% "correct" before continuing the study. This all happens online, so I need to automatize this process. The /iscorrectresponse element works fine, but I think it is too restrictive given the time pressured responses. --> i want to allow for spelling mistakes. Thus, I essentially would like to combine multiple string functions (e.g., correct length +- 1 letter, contains the start, and/or contains the end letters).

However, I am struggling with the correct coding of the expressions attributes. I have tried to put this in any imaginable format but the output just doesn't fit what I want it to look like. So, the rows marked in bold are what I currently came up with, but they don't work properly.

<item real_response_word>
/1 = "HOUR"
/2 = "NECKLACE"
/3 = "COTTON"
/4 = "BOURBON"
/5 = "CIGAR"
</item>

<item real_cue_word>
/1 = "ERRAND"
/2 = "CLUSTER"
/3 = "SNAG"
/4 = "RELIEF"
/5 = "VICE"
</item>

<item shorter_response_word>
/1 = "HOU"
/2 = "NECK"
/3 = "COT"
/4 = "BOUR"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>


<text type_response_word>
/items = ("Type in the RESPONSE word")
/position = (50%, 70%)
/ fontstyle = ("Arial", 5%)
</text>

<text focuspoint>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", 8%)
</text>


<text cue_word_testfeedback>
/ items = real_cue_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ select = noreplacenorepeat
</text>

<text response_word_testfeedback>
/ items = real_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
  toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2 || 0 <= expressions.length_correct_response - expressions.length_personal_response <2 ) values.correct_length = values.correct_length+1]
</openended>

<expressions>
/length_personal_response = length(openended.testfeedback_phase.response)
/length_correct_response = length(item.real_response_word.item(text.cue_word_testfeedback.currentindex))

</expressions>

<values>
/trial_correct = 0
/trial_number = 0
/correct_length = 0
</values>

<summarydata>
/ columns = (values.trial_correct, values.trial_number, values.correct_length)
</summarydata>

feedback
<trial testfeedback_phase_feedback_cycle1>
/stimulustimes = [200=response_word_testfeedback]
/timeout = 2200
/ posttrialpause = 300
</trial>

<block testfeedback_phase>
/ trials = [1-5= sequence(openended.testfeedback_phase, trial.testfeedback_phase_feedback_cycle1)]
</block>

<expt 01testfeedback>
/ blocks = [1=block.testfeedback_phase]
/ stop = [if (values.trial_number == 4 && values.trial_correct<=2)]
</expt>

Thank you all for your help :)

Kind regards,

Clusi

I have also tried to tear the /ontrialend command apart into if else attributes, but that also returns a value of 4 no matter the amount of letters in the participants' answers:
/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2)
                {
                values.correct_length = values.correct_length+1;
                }
                else if (0 <= expressions.length_correct_response - expressions.length_personal_response <2)
                {
                values.correct_length = values.correct_length+1
                }
                else
                {
                values.correct_length = values.correct_length
                }
                ]

The correct formulation is something along the below lines:

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) >= 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
</openended>

Thanks for the quick answer. So I will need to have 2 rows of /ontrialend for 1) if the participants response is too short and 2) if it is too long? Also, can you explain to me what exactly the 'abs' means and when I have to use it?

Clusi
Clusi
New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)
Group: Forum Members
Posts: 8, Visits: 19
Dave - 9/2/2020
Clusi - 9/2/2020
Clusi - 9/2/2020
Hello everyone,
I am computing a learning task in which participants have to recall target words that were previously paired with cue words. As the later tasks depend on the learning task, I want to make sure that participants recalled at least 50% "correct" before continuing the study. This all happens online, so I need to automatize this process. The /iscorrectresponse element works fine, but I think it is too restrictive given the time pressured responses. --> i want to allow for spelling mistakes. Thus, I essentially would like to combine multiple string functions (e.g., correct length +- 1 letter, contains the start, and/or contains the end letters).

However, I am struggling with the correct coding of the expressions attributes. I have tried to put this in any imaginable format but the output just doesn't fit what I want it to look like. So, the rows marked in bold are what I currently came up with, but they don't work properly.

<item real_response_word>
/1 = "HOUR"
/2 = "NECKLACE"
/3 = "COTTON"
/4 = "BOURBON"
/5 = "CIGAR"
</item>

<item real_cue_word>
/1 = "ERRAND"
/2 = "CLUSTER"
/3 = "SNAG"
/4 = "RELIEF"
/5 = "VICE"
</item>

<item shorter_response_word>
/1 = "HOU"
/2 = "NECK"
/3 = "COT"
/4 = "BOUR"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>


<text type_response_word>
/items = ("Type in the RESPONSE word")
/position = (50%, 70%)
/ fontstyle = ("Arial", 5%)
</text>

<text focuspoint>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", 8%)
</text>


<text cue_word_testfeedback>
/ items = real_cue_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ select = noreplacenorepeat
</text>

<text response_word_testfeedback>
/ items = real_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
  toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2 || 0 <= expressions.length_correct_response - expressions.length_personal_response <2 ) values.correct_length = values.correct_length+1]
</openended>

<expressions>
/length_personal_response = length(openended.testfeedback_phase.response)
/length_correct_response = length(item.real_response_word.item(text.cue_word_testfeedback.currentindex))

</expressions>

<values>
/trial_correct = 0
/trial_number = 0
/correct_length = 0
</values>

<summarydata>
/ columns = (values.trial_correct, values.trial_number, values.correct_length)
</summarydata>

feedback
<trial testfeedback_phase_feedback_cycle1>
/stimulustimes = [200=response_word_testfeedback]
/timeout = 2200
/ posttrialpause = 300
</trial>

<block testfeedback_phase>
/ trials = [1-5= sequence(openended.testfeedback_phase, trial.testfeedback_phase_feedback_cycle1)]
</block>

<expt 01testfeedback>
/ blocks = [1=block.testfeedback_phase]
/ stop = [if (values.trial_number == 4 && values.trial_correct<=2)]
</expt>

Thank you all for your help :)

Kind regards,

Clusi

I have also tried to tear the /ontrialend command apart into if else attributes, but that also returns a value of 4 no matter the amount of letters in the participants' answers:
/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2)
                {
                values.correct_length = values.correct_length+1;
                }
                else if (0 <= expressions.length_correct_response - expressions.length_personal_response <2)
                {
                values.correct_length = values.correct_length+1
                }
                else
                {
                values.correct_length = values.correct_length
                }
                ]

The correct formulation is something along the below lines:

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) >= 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
</openended>

Do you know why it happens, that the values.correct_length always receive +2 values if a condition is correct with the following 2 lines?
so when i spell 2 out of 4 words incorrectly via either having 1 letter too much or too little, it automatically adds +4, instead of the supposed +2...


/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) > 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
/ ontrialend = [if (abs(expressions.length_personal_response - expressions.length_correct_response) > 0 && abs(expressions.length_personal_response - expressions.length_correct_response) < 2) values.correct_length += 1;]



Clusi
Clusi
New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)
Group: Forum Members
Posts: 8, Visits: 19
Clusi - 9/2/2020
Dave - 9/2/2020
Clusi - 9/2/2020
Clusi - 9/2/2020
Hello everyone,
I am computing a learning task in which participants have to recall target words that were previously paired with cue words. As the later tasks depend on the learning task, I want to make sure that participants recalled at least 50% "correct" before continuing the study. This all happens online, so I need to automatize this process. The /iscorrectresponse element works fine, but I think it is too restrictive given the time pressured responses. --> i want to allow for spelling mistakes. Thus, I essentially would like to combine multiple string functions (e.g., correct length +- 1 letter, contains the start, and/or contains the end letters).

However, I am struggling with the correct coding of the expressions attributes. I have tried to put this in any imaginable format but the output just doesn't fit what I want it to look like. So, the rows marked in bold are what I currently came up with, but they don't work properly.

<item real_response_word>
/1 = "HOUR"
/2 = "NECKLACE"
/3 = "COTTON"
/4 = "BOURBON"
/5 = "CIGAR"
</item>

<item real_cue_word>
/1 = "ERRAND"
/2 = "CLUSTER"
/3 = "SNAG"
/4 = "RELIEF"
/5 = "VICE"
</item>

<item shorter_response_word>
/1 = "HOU"
/2 = "NECK"
/3 = "COT"
/4 = "BOUR"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>


<text type_response_word>
/items = ("Type in the RESPONSE word")
/position = (50%, 70%)
/ fontstyle = ("Arial", 5%)
</text>

<text focuspoint>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", 8%)
</text>


<text cue_word_testfeedback>
/ items = real_cue_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ select = noreplacenorepeat
</text>

<text response_word_testfeedback>
/ items = real_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
  toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2 || 0 <= expressions.length_correct_response - expressions.length_personal_response <2 ) values.correct_length = values.correct_length+1]
</openended>

<expressions>
/length_personal_response = length(openended.testfeedback_phase.response)
/length_correct_response = length(item.real_response_word.item(text.cue_word_testfeedback.currentindex))

</expressions>

<values>
/trial_correct = 0
/trial_number = 0
/correct_length = 0
</values>

<summarydata>
/ columns = (values.trial_correct, values.trial_number, values.correct_length)
</summarydata>

feedback
<trial testfeedback_phase_feedback_cycle1>
/stimulustimes = [200=response_word_testfeedback]
/timeout = 2200
/ posttrialpause = 300
</trial>

<block testfeedback_phase>
/ trials = [1-5= sequence(openended.testfeedback_phase, trial.testfeedback_phase_feedback_cycle1)]
</block>

<expt 01testfeedback>
/ blocks = [1=block.testfeedback_phase]
/ stop = [if (values.trial_number == 4 && values.trial_correct<=2)]
</expt>

Thank you all for your help :)

Kind regards,

Clusi

I have also tried to tear the /ontrialend command apart into if else attributes, but that also returns a value of 4 no matter the amount of letters in the participants' answers:
/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2)
                {
                values.correct_length = values.correct_length+1;
                }
                else if (0 <= expressions.length_correct_response - expressions.length_personal_response <2)
                {
                values.correct_length = values.correct_length+1
                }
                else
                {
                values.correct_length = values.correct_length
                }
                ]

The correct formulation is something along the below lines:

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) >= 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
</openended>

Do you know why it happens, that the values.correct_length always receive +2 values if a condition is correct with the following 2 lines?
so when i spell 2 out of 4 words incorrectly via either having 1 letter too much or too little, it automatically adds +4, instead of the supposed +2...


/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) > 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
/ ontrialend = [if (abs(expressions.length_personal_response - expressions.length_correct_response) > 0 && abs(expressions.length_personal_response - expressions.length_correct_response) < 2) values.correct_length += 1;]



okay please forget about this message, i figured the abs returns the absolute value :) so adding another line of the reversed things will return exactly  the same -.
Dave
Dave
Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)
Group: Administrators
Posts: 10K, Visits: 59K
Clusi - 9/2/2020
Clusi - 9/2/2020
Dave - 9/2/2020
Clusi - 9/2/2020
Clusi - 9/2/2020
Hello everyone,
I am computing a learning task in which participants have to recall target words that were previously paired with cue words. As the later tasks depend on the learning task, I want to make sure that participants recalled at least 50% "correct" before continuing the study. This all happens online, so I need to automatize this process. The /iscorrectresponse element works fine, but I think it is too restrictive given the time pressured responses. --> i want to allow for spelling mistakes. Thus, I essentially would like to combine multiple string functions (e.g., correct length +- 1 letter, contains the start, and/or contains the end letters).

However, I am struggling with the correct coding of the expressions attributes. I have tried to put this in any imaginable format but the output just doesn't fit what I want it to look like. So, the rows marked in bold are what I currently came up with, but they don't work properly.

<item real_response_word>
/1 = "HOUR"
/2 = "NECKLACE"
/3 = "COTTON"
/4 = "BOURBON"
/5 = "CIGAR"
</item>

<item real_cue_word>
/1 = "ERRAND"
/2 = "CLUSTER"
/3 = "SNAG"
/4 = "RELIEF"
/5 = "VICE"
</item>

<item shorter_response_word>
/1 = "HOU"
/2 = "NECK"
/3 = "COT"
/4 = "BOUR"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>


<text type_response_word>
/items = ("Type in the RESPONSE word")
/position = (50%, 70%)
/ fontstyle = ("Arial", 5%)
</text>

<text focuspoint>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", 8%)
</text>


<text cue_word_testfeedback>
/ items = real_cue_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ select = noreplacenorepeat
</text>

<text response_word_testfeedback>
/ items = real_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
  toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2 || 0 <= expressions.length_correct_response - expressions.length_personal_response <2 ) values.correct_length = values.correct_length+1]
</openended>

<expressions>
/length_personal_response = length(openended.testfeedback_phase.response)
/length_correct_response = length(item.real_response_word.item(text.cue_word_testfeedback.currentindex))

</expressions>

<values>
/trial_correct = 0
/trial_number = 0
/correct_length = 0
</values>

<summarydata>
/ columns = (values.trial_correct, values.trial_number, values.correct_length)
</summarydata>

feedback
<trial testfeedback_phase_feedback_cycle1>
/stimulustimes = [200=response_word_testfeedback]
/timeout = 2200
/ posttrialpause = 300
</trial>

<block testfeedback_phase>
/ trials = [1-5= sequence(openended.testfeedback_phase, trial.testfeedback_phase_feedback_cycle1)]
</block>

<expt 01testfeedback>
/ blocks = [1=block.testfeedback_phase]
/ stop = [if (values.trial_number == 4 && values.trial_correct<=2)]
</expt>

Thank you all for your help :)

Kind regards,

Clusi

I have also tried to tear the /ontrialend command apart into if else attributes, but that also returns a value of 4 no matter the amount of letters in the participants' answers:
/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2)
                {
                values.correct_length = values.correct_length+1;
                }
                else if (0 <= expressions.length_correct_response - expressions.length_personal_response <2)
                {
                values.correct_length = values.correct_length+1
                }
                else
                {
                values.correct_length = values.correct_length
                }
                ]

The correct formulation is something along the below lines:

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) >= 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
</openended>

Do you know why it happens, that the values.correct_length always receive +2 values if a condition is correct with the following 2 lines?
so when i spell 2 out of 4 words incorrectly via either having 1 letter too much or too little, it automatically adds +4, instead of the supposed +2...


/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) > 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
/ ontrialend = [if (abs(expressions.length_personal_response - expressions.length_correct_response) > 0 && abs(expressions.length_personal_response - expressions.length_correct_response) < 2) values.correct_length += 1;]



okay please forget about this message, i figured the abs returns the absolute value :) so adding another line of the reversed things will return exactly  the same -.

That's right. The reason for using abs(), i.e. returning the absolute value of the difference, was to avoid multiple statements and rather fold it all into one.

Clusi
Clusi
New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)New Member (24 reputation)
Group: Forum Members
Posts: 8, Visits: 19
Dave - 9/2/2020
Clusi - 9/2/2020
Clusi - 9/2/2020
Dave - 9/2/2020
Clusi - 9/2/2020
Clusi - 9/2/2020
Hello everyone,
I am computing a learning task in which participants have to recall target words that were previously paired with cue words. As the later tasks depend on the learning task, I want to make sure that participants recalled at least 50% "correct" before continuing the study. This all happens online, so I need to automatize this process. The /iscorrectresponse element works fine, but I think it is too restrictive given the time pressured responses. --> i want to allow for spelling mistakes. Thus, I essentially would like to combine multiple string functions (e.g., correct length +- 1 letter, contains the start, and/or contains the end letters).

However, I am struggling with the correct coding of the expressions attributes. I have tried to put this in any imaginable format but the output just doesn't fit what I want it to look like. So, the rows marked in bold are what I currently came up with, but they don't work properly.

<item real_response_word>
/1 = "HOUR"
/2 = "NECKLACE"
/3 = "COTTON"
/4 = "BOURBON"
/5 = "CIGAR"
</item>

<item real_cue_word>
/1 = "ERRAND"
/2 = "CLUSTER"
/3 = "SNAG"
/4 = "RELIEF"
/5 = "VICE"
</item>

<item shorter_response_word>
/1 = "HOU"
/2 = "NECK"
/3 = "COT"
/4 = "BOUR"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>


<text type_response_word>
/items = ("Type in the RESPONSE word")
/position = (50%, 70%)
/ fontstyle = ("Arial", 5%)
</text>

<text focuspoint>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", 8%)
</text>


<text cue_word_testfeedback>
/ items = real_cue_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ select = noreplacenorepeat
</text>

<text response_word_testfeedback>
/ items = real_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
  toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2 || 0 <= expressions.length_correct_response - expressions.length_personal_response <2 ) values.correct_length = values.correct_length+1]
</openended>

<expressions>
/length_personal_response = length(openended.testfeedback_phase.response)
/length_correct_response = length(item.real_response_word.item(text.cue_word_testfeedback.currentindex))

</expressions>

<values>
/trial_correct = 0
/trial_number = 0
/correct_length = 0
</values>

<summarydata>
/ columns = (values.trial_correct, values.trial_number, values.correct_length)
</summarydata>

feedback
<trial testfeedback_phase_feedback_cycle1>
/stimulustimes = [200=response_word_testfeedback]
/timeout = 2200
/ posttrialpause = 300
</trial>

<block testfeedback_phase>
/ trials = [1-5= sequence(openended.testfeedback_phase, trial.testfeedback_phase_feedback_cycle1)]
</block>

<expt 01testfeedback>
/ blocks = [1=block.testfeedback_phase]
/ stop = [if (values.trial_number == 4 && values.trial_correct<=2)]
</expt>

Thank you all for your help :)

Kind regards,

Clusi

I have also tried to tear the /ontrialend command apart into if else attributes, but that also returns a value of 4 no matter the amount of letters in the participants' answers:
/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2)
                {
                values.correct_length = values.correct_length+1;
                }
                else if (0 <= expressions.length_correct_response - expressions.length_personal_response <2)
                {
                values.correct_length = values.correct_length+1
                }
                else
                {
                values.correct_length = values.correct_length
                }
                ]

The correct formulation is something along the below lines:

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) >= 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
</openended>

Do you know why it happens, that the values.correct_length always receive +2 values if a condition is correct with the following 2 lines?
so when i spell 2 out of 4 words incorrectly via either having 1 letter too much or too little, it automatically adds +4, instead of the supposed +2...


/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) > 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
/ ontrialend = [if (abs(expressions.length_personal_response - expressions.length_correct_response) > 0 && abs(expressions.length_personal_response - expressions.length_correct_response) < 2) values.correct_length += 1;]



okay please forget about this message, i figured the abs returns the absolute value :) so adding another line of the reversed things will return exactly  the same -.

That's right. The reason for using abs(), i.e. returning the absolute value of the difference, was to avoid multiple statements and rather fold it all into one.

alright makes sense. And if I want to add the "contains" function, is it fine if I just say
/ ontrialend = [if (expressions.contains_begin == true) values.correct_begin +=1]

with
/contains_begin = contains(openended.testfeedback_phase.response, item.shorter_response_word.item(text.cue_word_testfeedback.currentindex))

and
<item shorter_response_word>
/1 = "HOU"
/2 = "NEC"
/3 = "COT"
/4 = "BOU"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>
Dave
Dave
Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)Supreme Being (854K reputation)
Group: Administrators
Posts: 10K, Visits: 59K
Clusi - 9/2/2020
Dave - 9/2/2020
Clusi - 9/2/2020
Clusi - 9/2/2020
Dave - 9/2/2020
Clusi - 9/2/2020
Clusi - 9/2/2020
Hello everyone,
I am computing a learning task in which participants have to recall target words that were previously paired with cue words. As the later tasks depend on the learning task, I want to make sure that participants recalled at least 50% "correct" before continuing the study. This all happens online, so I need to automatize this process. The /iscorrectresponse element works fine, but I think it is too restrictive given the time pressured responses. --> i want to allow for spelling mistakes. Thus, I essentially would like to combine multiple string functions (e.g., correct length +- 1 letter, contains the start, and/or contains the end letters).

However, I am struggling with the correct coding of the expressions attributes. I have tried to put this in any imaginable format but the output just doesn't fit what I want it to look like. So, the rows marked in bold are what I currently came up with, but they don't work properly.

<item real_response_word>
/1 = "HOUR"
/2 = "NECKLACE"
/3 = "COTTON"
/4 = "BOURBON"
/5 = "CIGAR"
</item>

<item real_cue_word>
/1 = "ERRAND"
/2 = "CLUSTER"
/3 = "SNAG"
/4 = "RELIEF"
/5 = "VICE"
</item>

<item shorter_response_word>
/1 = "HOU"
/2 = "NECK"
/3 = "COT"
/4 = "BOUR"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>


<text type_response_word>
/items = ("Type in the RESPONSE word")
/position = (50%, 70%)
/ fontstyle = ("Arial", 5%)
</text>

<text focuspoint>
/items = ("+")
/position = (50%, 50%)
/ fontstyle = ("Arial", 8%)
</text>


<text cue_word_testfeedback>
/ items = real_cue_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ select = noreplacenorepeat
</text>

<text response_word_testfeedback>
/ items = real_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
  toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2 || 0 <= expressions.length_correct_response - expressions.length_personal_response <2 ) values.correct_length = values.correct_length+1]
</openended>

<expressions>
/length_personal_response = length(openended.testfeedback_phase.response)
/length_correct_response = length(item.real_response_word.item(text.cue_word_testfeedback.currentindex))

</expressions>

<values>
/trial_correct = 0
/trial_number = 0
/correct_length = 0
</values>

<summarydata>
/ columns = (values.trial_correct, values.trial_number, values.correct_length)
</summarydata>

feedback
<trial testfeedback_phase_feedback_cycle1>
/stimulustimes = [200=response_word_testfeedback]
/timeout = 2200
/ posttrialpause = 300
</trial>

<block testfeedback_phase>
/ trials = [1-5= sequence(openended.testfeedback_phase, trial.testfeedback_phase_feedback_cycle1)]
</block>

<expt 01testfeedback>
/ blocks = [1=block.testfeedback_phase]
/ stop = [if (values.trial_number == 4 && values.trial_correct<=2)]
</expt>

Thank you all for your help :)

Kind regards,

Clusi

I have also tried to tear the /ontrialend command apart into if else attributes, but that also returns a value of 4 no matter the amount of letters in the participants' answers:
/ ontrialend = [if (0 <= expressions.length_personal_response - expressions.length_correct_response <2)
                {
                values.correct_length = values.correct_length+1;
                }
                else if (0 <= expressions.length_correct_response - expressions.length_personal_response <2)
                {
                values.correct_length = values.correct_length+1
                }
                else
                {
                values.correct_length = values.correct_length
                }
                ]

The correct formulation is something along the below lines:

<openended testfeedback_phase>
/ stimulustimes = [0= text.focuspoint; 200=cue_word_testfeedback; 200=text.type_response_word]
/ response = correct
/ iscorrectresponse = [
toupper(openended.testfeedback_phase.response) == item.real_response_word.item(text.cue_word_testfeedback.currentindex);
]

/ position = (50,90)
/ recorddata = true
/ timeout = 5400
/ ontrialend = [values.trial_number = values.trial_number+1]
/ ontrialend = [if(openended.testfeedback_phase.correct) values.trial_correct = values.trial_correct+1]

/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) >= 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
</openended>

Do you know why it happens, that the values.correct_length always receive +2 values if a condition is correct with the following 2 lines?
so when i spell 2 out of 4 words incorrectly via either having 1 letter too much or too little, it automatically adds +4, instead of the supposed +2...


/ ontrialend = [if (abs(expressions.length_correct_response - expressions.length_personal_response) > 0 && abs(expressions.length_correct_response - expressions.length_personal_response) < 2) values.correct_length += 1;]
/ ontrialend = [if (abs(expressions.length_personal_response - expressions.length_correct_response) > 0 && abs(expressions.length_personal_response - expressions.length_correct_response) < 2) values.correct_length += 1;]



okay please forget about this message, i figured the abs returns the absolute value :) so adding another line of the reversed things will return exactly  the same -.

That's right. The reason for using abs(), i.e. returning the absolute value of the difference, was to avoid multiple statements and rather fold it all into one.

alright makes sense. And if I want to add the "contains" function, is it fine if I just say
/ ontrialend = [if (expressions.contains_begin == true) values.correct_begin +=1]

with
/contains_begin = contains(openended.testfeedback_phase.response, item.shorter_response_word.item(text.cue_word_testfeedback.currentindex))

and
<item shorter_response_word>
/1 = "HOU"
/2 = "NEC"
/3 = "COT"
/4 = "BOU"
/5 = "CIG"
</item>

<text shorter_response_word>
/ items = shorter_response_word
/ fontstyle = ("Arial", 8%)
/ position = (50%, 50%)
/ color = blue
/ select = text.cue_word_testfeedback.currentitemnumber
</text>

It's case-sensitive, so you'll probably want to go for

/contains_begin = contains(toupper(openended.testfeedback_phase.response), item.shorter_response_word.item(text.cue_word_testfeedback.currentindex))


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search