yes, of course!
and this is the code in the js files:
// Initialize components for Routine “gesehen”
gesehenClock = new util.Clock();
jaBox = new visual.Rect ({
win: psychoJS.window, name: ‘jaBox’,
width: [0.25, 0.1][0], height: [0.25, 0.1][1],
ori: 0, pos: [(- 0.3), 0],
lineWidth: 1, lineColor: new util.Color([(- 1), (- 1), (- 1)]),
fillColor: new util.Color([0, 0, 0]),
opacity: 1, depth: 0, interpolate: true,
});
neinBox = new visual.Rect ({
win: psychoJS.window, name: ‘neinBox’,
width: [0.25, 0.1][0], height: [0.25, 0.1][1],
ori: 0, pos: [0.3, 0],
lineWidth: 1, lineColor: new util.Color([(- 1), (- 1), (- 1)]),
fillColor: new util.Color([0, 0, 0]),
opacity: 1, depth: -1, interpolate: true,
});
gesehen_frage = new visual.TextStim({
win: psychoJS.window,
name: ‘gesehen_frage’,
text: ‘default text’,
font: ‘Arial’,
units: undefined,
pos: [0, 0.4], height: 0.035, wrapWidth: undefined, ori: 0,
color: new util.Color(‘white’), opacity: 1,
depth: -2.0
});
ja = new visual.TextStim({
win: psychoJS.window,
name: ‘ja’,
text: ‘Ja’,
font: ‘Arial’,
units: undefined,
pos: [(- 0.3), 0], height: 0.035, wrapWidth: undefined, ori: 0,
color: new util.Color(‘black’), opacity: 1,
depth: -3.0
});
nein = new visual.TextStim({
win: psychoJS.window,
name: ‘nein’,
text: ‘Nein’,
font: ‘Arial’,
units: undefined,
pos: [0.3, 0], height: 0.035, wrapWidth: undefined, ori: 0,
color: new util.Color(‘black’), opacity: 1,
depth: -4.0
});
mouse = new core.Mouse({
win: psychoJS.window,
});
mouse.mouseClock = new util.Clock();
[…]
if (jaBox.contains(myMouse)) {
stim_seen = true;
} else {
if (neinBox.contains(myMouse)) {
stim_seen = false;
if ((gesehen_frage.text === "Haben Sie einen roten Rahmen gesehen?")) {
given_answer1 = "nicht gesehen";
} else {
if ((gesehen_frage.text === "Haben Sie einen blauen Rahmen gesehen?")) {
given_answer2 = "nicht gesehen";
}
}
}
}
// *mouse* updates
if (t >= 0.0 && mouse.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
mouse.tStart = t; // (not accounting for frame time here)
mouse.frameNStart = frameN; // exact frame index
mouse.status = PsychoJS.Status.STARTED;
mouse.mouseClock.reset();
prevButtonState = mouse.getPressed(); // if button is down already this ISN'T a new click
}
if (mouse.status === PsychoJS.Status.STARTED) { // only update if started and not finished!
let buttons = mouse.getPressed();
if (!buttons.every( (e,i,) => (e == prevButtonState[i]) )) { // button state changed?
prevButtonState = buttons;
if (buttons.reduce( (e, acc) => (e+acc) ) > 0) { // state changed to a new click
// check if the mouse was inside our 'clickable' objects
gotValidClick = false;
for (const obj of [jaBox, neinBox]) {
if (obj.contains(mouse)) {
gotValidClick = true;
mouse.clicked_name.push(obj.name)
}
}
if (gotValidClick === true) { // abort routine on response
continueRoutine = false;
}
}
}
}
Do I have to fix the arguments that were initialized with “undefined”? In builder I had “units = from exp settings”… might that be a problem?