@dvbridges thank you very much!
Ok, so thanks to your advice I could make it run. My condition is now like this:
if ((( (timer.getTime() < 3) && (mouse_3.getPressed) && (respuestaMasculino.contains(mouse_3) || respuestaFemenino.contains(mouse_3)) )) && muyRapido.status === PsychoJS.Status.NOT_STARTED) {
I couldn’t check is it works yet, because now I have another problem. (let me know if it should go on another topic)
Now I get some ReferenceError: assignment to undeclared variable… " first it was on variable “frameDur”. I found that almost at the begining of the code there was this:
expInfo['frameRate'] = psychoJS.window.getActualFrameRate();
if (typeof expInfo['frameRate'] !== 'undefined')
frameDur = 1.0/Math.round(expInfo['frameRate']);
else
frameDur = 1.0/60.0; // couldn't get a reliable measure so guess
I just commented it as I don’t need the data of monitor framerate, and now I get the same ReferenceError on another variable “ConsentimientoClock”
I check again and there0s 3 references to that variable:
The first one is:
function experimentInit() {
// Initialize components for Routine "Consentimiento"
ConsentimientoClock = new util.Clock();
Consentimiento_instrucciones = new visual.TextStim({
win: psychoJS.window,
name: 'Consentimiento_instrucciones',
text: 'default text',
font: 'Arial',
units : undefined,
pos: [0, 0.2], height: 0.05, wrapWidth: 1, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: 0.0
});
The second one:
function ConsentimientoRoutineBegin() {
//------Prepare to start Routine 'Consentimiento'-------
t = 0;
ConsentimientoClock.reset(); // clock
frameN = -1;
// update component parameters for each repeat
Consentimiento_instrucciones.setText(Consentimiento);
buttonNext.setImage('C:\\Users\\kaini\\Desktop\\FACULTAD\\TESIS\\Psychopy exp\\estimulos\\siguiente2.jpg');
// setup some python lists for storing info about the mouse_2
mouse_2.clicked_name = [];
gotValidClick = false; // until a click is received
// keep track of which components have finished
ConsentimientoComponents = [];
ConsentimientoComponents.push(Consentimiento_instrucciones);
ConsentimientoComponents.push(buttonNext);
ConsentimientoComponents.push(mouse_2);
for (const thisComponent of ConsentimientoComponents)
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
return Scheduler.Event.NEXT;
}
And the last one:
function ConsentimientoRoutineEachFrame() {
//------Loop for each frame of Routine 'Consentimiento'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = ConsentimientoClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
// update/draw components on each frame
// *Consentimiento_instrucciones* updates
if (t >= 0.0 && Consentimiento_instrucciones.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
Consentimiento_instrucciones.tStart = t; // (not accounting for frame time here)
Consentimiento_instrucciones.frameNStart = frameN; // exact frame index
Consentimiento_instrucciones.setAutoDraw(true);
}
As I understand, on the first one (experimentInit) it declares the variable ConsentimientoClock as “new util.Clock()” , so why does it say it is an undeclared variable? The other 2 places where it is called, are within the experiment Init (a “begin routine” and an “each frame”)
I also guess that, once I solve this, I will get another one and another one, as that routine is the first one of all 5 routines that I have.
I found only this thread Problem when trying to run online "ReferenceError:assignment to undeclared variable textwelc" (probably due to JavaScript wrong translation?) but turned out to be a Bool error that has already been fixed in an update.