Millisecond Forums

Back buttons in a trial

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

By inquisituser22 - 2/21/2019

Hello,
I would like to add a back button for participants in my experiment to return to former pages to reference them for information. Here is my current script, which instructs participants to press "space bar" to advance through the pages, so I just need to add something for going back through pages.

Thank you very much!

<trial Psych>
/ stimulusframes = [1=Psych]
/ correctresponse = (" ")
/ validresponse = (" ")
/ response = correct </trial>
By Dave - 2/21/2019

inquisituser22 - Thursday, February 21, 2019
Hello,
I would like to add a back button for participants in my experiment to return to former pages to reference them for information. Here is my current script, which instructs participants to press "space bar" to advance through the pages, so I just need to add something for going back through pages.

Thank you very much!

<trial Psych>
/ stimulusframes = [1=Psych]
/ correctresponse = (" ")
/ validresponse = (" ")
/ response = correct </trial>

You can do that like so:

<values>
/ itemnumber = 1
</values>

<block psychblock>
/ stop = [
values.itemnumber >= 5;
]
/ trials = [1=Psych]
</block>


//press space to advance, press backspace to go back
<trial Psych>
/ ontrialend = [
if (trial.Psych.response == 57 && values.itemnumber < 5) values.itemnumber += 1;
]
/ ontrialend = [
if (trial.Psych.response == 14 && values.itemnumber > 1) values.itemnumber -= 1;
]
/ stimulusframes = [1=Psych]
/ validresponse = (57, 14)
/ branch = [
trial.Psych;
]
</trial>

<text psych>
/ items = psychitems
/ select = values.itemnumber
</text>

<item psychitems>
/ 1 = "Page 1"
/ 2 = "Page 2"
/ 3 = "Page 3"
/ 4 = "Page 4"
</item>


By inquisituser22 - 2/25/2019

inquisituser22 - Monday, February 25, 2019
Dave - Thursday, February 21, 2019
inquisituser22 - Thursday, February 21, 2019
Thank you very much, Dave!

Hello,
I would like to add a back button for participants in my experiment to return to former pages to reference them for information. Here is my current script, which instructs participants to press "space bar" to advance through the pages, so I just need to add something for going back through pages.

Thank you very much!

<trial Psych>
/ stimulusframes = [1=Psych]
/ correctresponse = (" ")
/ validresponse = (" ")
/ response = correct </trial>

You can do that like so:

<values>
/ itemnumber = 1
</values>

<block psychblock>
/ stop = [
values.itemnumber >= 5;
]
/ trials = [1=Psych]
</block>


//press space to advance, press backspace to go back
<trial Psych>
/ ontrialend = [
if (trial.Psych.response == 57 && values.itemnumber < 5) values.itemnumber += 1;
]
/ ontrialend = [
if (trial.Psych.response == 14 && values.itemnumber > 1) values.itemnumber -= 1;
]
/ stimulusframes = [1=Psych]
/ validresponse = (57, 14)
/ branch = [
trial.Psych;
]
</trial>

<text psych>
/ items = psychitems
/ select = values.itemnumber
</text>

<item psychitems>
/ 1 = "Page 1"
/ 2 = "Page 2"
/ 3 = "Page 3"
/ 4 = "Page 4"
</item>





Thank you very much, Dave!