repeat a trial in case of no-response


Author
Message
saviano
saviano
New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)
Group: Forum Members
Posts: 6, Visits: 34
Hi, 
I'm completely new in Inquisit. I'm trying to create an experiment on pleasantness judgments: the participant will see on the screen a photo and through two buttons he will be able to choose whether he likes it or not. There are four trials total, and I wish, in case of no-response, for a text to appear on the screen and for the trial to be repeated, but I have some issues. Can somebody help me?
Thanks.

<parameters>
/ numberTrials = 8
</parameters>

<text noresponse>
/ items = ("Try to be faster next time")
</text>

<list practice>
/ items = (trial.selectTrial)
/ poolsize = parameters.numberTrials
</list>

<trial selectTrial>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
    if (values.condition == 1){
        return trial.congruent;
    }
]
/ trialduration = 1000
</trial>

<trial congruent>
/ stimulustimes = [0 = practicefaces, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = 3000
/ branch = [
    if (trial.congruent_practice.error){
        return trial.repeat;
    } else {
        list.practice.nextvalue;
    }
]
</trial>

<trial repeat>
/ontrialbegin = [
    if (trial.congruent.response == 0){
        trial.repeat.insertstimulusframe(text.noresponse, 1)
        }
]
/ timeout = 3000
/ branch = [
    list.practice.currentvalue;
]
/ ontrialend = [
    trial.repeat.resetStimulusFrames();
]
</trial>




Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 102K
federico2001 - 7/22/2024
Hi, 
I'm completely new in Inquisit. I'm trying to create an experiment on pleasantness judgments: the participant will see on the screen a photo and through two buttons he will be able to choose whether he likes it or not. There are four trials total, and I wish, in case of no-response, for a text to appear on the screen and for the trial to be repeated, but I have some issues. Can somebody help me?
Thanks.

<parameters>
/ numberTrials = 8
</parameters>

<text noresponse>
/ items = ("Try to be faster next time")
</text>

<list practice>
/ items = (trial.selectTrial)
/ poolsize = parameters.numberTrials
</list>

<trial selectTrial>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
    if (values.condition == 1){
        return trial.congruent;
    }
]
/ trialduration = 1000
</trial>

<trial congruent>
/ stimulustimes = [0 = practicefaces, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = 3000
/ branch = [
    if (trial.congruent_practice.error){
        return trial.repeat;
    } else {
        list.practice.nextvalue;
    }
]
</trial>

<trial repeat>
/ontrialbegin = [
    if (trial.congruent.response == 0){
        trial.repeat.insertstimulusframe(text.noresponse, 1)
        }
]
/ timeout = 3000
/ branch = [
    list.practice.currentvalue;
]
/ ontrialend = [
    trial.repeat.resetStimulusFrames();
]
</trial>




Provide complete, runnable code, not isolated snippets, please. They are not useful and most of what's relevant is missing.

Edited 2 Months Ago by Dave
saviano
saviano
New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)
Group: Forum Members
Posts: 6, Visits: 34
Dave - 7/22/2024
federico2001 - 7/22/2024
Hi, 
I'm completely new in Inquisit. I'm trying to create an experiment on pleasantness judgments: the participant will see on the screen a photo and through two buttons he will be able to choose whether he likes it or not. There are four trials total, and I wish, in case of no-response, for a text to appear on the screen and for the trial to be repeated, but I have some issues. Can somebody help me?
Thanks.

<parameters>
/ numberTrials = 8
</parameters>

<text noresponse>
/ items = ("Try to be faster next time")
</text>

<list practice>
/ items = (trial.selectTrial)
/ poolsize = parameters.numberTrials
</list>

<trial selectTrial>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
    if (values.condition == 1){
        return trial.congruent;
    }
]
/ trialduration = 1000
</trial>

<trial congruent>
/ stimulustimes = [0 = practicefaces, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = 3000
/ branch = [
    if (trial.congruent_practice.error){
        return trial.repeat;
    } else {
        list.practice.nextvalue;
    }
]
</trial>

<trial repeat>
/ontrialbegin = [
    if (trial.congruent.response == 0){
        trial.repeat.insertstimulusframe(text.noresponse, 1)
        }
]
/ timeout = 3000
/ branch = [
    list.practice.currentvalue;
]
/ ontrialend = [
    trial.repeat.resetStimulusFrames();
]
</trial>




Provide complete, runnable code, not isolated snippets, please. They are not useful and most of what's relevant is missing.

Very sorry,
I'll send the complete code so far. There are two blocks and the function to repeat the trial is implemented only in the trial.congruent_practice (I wanted to solve the problem first and then implement it in the second one too).
Better now?

<defaults>
/ inputdevice = mouse
</defaults>

<parameters>
/ numberPracticeTrials = 8

/ picSize = 25%
/ fixationSize = 15%
/ left_x = 40%
/ right_x = 60%
</parameters>

<values>
/ condition = 1
</values>

<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", parameters.fixationSize, false, false, false, false, 5, 1)
/ position = (50%, 50%)
/ erase = false
/ vjustify = center
</text>

<picture practiceFaces>
/ items = pictureitemspractice
/ select = noreplace
/ size = (parameters.picSize, parameters.picSize)
/ erase = false
</picture>

<item pictureitemspractice>
/ 1 = "1DD_prova.png"
/ 2 = "1DS_prova.png"
/ 3 = "1MD_prova.png"
/ 4 = "1MS_prova.png"
/ 5 = "2DD_prova.png"
/ 6 = "2DS_prova.png"
/ 7 = "2MD_prova.png"
/ 8 = "2MS_prova.png"
/ 9 = "3DD_prova.png"
/ 10 = "3DS_prova.png"
/ 11 = "3MD_prova.png"
/ 12 = "3MS_prova.png"
/ 13 = "4DD_prova.png"
/ 14 = "4DS_prova.png"
/ 15 = "5DD_prova.png"
/ 16 = "5DS_prova.png"
</item>

<picture dislikeds>
/ items = ("dislike.png")
/ position = (parameters.right_x, 90%)
/ size = (30%, 30%)
</picture>

<picture likesx>
/ items = ("like.png")
/ position = (parameters.left_x, 85%)
/ size = (30%, 30%)
</picture>

<picture dislikesx>
/ items = ("dislike.png")
/ position = (parameters.left_x, 90%)
/ size = (30%, 30%)
</picture>

<picture likeds>
/ items = ("like.png")
/ position = (parameters.right_x, 85%)
/ size = (30%, 30%)
</picture>

<text noResponseText>
/ items = ("Cerca di rispondere più velocemente la prossima volta")
/ position = (50%, 20%)
/ fontstyle = ("Arial", 5%, true, false, false, false, 5, 1)
/ size = (80%, 10%)
/ vjustify = center
/ txcolor = blue
</text>

<list practice>
/ items = (trial.selectTrial_practice)
/ poolsize = parameters.numberPracticeTrials
</list>

<trial selectTrial_practice>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
    if (values.condition == 1){
        return trial.congruent_practice;
    }
    else if (values.condition == 2){
        return trial.incongruent_practice;
    }
]
/ trialduration = 1000
/ recorddata = false
</trial>

<trial congruent_practice>
/ stimulustimes = [0 = practicefaces, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = 3000
/ branch = [
    if (trial.congruent_practice.error){
        return trial.repeat_c;
    } else {
        list.practice.nextvalue;
    }
]
</trial>

<trial incongruent_practice>
/ stimulustimes = [0 = practicefaces, likesx, dislikeds]
/ validresponse = (noresponse, likesx, dislikeds)
/ timeout = 3000
/ branch = [
    list.practice.nextvalue;
]
</trial>

<trial repeat_c>
/ontrialbegin = [
    if (trial.congruent_practice.response == 0){
        trial.repeat_c.insertstimulusframe(text.noResponseText, 1)
        }
]
/ timeout = 3000
/ branch = [
    list.practice.currentvalue;
]
/ ontrialend = [
    trial.repeat_c.resetStimulusFrames();
]
</trial>

<block practice_congruent>
/ stop = [
  block.practice_congruent.trialcount >= parameters.numberPracticeTrials
]
/ onblockbegin = [
  values.condition = 1;
]
/ trials = [1 = list.practice]
</block>

<block practice_incongruent>
/ stop = [
  block.practice_incongruent.trialcount >= parameters.numberPracticeTrials
]
/ onblockbegin = [
  values.condition = 2;
]
/ trials = [1 = list.practice]
</block>

<expt GiudizziDiPiacevolezza>
/ blocks = [
    1 = practice_congruent;
    2 = practice_incongruent
    ]
</expt>
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 102K
federico2001 - 7/22/2024
Dave - 7/22/2024
federico2001 - 7/22/2024
Hi, 
I'm completely new in Inquisit. I'm trying to create an experiment on pleasantness judgments: the participant will see on the screen a photo and through two buttons he will be able to choose whether he likes it or not. There are four trials total, and I wish, in case of no-response, for a text to appear on the screen and for the trial to be repeated, but I have some issues. Can somebody help me?
Thanks.

<parameters>
/ numberTrials = 8
</parameters>

<text noresponse>
/ items = ("Try to be faster next time")
</text>

<list practice>
/ items = (trial.selectTrial)
/ poolsize = parameters.numberTrials
</list>

<trial selectTrial>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
    if (values.condition == 1){
        return trial.congruent;
    }
]
/ trialduration = 1000
</trial>

<trial congruent>
/ stimulustimes = [0 = practicefaces, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = 3000
/ branch = [
    if (trial.congruent_practice.error){
        return trial.repeat;
    } else {
        list.practice.nextvalue;
    }
]
</trial>

<trial repeat>
/ontrialbegin = [
    if (trial.congruent.response == 0){
        trial.repeat.insertstimulusframe(text.noresponse, 1)
        }
]
/ timeout = 3000
/ branch = [
    list.practice.currentvalue;
]
/ ontrialend = [
    trial.repeat.resetStimulusFrames();
]
</trial>




Provide complete, runnable code, not isolated snippets, please. They are not useful and most of what's relevant is missing.

Very sorry,
I'll send the complete code so far. There are two blocks and the function to repeat the trial is implemented only in the trial.congruent_practice (I wanted to solve the problem first and then implement it in the second one too).
Better now?

<defaults>
/ inputdevice = mouse
</defaults>

<parameters>
/ numberPracticeTrials = 8

/ picSize = 25%
/ fixationSize = 15%
/ left_x = 40%
/ right_x = 60%
</parameters>

<values>
/ condition = 1
</values>

<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", parameters.fixationSize, false, false, false, false, 5, 1)
/ position = (50%, 50%)
/ erase = false
/ vjustify = center
</text>

<picture practiceFaces>
/ items = pictureitemspractice
/ select = noreplace
/ size = (parameters.picSize, parameters.picSize)
/ erase = false
</picture>

<item pictureitemspractice>
/ 1 = "1DD_prova.png"
/ 2 = "1DS_prova.png"
/ 3 = "1MD_prova.png"
/ 4 = "1MS_prova.png"
/ 5 = "2DD_prova.png"
/ 6 = "2DS_prova.png"
/ 7 = "2MD_prova.png"
/ 8 = "2MS_prova.png"
/ 9 = "3DD_prova.png"
/ 10 = "3DS_prova.png"
/ 11 = "3MD_prova.png"
/ 12 = "3MS_prova.png"
/ 13 = "4DD_prova.png"
/ 14 = "4DS_prova.png"
/ 15 = "5DD_prova.png"
/ 16 = "5DS_prova.png"
</item>

<picture dislikeds>
/ items = ("dislike.png")
/ position = (parameters.right_x, 90%)
/ size = (30%, 30%)
</picture>

<picture likesx>
/ items = ("like.png")
/ position = (parameters.left_x, 85%)
/ size = (30%, 30%)
</picture>

<picture dislikesx>
/ items = ("dislike.png")
/ position = (parameters.left_x, 90%)
/ size = (30%, 30%)
</picture>

<picture likeds>
/ items = ("like.png")
/ position = (parameters.right_x, 85%)
/ size = (30%, 30%)
</picture>

<text noResponseText>
/ items = ("Cerca di rispondere più velocemente la prossima volta")
/ position = (50%, 20%)
/ fontstyle = ("Arial", 5%, true, false, false, false, 5, 1)
/ size = (80%, 10%)
/ vjustify = center
/ txcolor = blue
</text>

<list practice>
/ items = (trial.selectTrial_practice)
/ poolsize = parameters.numberPracticeTrials
</list>

<trial selectTrial_practice>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
    if (values.condition == 1){
        return trial.congruent_practice;
    }
    else if (values.condition == 2){
        return trial.incongruent_practice;
    }
]
/ trialduration = 1000
/ recorddata = false
</trial>

<trial congruent_practice>
/ stimulustimes = [0 = practicefaces, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = 3000
/ branch = [
    if (trial.congruent_practice.error){
        return trial.repeat_c;
    } else {
        list.practice.nextvalue;
    }
]
</trial>

<trial incongruent_practice>
/ stimulustimes = [0 = practicefaces, likesx, dislikeds]
/ validresponse = (noresponse, likesx, dislikeds)
/ timeout = 3000
/ branch = [
    list.practice.nextvalue;
]
</trial>

<trial repeat_c>
/ontrialbegin = [
    if (trial.congruent_practice.response == 0){
        trial.repeat_c.insertstimulusframe(text.noResponseText, 1)
        }
]
/ timeout = 3000
/ branch = [
    list.practice.currentvalue;
]
/ ontrialend = [
    trial.repeat_c.resetStimulusFrames();
]
</trial>

<block practice_congruent>
/ stop = [
  block.practice_congruent.trialcount >= parameters.numberPracticeTrials
]
/ onblockbegin = [
  values.condition = 1;
]
/ trials = [1 = list.practice]
</block>

<block practice_incongruent>
/ stop = [
  block.practice_incongruent.trialcount >= parameters.numberPracticeTrials
]
/ onblockbegin = [
  values.condition = 2;
]
/ trials = [1 = list.practice]
</block>

<expt GiudizziDiPiacevolezza>
/ blocks = [
    1 = practice_congruent;
    2 = practice_incongruent
    ]
</expt>

<defaults>
/ inputdevice = mouse
</defaults>

<parameters>
/ numberPracticeTrials = 8

/ picSize = 25%
/ fixationSize = 15%
/ left_x = 40%
/ right_x = 60%
</parameters>

<values>
/ condition = 1
/ repeat = false
/ itemnumber = 1
/ trialcount = 0
</values>

<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", parameters.fixationSize, false, false, false, false, 5, 1)
/ position = (50%, 50%)
/ erase = false
/ vjustify = center
</text>

<picture practiceFaces>
/ items = pictureitemspractice
/ select = values.itemnumber
/ size = (parameters.picSize, parameters.picSize)
/ erase = false
</picture>

<list practicefaceitems>
/ poolsize = 16 // we have 16 practice items
</list>

<item pictureitemspractice>
/ 1 = "1DD_prova.png"
/ 2 = "1DS_prova.png"
/ 3 = "1MD_prova.png"
/ 4 = "1MS_prova.png"
/ 5 = "2DD_prova.png"
/ 6 = "2DS_prova.png"
/ 7 = "2MD_prova.png"
/ 8 = "2MS_prova.png"
/ 9 = "3DD_prova.png"
/ 10 = "3DS_prova.png"
/ 11 = "3MD_prova.png"
/ 12 = "3MS_prova.png"
/ 13 = "4DD_prova.png"
/ 14 = "4DS_prova.png"
/ 15 = "5DD_prova.png"
/ 16 = "5DS_prova.png"
</item>

<picture dislikeds>
/ items = ("dislike.png")
/ position = (parameters.right_x, 90%)
/ size = (30%, 30%)
</picture>

<picture likesx>
/ items = ("like.png")
/ position = (parameters.left_x, 85%)
/ size = (30%, 30%)
</picture>

<picture dislikesx>
/ items = ("dislike.png")
/ position = (parameters.left_x, 90%)
/ size = (30%, 30%)
</text>

<picture likeds>
/ items = ("like.png")
/ position = (parameters.right_x, 85%)
/ size = (30%, 30%)
</picture>

<text noResponseText>
/ items = ("Cerca di rispondere più velocemente la prossima volta")
/ position = (50%, 20%)
/ fontstyle = ("Arial", 5%, true, false, false, false, 5, 1)
/ size = (80%, 10%)
/ vjustify = center
/ txcolor = blue
</text>

<list practice>
/ items = (trial.selectTrial_practice)
/ poolsize = parameters.numberPracticeTrials
</list>

<trial selectTrial_practice>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
if (values.condition == 1){
return trial.congruent_practice;
}
else if (values.condition == 2){
return trial.incongruent_practice;
}
]
/ trialduration = 1000
/ recorddata = false
</trial>

<trial congruent_practice>
/ ontrialbegin = [
    if (!values.repeat) { // if it's not a repeat trial
        values.trialcount += 1; // increase the trial count
        values.itemnumber = list.practicefaceitems.nextindex; // select a new item
    }
]
/ stimulustimes = [0 = practicefaces, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = 3000
/ branch = [
    if (trial.congruent_practice.error){
        values.repeat = true;
    return trial.repeat_c;
    } else {
        values.repeat = false;
        return list.practice.nextvalue;
    }
]
</trial>

<trial incongruent_practice>
/ stimulustimes = [0 = practicefaces, likesx, dislikeds]
/ validresponse = (noresponse, likesx, dislikeds)
/ timeout = 3000
/ branch = [
list.practice.nextvalue;
]
</trial>

<trial repeat_c>
/ontrialbegin = [
if (trial.congruent_practice.response == 0){
trial.repeat_c.insertstimulusframe(text.noResponseText, 1)
}
]
/ timeout = 3000
/ branch = [
list.practice.currentvalue;
]
/ ontrialend = [
trial.repeat_c.resetStimulusFrames();
]
</trial>

<block practice_congruent>
/ stop = [
//block.practice_congruent.trialcount >= parameters.numberPracticeTrials // obviously can't work if you need to repeat trials
values.trialcount >= parameters.numberPracticeTrials
]
/ onblockbegin = [
values.condition = 1;
values.trialcount = 0;
]
/ trials = [1 = list.practice]
</block>

<block practice_incongruent>
/ stop = [
block.practice_incongruent.trialcount >= parameters.numberPracticeTrials
]
/ onblockbegin = [
values.condition = 2;
]
/ trials = [1 = list.practice]
</block>

<expt GiudizziDiPiacevolezza>
/ blocks = [
1 = practice_congruent;
2 = practice_incongruent
]
</expt>


In the future, please:
(1) Do not paste entire scripts into a post's body. This is error-prone and difficult to work with.
(2) If your code requires external files (images, etc.) to run, always provide those along with the code.

Put everything needed in a ZIP archive, then use +Insert -> Add File... to attach the ZIP containing the script and other files to a post.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search