jsPsych.plugins['conditional-run'] = (function () {
	var plugin = {};

	plugin.info = {
		name: 'conditional-run',
		description: 'Only run the specified plugin if a condition is met',
		parameters: {
			'dependentPluginParameters': {
				type: jsPsych.plugins.parameterType.COMPLEX,
				description: 'The parameters to pass to the plugin that will be run, including the type of plugin',
				nested: {
					'type': {
						type: jsPsych.plugins.parameterType.STRING,
						description: 'The type of the plugin to use if the condition is met'
					}
					// + Other parameters relevant to the dependent plugin
				}
			},
			'conditionalFunction': {
				type: jsPsych.plugins.parameterType.FUNCTION,
				description: 'Function that will be executed when this trial is started. If it returns true, the trial is run. Otherwise, it is skipped.'
			}
		}
	}
	plugin.trial = function (display_element, trial) {
		if (typeof trial.conditionalFunction === 'function' && trial.conditionalFunction()) {
			jsPsych.plugins[trial.dependentPluginParameters.type].trial(display_element, trial.dependentPluginParameters);
		} else {
			// skip
			jsPsych.finishTrial();
		}
	}
	return plugin;
})();
@@ -1019,54 +1019,198 @@
 %0A%09%09%09
-jsPsych.plugins%5Btrial.dependentPluginParameter
+// protect functions in the parameters (only does a shallow copy)%0D%0A%09%09%09var dependentPluginParams = Object.assign(%7B%7D, trial.dependentPluginParameters);%0D%0A%09%09%09jsPsych.plugins%5BdependentPluginParam
 s.ty
@@ -1236,22 +1236,16 @@
 lement, 
-trial.
 dependen
@@ -1252,28 +1252,24 @@
 tPluginParam
-eter
 s);%0D%0A%09%09%7D els

Enable usage with multiple jspsych timeline_variables