Skip to content

Commit

Permalink
issue-#28 (1)
Browse files Browse the repository at this point in the history
- two-step task
  • Loading branch information
szorowi1 committed Jul 12, 2022
1 parent bf88cc4 commit da4f0dd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
2 changes: 2 additions & 0 deletions tasks/two-step/experiment.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<script src="../../lib/jspsych-6.3.1/plugins/jspsych-preload.js"></script>
<script src="../../lib/jspsych-6.3.1/plugins/jspsych-fullscreen.js"></script>
<script src="../../lib/jspsych-6.3.1/plugins/jspsych-call-function.js"></script>
<script src="../../lib/jspsych-6.3.1/plugins/jspsych-html-keyboard-response.js"></script>

<!-- Load CSS styles -->
<link href="../../lib/jspsych-6.3.1/css/jspsych.css" rel="stylesheet" type="text/css"></link>
Expand Down Expand Up @@ -56,6 +57,7 @@
var timeline = [];
timeline = timeline.concat(PRELOAD);
timeline = timeline.concat(FULLSCREEN);
timeline = timeline.concat(INSTRUCTIONS_SKIP);
timeline = timeline.concat(INSTRUCTIONS);
timeline = timeline.concat(READY_01);
timeline = timeline.concat(TWO_STEP_TASK.slice(0,100));
Expand Down
30 changes: 23 additions & 7 deletions tasks/two-step/js/two-step-instructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,29 @@ const instructions_loop_3a = {
// Define instructions timeline
//---------------------------------------//

var INSTRUCTIONS = [
instructions_loop_1a,
instructions_loop_1b,
instructions_loop_2a,
instructions_loop_2b,
instructions_loop_3a
]
var INSTRUCTIONS_SKIP = {
type: 'html-keyboard-response',
stimulus: '<p>You are starting a demo of the <b>two-step task.</b></p><p>To see the instructions, press the "1" key. To skip them, press the "2" key.</p>',
choices: ["1","2"]
}

var INSTRUCTIONS = {
timeline: [
instructions_loop_1a,
instructions_loop_1b,
instructions_loop_2a,
instructions_loop_2b,
instructions_loop_3a
],
conditional_function: function(){
var data = jsPsych.data.get().last(1).values()[0];
if(jsPsych.pluginAPI.compareKeys(data.response, '2')){
return false;
} else {
return true;
}
}
}

//---------------------------------------//
// Define useful functions
Expand Down

0 comments on commit da4f0dd

Please sign in to comment.