URL of experiment: https://pavlovia.org/agleontyev/newest_proj
Description of the problem:
In my experiment, after reading the instructions, participants are supposed to select the difficulty level by clicking on polygons coded as ez, nrm and hrd. This click should define where the cutoff line crossing which will end the trial (e.g. y = 0, so crossing half a screen with a mouse cursor). Moreover, difficulty level is supposed to influence the amount of points awarded for correct performance. In python everything works. In Pavlovia, I cannot set the cutoff line, nor can I make accumulate points.
here is the custom code I am using. On the selection routine (choice_1, end routine):
if mouse_3.clicked_name == ['ez']:
difflevel = 0.25
salary_inc = 1
elif mouse_3.clicked_name == ['nrm']:
difflevel = 0
salary_inc = 2
elif mouse_3.clicked_name == ['hrd']:
difflevel = -0.25
salary_inc = 3
it is automatically translated into:
if ((mouse_3.clicked_name === ["ez"])) {
difflevel = 0.25;
salary_inc = 1;
} else {
if ((mouse_3.clicked_name === ["nrm"])) {
difflevel = 0;
salary_inc = 2;
} else {
if ((mouse_3.clicked_name === ["hrd"])) {
difflevel = (- 0.25);
salary_inc = 3;
}
}
}
In the trials loop (end of routine, supposed to pass on to feedback routine):
if vol == 0:
if mouse.clicked_name != []:
salary = salary + salary_inc
msg = 'Correct'+ "\n Your points: " + str(salary)
if mouse.clicked_name == []:
salary = salary - salary_inc
if salary <0:
salary = 0
msg = 'Incorrect. You waited too long to respond' + "\n Your points: " + str(salary)
if vol == 1:
if correct_stop == 0:
salary = salary-salary_inc
if salary <0:
salary = 0
msg = 'Incorrect. It was a stop trial; do not move mouse'+"\n Your points: " + str(salary)
else:
salary = salary + salary_inc
msg = 'Correct'+"\n Your points: " + str(salary)
In JS:
if ((vol === 0)) {
if ((mouse.clicked_name !== [])) {
salary = (salary + salary_inc);
msg = (("Correct" + "\n Your points: ") + salary.toString());
}
if ((mouse.clicked_name === [])) {
salary = (salary - salary_inc);
if ((salary < 0)) {
salary = 0;
}
msg = (("Incorrect. You waited too long to respond" + "\n Your points: ") + salary.toString());
}
}
if ((vol === 1)) {
if ((correct_stop === 0)) {
salary = (salary - salary_inc);
if ((salary < 0)) {
salary = 0;
}
msg = (("Incorrect. It was a stop trial; do not move mouse" + "\n Your points: ") + salary.toString());
} else {
salary = (salary + salary_inc);
msg = (("Correct" + "\n Your points: ") + salary.toString());
}
}