Organising branches within branches


Author
Message
a.finlay
a.finlay
New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)
Group: Forum Members
Posts: 1, Visits: 19
I am creating an experiment requiring the following layout:

Where trial 1 will lead to one of the trials 2-5 depending on the participant’s choice
And trial 2 will lead to one of the survey pages 1-8 depending on the participant’s choice and so on.
I have used branches at the trial level, for example trial 1…

<trial choice>
/ stimulusframes = [5=frontpage, logo, coffee, hotchoc, tea, iced]
/ inputdevice = mouse
/ validresponse = (coffee, hotchoc, tea, iced)
/ branch = [
    if (trial.choice.response==picture.coffee) trial.choicecoffee]
/ branch = [
    if (trial.choice.response==picture.hotchoc) trial.choice.hotchoc]
/ branch = [
    if (trial.choice.response==picture.tea) trial.choice.tea]
/ branch = [
    if (trial.choice.response==picture.iced) trial.choiceiced]
</trial>

… and put all of these trials into a block. When I do this, all trials run in the order they are presented rather than following the specified branches.
I have tried putting all trials in separate blocks and using branches at a block level but that still hasn’t worked.

Any help would be much appreciated!
Thanks 😊


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: 12K, Visits: 83K
a.finlay - 6/7/2022
I am creating an experiment requiring the following layout:

Where trial 1 will lead to one of the trials 2-5 depending on the participant’s choice
And trial 2 will lead to one of the survey pages 1-8 depending on the participant’s choice and so on.
I have used branches at the trial level, for example trial 1…

<trial choice>
/ stimulusframes = [5=frontpage, logo, coffee, hotchoc, tea, iced]
/ inputdevice = mouse
/ validresponse = (coffee, hotchoc, tea, iced)
/ branch = [
    if (trial.choice.response==picture.coffee) trial.choicecoffee]
/ branch = [
    if (trial.choice.response==picture.hotchoc) trial.choice.hotchoc]
/ branch = [
    if (trial.choice.response==picture.tea) trial.choice.tea]
/ branch = [
    if (trial.choice.response==picture.iced) trial.choiceiced]
</trial>

… and put all of these trials into a block. When I do this, all trials run in the order they are presented rather than following the specified branches.
I have tried putting all trials in separate blocks and using branches at a block level but that still hasn’t worked.

Any help would be much appreciated!
Thanks 😊


> and put all of these trials into a block.

Only <trial choice> belongs in the <block>'s /trials. Nothing else.
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: 12K, Visits: 83K
Dave - 6/7/2022
a.finlay - 6/7/2022
I am creating an experiment requiring the following layout:

Where trial 1 will lead to one of the trials 2-5 depending on the participant’s choice
And trial 2 will lead to one of the survey pages 1-8 depending on the participant’s choice and so on.
I have used branches at the trial level, for example trial 1…

<trial choice>
/ stimulusframes = [5=frontpage, logo, coffee, hotchoc, tea, iced]
/ inputdevice = mouse
/ validresponse = (coffee, hotchoc, tea, iced)
/ branch = [
    if (trial.choice.response==picture.coffee) trial.choicecoffee]
/ branch = [
    if (trial.choice.response==picture.hotchoc) trial.choice.hotchoc]
/ branch = [
    if (trial.choice.response==picture.tea) trial.choice.tea]
/ branch = [
    if (trial.choice.response==picture.iced) trial.choiceiced]
</trial>

… and put all of these trials into a block. When I do this, all trials run in the order they are presented rather than following the specified branches.
I have tried putting all trials in separate blocks and using branches at a block level but that still hasn’t worked.

Any help would be much appreciated!
Thanks 😊


> and put all of these trials into a block.

Only <trial choice> belongs in the <block>'s /trials. Nothing else.

The basic structure is really simple and goes like this:

<defaults>
/ inputdevice = mouse
</defaults>

<block example>
/ trials = [1=choice] // run the choice trial
</block>

<trial choice>
/ stimulusframes = [1=a, b, c, pickone]
/ validresponse = (a, b, c)
/ branch = [
    // go to follow-up trial based on response to the choice trial
    if (trial.choice.response == "a") {
        return trial.choiceA;
    } else if (trial.choice.response == "b") {
        return trial.choiceB;
    } else if (trial.choice.response == "c") {
        return trial.choiceC;
    };
]
</trial>

<trial choiceA>
/ stimulusframes = [1=a1, a2, wherenext]
/ validresponse = (a1, a2)
/ branch = [
    // go to follow-up surveypage based on response
    if (trial.choiceA.response == "a1") {
        return surveypage.a1page;
    } else if (trial.choiceA.response == "a2") {
        return surveypage.a2page;
    };
]
</trial>

<trial choiceB>
/ stimulusframes = [1=b1, b2, wherenext]
/ validresponse = (b1, b2)
/ branch = [
    // go to follow-up surveypage based on response
    if (trial.choiceB.response == "b1") {
        return surveypage.b1page;
    } else if (trial.choiceB.response == "b2") {
        return surveypage.b2page;
    };
]
</trial>

<trial choiceC>
/ stimulusframes = [1=c1, c2, wherenext]
/ validresponse = (c1, c2)
/ branch = [
    // go to follow-up surveypage based on response
    if (trial.choiceC.response == "c1") {
        return surveypage.c1page;
    } else if (trial.choiceC.response == "c2") {
        return surveypage.c2page;
    };
]
</trial>

<surveypage a1page>
/ caption = "You've reached surveypage A1"
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

<surveypage a2page>
/ caption = "You've reached surveypage A2"
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

<surveypage b1page>
/ caption = "You've reached surveypage B1"
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

<surveypage b2page>
/ caption = "You've reached surveypage B2"
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

<surveypage c1page>
/ caption = "You've reached surveypage C1"
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

<surveypage C2page>
/ caption = "You've reached surveypage C2"
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

<text a>
/ items = ("A")
/ position = (40%, 50%)
</text>

<text b>
/ items = ("B")
/ position = (50%, 50%)
</text>

<text c>
/ items = ("C")
/ position = (60%, 50%)
</text>

<text a1>
/ items = ("A1")
/ position = (45%, 50%)
</text>

<text a2>
/ items = ("A2")
/ position = (55%, 50%)
</text>

<text b1>
/ items = ("B1")
/ position = (45%, 50%)
</text>

<text b2>
/ items = ("B2")
/ position = (55%, 50%)
</text>

<text c1>
/ items = ("C1")
/ position = (45%, 50%)
</text>

<text c2>
/ items = ("C2")
/ position = (55%, 50%)
</text>

<text pickone>
/ items = ("Pick one:")
/ position = (50%, 20%)
</text>

<text wherenext>
/ items = ("Where to next?")
/ position = (50%, 20%)
</text>

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search