URL of experiment: https://gitlab.pavlovia.org/smithle9/06-04-2020
Description of the problem: Hello! I am novice having some issues with a mini self-paced reading task I created to see whether PsychoPy has the functionality I need for future projects. The question I have is regarding this part of the experiment:
I added the following Python code into the “Every Frames” window of the code component in the practicetrial Routine.
Below is the JS:
// Task- Each Frame (JS)
var _pj;
function _pj_snippets(container) {
function in_es6(left, right) {
if (((right instanceof Array) || ((typeof right) === "string"))) {
return (right.indexOf(left) > (- 1));
} else {
if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {
return right.has(left);
} else {
return (left in right);
}
}
}
container["in_es6"] = in_es6;
return container;
}
_pj = {};
_pj_snippets(_pj);
while (continueRoutine) {
let kb = psychoJS.eventManager.getKeys({"timeStamped": true});
if ((kb.length > 0)) {
if (_pj.in_es6("space", kb[0])) {
try {
nextWord = word_list.pop();
practicetext.setText(nextWord);
} catch(e) {
if ((e instanceof IndexError)) {
continueRoutine = false;
rtList.append(kb[0][1]);
break;
} else {
throw e;
}
}
}
From looking at other topics, it seems like the problem is the While loop, which works when running the experiment through PsychoPy, but not running it online. But, I honestly have no idea.
Again, I’m very much a novice, so any help would be greatly appreciated!