@wakecarter thank you for suggestions!
Sorry for the late response. I coudn’t have chance to reply earlier.
I try the code that you provided. It works without a problem offline. However, I have the same problems with online experiment.
keys = event.getKeys()
if keys:
if 't' in keys and keys[0] == corrAns:
continueRoutine=False
elif 't' in keys:
msg='X'
elif 'v' in keys and keys[0] == corrAns:
continueRoutine=False
elif 'v' in keys:
msg='X'
else:
msg='You need to give faster responses. Please press space to continue'```
I get the following code by Auto → JS and added the first three lines manually.
var msg;
var keys;
event=psychoJS.eventManager //Until here I added manually.
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);
keys = event.getKeys();
if (keys) {
if ((_pj.in_es6("t", keys) && (keys[0] === corrAns))) {
continueRoutine = false;
} else {
if (_pj.in_es6("t", keys)) {
msg = "X";
} else {
if ((_pj.in_es6("v", keys) && (keys[0] === corrAns))) {
continueRoutine = false;
} else {
if (_pj.in_es6("v", keys)) {
msg = "X";
}
}
}
}
} else {
msg = "You need to give faster responses. Please press space to continue";
}
I still have the problems that I had earlier;
Thank you so much!
Best wishes,
Emre