URL of experiment: https://pavlovia.org/run/knox/baddeley-et-al-1975-demo/html/
Description of the problem: I have an experiment that works properly via PsychoPy but I cannot get it to work on Pavlovia. I want to give participants 20 seconds to type responses on the screen. If they type “space” I want it to be like entering the word (proceed to next trial of entering the word). If they type “return” I want it to terminate the loop. I’ve attached the Each Frame portion of my code.
#Python that is working
if("return" in prac_resp.keys):
prac_resp.keys.remove("return")
pscreentext = ''.join(prac_resp.keys)
thisExp.addData("pracrecall_resp",pscreentext)
continueRoutine = False
pracloop.finished=True
elif("space" in prac_resp.keys):
prac_resp.keys.remove("space")
pscreentext = ''.join(prac_resp.keys)
thisExp.addData("pracrecall_resp",pscreentext)
continueRoutine = False
pscreentext = ''.join(prac_resp.keys)
#JS that is giving me the error
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);
if (((prac_resp.keys == undefined) && (prac_resp.keys.indexOf("return") > -1))) {
trials.finished = true;
prac_resp.keys.remove("return");
pscreentext = prac_resp.keys.join('');
thisExp.addData("pracrecall_resp", pscreentext);
} else {
if (((prac_resp.keys == undefined) && (prac_resp.keys.indexOf("space") > -1))){
prac_resp.keys.remove("space");
pscreentext = prac_resp.keys.join('');
thisExp.addData("pracrecall_resp", pscreentext);
continueRoutine = false;
}
}
pscreentext = prac_resp.keys.join('');
#Also for the Begin Routine, I have a syntax error for the JS side for my python:
timeStart = new util.Clock()
timeStart.getTime()
pscreentext = ''