change prompt within trial #2645
-
I'd like to set up a button press trial. The participant is told that another player is doing the task concurrently (this is basically Von Ahn's ESP paradigm). The other player's answers will be scripted. I'd like to have the other player "think" for a few seconds in each trial. This should not affect trial structure. I could do this like so. The problem here is that this counts as two trials. If the participant picks an answer before the other player stopped "thinking", they will have to pick an answer again to proceed. I'd like to change the prompt from "other player thinking" to "other player picked" within trial, so that the trial only registers one button press. This might be impossible.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Hi @petyaracz, here's how I would do this. (Standard disclaimer: this may not be the best/easiest way) <!DOCTYPE html>
<html>
<head>
<title>Fake dyad experiment</title>
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<link href="https://unpkg.com/[email protected]/css/jspsych.css" rel="stylesheet" type="text/css" />
<meta charset="UTF-8">
</head>
<body></body>
<script>
const jsPsych = initJsPsych();
var trial = {
type: jsPsychHtmlButtonResponse,
stimulus: 'The name of a popular red fruit is:',
choices: ['apple','carburator'],
prompt:'<p>Player 2 is thinking. 🤔</p>',
on_load: function() {
// for some reason the prompt element doesn't have an ID,
// but you can find it by getting the last child element in the jspsych-content div
const prompt = document.getElementById('jspsych-content').lastElementChild;
// set up a timer to change the prompt text after a given delay
jsPsych.pluginAPI.setTimeout(function() {
prompt.innerHTML = '<p>Player 2 made a pick! 😎</p>'
}, 5000)
},
on_finish: function() {
// clear the timeout at the end of the trial, in case a response was made and the trial ends
// before the timeout duration is reached
jsPsych.pluginAPI.clearAllTimeouts();
}
};
var final = {
type: jsPsychHtmlButtonResponse,
stimulus: 'Thanks, bye.',
choices: ['Ok']
};
jsPsych.run([trial,final]);
</script>
</html> Does that work for you? |
Beta Was this translation helpful? Give feedback.
-
One alternative is to break up the trial and pretend to check for player 2 after the player picked. So, sometimes (here, 50% of the time) player 2 already made up their mind, sometimes they are still thinking. If they are still thinking, it can take a random amount of time (here, 2s). The problem with this is that how long player 2 takes is now "how long the player takes + some time maybe" meaning that if a participant takes ages they might start to suspect that there is a reason why the purported player 2 seems roughly as slow as them, or even slower. I might be overthinking this though.
|
Beta Was this translation helpful? Give feedback.
Hi @petyaracz, here's how I would do this. (Standard disclaimer: this may not be the best/easiest way)