Display correctmessage condicionally


Author
Message
anabela_c
anabela_c
Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)
Group: Forum Members
Posts: 23, Visits: 75
Hi Dave,

I have two types of trials (prompts) that branch to a common trial (exptrial), I would like to display the errormessage for both but the correctmessage only for the trials that were presented with the practice prompt.

The code is the following:

<trial prompt>
/ stimulustimes = [0=text.Prompt]
/ validresponse = (30,38)
/ branch = [trial.exptrial]
</trial>

<trial prompt_practice>
/ stimulustimes = [0=text.Prompt_practice]
/ validresponse = (30,38)
/ ontrialend = [
    values.practice = 1
]
/ branch = [trial.exptrial]
</trial>

<trial exptrial>
/ stimulustimes = [0=texttrial]
/ validresponse = (30,38)
/ correctresponse = (38)
/ errormessage = true(error, 2000)
</trial>

<text Prompt>
/ items = ("actual prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text Prompt_practice>
/ items = ("practice prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text texttrial>
/ items = ("trial")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text correctm>
/ items = ("Correct response!")
/ color = (0, 220, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ vjustify = center
</text>

<text error>
/ items = ("Wrong response key!")
/ color = (255, 0, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ txbgcolor = transparent
/ vjustify = center
</text>

<block exa>
/ trials = [1 = prompt_practice; 2= prompt]
</block>


<expt 1>
/ blocks = [1=exa]
</expt>

<values>
/ practice = 0
</values>

---------------------------------

I was trying to add the conditional statement in the <trial exptrial> as follows (but it does not work):

<trial exptrial>
/ stimulustimes = [0=texttrial]
/ validresponse = (30,38)
/ correctresponse = (38)
/ errormessage = true(error, 2000)
/ correctmessage= [if (values.practice == 1) {
  true(correctm, 2000)}]
</trial>


Thanks in advance for your help!!!

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: 98K
anabela_c - 8/6/2021
Hi Dave,

I have two types of trials (prompts) that branch to a common trial (exptrial), I would like to display the errormessage for both but the correctmessage only for the trials that were presented with the practice prompt.

The code is the following:

<trial prompt>
/ stimulustimes = [0=text.Prompt]
/ validresponse = (30,38)
/ branch = [trial.exptrial]
</trial>

<trial prompt_practice>
/ stimulustimes = [0=text.Prompt_practice]
/ validresponse = (30,38)
/ ontrialend = [
    values.practice = 1
]
/ branch = [trial.exptrial]
</trial>

<trial exptrial>
/ stimulustimes = [0=texttrial]
/ validresponse = (30,38)
/ correctresponse = (38)
/ errormessage = true(error, 2000)
</trial>

<text Prompt>
/ items = ("actual prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text Prompt_practice>
/ items = ("practice prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text texttrial>
/ items = ("trial")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text correctm>
/ items = ("Correct response!")
/ color = (0, 220, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ vjustify = center
</text>

<text error>
/ items = ("Wrong response key!")
/ color = (255, 0, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ txbgcolor = transparent
/ vjustify = center
</text>

<block exa>
/ trials = [1 = prompt_practice; 2= prompt]
</block>


<expt 1>
/ blocks = [1=exa]
</expt>

<values>
/ practice = 0
</values>

---------------------------------

I was trying to add the conditional statement in the <trial exptrial> as follows (but it does not work):

<trial exptrial>
/ stimulustimes = [0=texttrial]
/ validresponse = (30,38)
/ correctresponse = (38)
/ errormessage = true(error, 2000)
/ correctmessage= [if (values.practice == 1) {
  true(correctm, 2000)}]
</trial>


Thanks in advance for your help!!!

You cannot use /correctmessage conditionally. What you can do is /branch conditionally to a separate trial that displays the correct message.

<trial prompt>
/ stimulustimes = [0=text.Prompt]
/ validresponse = (30,38)
/ ontrialend = [
    values.practice = 0;
]
/ branch = [trial.exptrial]
</trial>

<trial prompt_practice>
/ stimulustimes = [0=text.Prompt_practice]
/ validresponse = (30,38)
/ ontrialend = [
values.practice = 1;
]
/ branch = [trial.exptrial]
</trial>

<trial exptrial>
/ stimulustimes = [0=texttrial]
/ validresponse = (30,38)
/ correctresponse = (38)
/ errormessage = true(error, 2000)
/ branch = [
    if (trial.exptrial.correct && values.practice == 1){
        trial.correctm;
    }
]
</trial>

<trial correctm>
/ stimulusframes = [1=text.correctm]
/ validresponse = (0)
/ trialduration = 2000
/ recorddata = false
</trial>


<text Prompt>
/ items = ("actual prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text Prompt_practice>
/ items = ("practice prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text texttrial>
/ items = ("trial")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text correctm>
/ items = ("Correct response!")
/ color = (0, 220, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ vjustify = center
</text>

<text error>
/ items = ("Wrong response key!")
/ color = (255, 0, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ txbgcolor = transparent
/ vjustify = center
</text>

<block exa>
/ trials = [1 = prompt_practice; 2= prompt]
</block>


<expt 1>
/ blocks = [1=exa]
</expt>

<values>
/ practice = 0
</values>


anabela_c
anabela_c
Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)Respected Member (320 reputation)
Group: Forum Members
Posts: 23, Visits: 75
Dave - 8/6/2021
anabela_c - 8/6/2021
Hi Dave,

I have two types of trials (prompts) that branch to a common trial (exptrial), I would like to display the errormessage for both but the correctmessage only for the trials that were presented with the practice prompt.

The code is the following:

<trial prompt>
/ stimulustimes = [0=text.Prompt]
/ validresponse = (30,38)
/ branch = [trial.exptrial]
</trial>

<trial prompt_practice>
/ stimulustimes = [0=text.Prompt_practice]
/ validresponse = (30,38)
/ ontrialend = [
    values.practice = 1
]
/ branch = [trial.exptrial]
</trial>

<trial exptrial>
/ stimulustimes = [0=texttrial]
/ validresponse = (30,38)
/ correctresponse = (38)
/ errormessage = true(error, 2000)
</trial>

<text Prompt>
/ items = ("actual prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text Prompt_practice>
/ items = ("practice prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text texttrial>
/ items = ("trial")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text correctm>
/ items = ("Correct response!")
/ color = (0, 220, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ vjustify = center
</text>

<text error>
/ items = ("Wrong response key!")
/ color = (255, 0, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ txbgcolor = transparent
/ vjustify = center
</text>

<block exa>
/ trials = [1 = prompt_practice; 2= prompt]
</block>


<expt 1>
/ blocks = [1=exa]
</expt>

<values>
/ practice = 0
</values>

---------------------------------

I was trying to add the conditional statement in the <trial exptrial> as follows (but it does not work):

<trial exptrial>
/ stimulustimes = [0=texttrial]
/ validresponse = (30,38)
/ correctresponse = (38)
/ errormessage = true(error, 2000)
/ correctmessage= [if (values.practice == 1) {
  true(correctm, 2000)}]
</trial>


Thanks in advance for your help!!!

You cannot use /correctmessage conditionally. What you can do is /branch conditionally to a separate trial that displays the correct message.

<trial prompt>
/ stimulustimes = [0=text.Prompt]
/ validresponse = (30,38)
/ ontrialend = [
    values.practice = 0;
]
/ branch = [trial.exptrial]
</trial>

<trial prompt_practice>
/ stimulustimes = [0=text.Prompt_practice]
/ validresponse = (30,38)
/ ontrialend = [
values.practice = 1;
]
/ branch = [trial.exptrial]
</trial>

<trial exptrial>
/ stimulustimes = [0=texttrial]
/ validresponse = (30,38)
/ correctresponse = (38)
/ errormessage = true(error, 2000)
/ branch = [
    if (trial.exptrial.correct && values.practice == 1){
        trial.correctm;
    }
]
</trial>

<trial correctm>
/ stimulusframes = [1=text.correctm]
/ validresponse = (0)
/ trialduration = 2000
/ recorddata = false
</trial>


<text Prompt>
/ items = ("actual prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text Prompt_practice>
/ items = ("practice prompt")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text texttrial>
/ items = ("trial")
/ position = (50%,50%)
/ fontstyle = ("Arial", 3%, true)
/ size = (80%,40%)
/ vjustify = center
</text>

<text correctm>
/ items = ("Correct response!")
/ color = (0, 220, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ vjustify = center
</text>

<text error>
/ items = ("Wrong response key!")
/ color = (255, 0, 0)
/ fontstyle = ("Arial", 5%, true)
/ position = (50%,50%)
/ txbgcolor = transparent
/ vjustify = center
</text>

<block exa>
/ trials = [1 = prompt_practice; 2= prompt]
</block>


<expt 1>
/ blocks = [1=exa]
</expt>

<values>
/ practice = 0
</values>


Ahhh, okay, thanks!!!!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search