ReferenceError: round is not defined

Description of the problem:
Hi ppl I am new to PsychoPy and I encountered the error “ReferenceError: round is not defined” while running my problem on Pavlovia.
I suspect it is something wrong with this here: “frameDur = 1.0/Math.round(expInfo[‘frameRate’]);”, but I have no clue how to fix it.
Will appreciate any help : )

Is that from a code component or just from the compiled experiment?

In either case, it would be helpful to see the full code. If you go to “view code” from your experiment page and link it here, we can have a look. You will need to make the repository public, so on that page, go to settings->general->permissions and set it to public before linking it.

Link to my repository: https://gitlab.pavlovia.org/LongYI/ver3
Thanks Kominsky, appreciate it.

You have

text.setText(round(prac_cate, 2));
and
intvl_cd_txt.setText(round(countdown, 2));

You should add a round function in an initial JS codeblock for cases where the autotranslate fails.

Note that in Javascript you can’t round to two decimal places so you should, for example, use text.setText(round(prac_cate*100)/100);

Best wishes,

Wakefield

1 Like

Thank you, the answer and the crib sheet are really helpful :slight_smile: