URL of experiment: https://pavlovia.org/run/doladime/memory-scaffold-experiment/html/
Description of the problem: When I try to run my experiment online, I get the error that refillEmpty and checkText does not exist but I have the following code generated by the Auto -> JS translation
I am using a bit of code from the multiText demo and under the Begin Routine tab, it has:
‘’’ currentText = text;
captured_string = “”;
textComps = [text, otherText];
function checkText(text) {
if ((text.text === “Click to enter text…”)) {
text.text = “”;
}
return text;
}
function refillEmpty(currentText) {
for (var text, _pj_c = 0, _pj_a = textComps, _pj_b = _pj_a.length; (_pj_c < _pj_b); _pj_c += 1) {
text = _pj_a[_pj_c];
if (((text !== currentText) && (text.text.length === 0))) {
text.text = “Click to enter text…”;
}
}
}
‘’’
and under the Each Frame tab,
‘’‘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);
for (var eachText, _pj_c = 0, _pj_a = textComps, _pj_b = _pj_a.length; (_pj_c < _pj_b); _pj_c += 1) {
eachText = _pj_a[_pj_c];
if (mouse.isPressedIn(eachText)) {
currentText = checkText(eachText);
}
}
for (var key, _pj_c = 0, _pj_a = event.getKeys(), _pj_b = _pj_a.length; (_pj_c < _pj_b); _pj_c += 1) {
key = _pj_a[_pj_c];
if (_pj.in_es6(key, [“escape”])) {
core.quit();
} else {
if (_pj.in_es6(key, [“delete”, “backspace”])) {
captured_string = captured_string.slice(0, (- 1));
} else {
if (_pj.in_es6(key, [“space”])) {
captured_string = (captured_string + " ");
} else {
if (_pj.in_es6(key, [“lshift”, “rshift”, “up”, “down”, “left”, “right”])) {
} else {
captured_string = (captured_string + key);
}
}
}
}
}
currentText.text += captured_string;
captured_string = “”;
refillEmpty(currentText);
‘’’