How to link a variable from the dialogue box to a var in the code

Hi,

In my experiment, I use a different time of appearance of the stimuli depending on the participant, so I added in the dialog box the “STD” (stimulus time duration).

In my code, the variable that varies the time of appearance of the stimuli, thus the STD, is the variable stimDur.

image

When I modify this variable directly in the code (for example put 1.4 instead of 0.5), the time of appearance of the stimuli is modified correctly.
But I would like to be able to modify the stimDur variable directly from the dialgue box. So for example if I note in the dialog box that the STD is 1.5, the stimDur variable will be equal to 1.5.

This solution would avoid me to modify directly in the code the stimDur variable between each participant. I would like to be able to modify it directly with the dialog box

I tried this solution but it doesn’t work:

stimDur = (Number.parseInt(expInfo[“STD”]));

I have this error with this solution: [Error message: asarray not defined]

Thanks for any help or ideas.

stimDur=float(expInfo['STD (sec)'])

Thank you for your answer, but when i use this code, the function console.log(stimDur) show this:
image

So without a STD it doesn’t work. I do not understand why it is noted NaN instead of the number that I noted in the dialog box

Oh my bad, i noted the code in the wrong place, now i put it in begin routine and its working, thank you!

1 Like

thanks for the awesome information.