Code output is NaN

URL of experiment: https://gitlab.pavlovia.org/DuderstadtV/leson_onlinepilot_adj_debug

Description of the problem:

Dear all,

The following code should generate a number between 485 and 515:

Number.parseInt((orange * 1000));

orange is a variable defined in an outer loop with values between 0,485 and 0,515 out of an excel sheet. I use this code to select different stimuli and it works just fine in another experiment, but I get NaN as output right now. The only clue I have is that maybe JS has problems to use variables out of an outer loop. Does anyone know a solution?

Kind regards,
Vinzenz

It might be that orange is being read as text. You could try adding 1 (and possibly also displaying the result) to it to see if you get an error.

Best wishes

Wakefield

That does not seem to be the problem. I get the notification that orange is undefined. This is strange, because the other variables out of the excel sheet work just fine.

Give orange a value in a Begin Experiment block.

If I do this the experiment works, but the experiment only uses the value out of this block. Unfortunately my value for orange has to vary in every trial depending on the value named in the excel sheet.

The values in the spreadsheet should have replaced the initial value. Have you double checked your capitalisation of orange in your spreadsheet? Does the experiment work locally?

It works fine in a local version. The problem is the missing information from the spreadsheet.