Skip to content

Looping over multi-trial timelines #3228

Closed Answered by lea-lexi
lea-lexi asked this question in Q&A
Discussion options

You must be logged in to vote

It's been a while since I fixed it but I figured perhaps someone else might profit from the solution one day! Here's what I did:

// Manual loop pushing your loop_node, but the timeline_variable for each loop_node repetition is just a one-element array (trial_info split up into its elements)

for(var i=0; i<stimvars.length; i++){
	timeline.push({
		timeline: [actions, sketchpadTrial, typicality, decision],
		timeline_variables: stimvars[i],
		loop_function: function(data){
			console.log(data);
			console.log(jsPsych.data.get().last(1).select('response').values[0]);
			if(jsPsych.data.get().last(1).select('response').values[0] === 'a'){
				return true;
			} else {
				return false;
			}
		…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lea-lexi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant