psychopy.org | Reference | Downloads | Github

Variables for allowKeys aren't supported for JS yet: JS allowkey problem

URL of experiment:

Description of the problem:

Hello, I have some problems.
I made an experiment but it is working only on local.
the bottom error message is this:

File "C:\Program File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\experiment\components\keyboard_init_.py”, line 321, in writeFrameCodeJS
“Variables for allowKeys aren’t supported for JS yet”)
psychopy.experiment.utils.CodeGenerationException: Variables for allowKeys aren’t supported for JS yet:

I found a problem and that was “allowed key” issue.
I used ‘Letter’ condition file(loop) for allowed key and it is well working on python but it’s not working on JS.
I have to proceed my experiment on online(JS) so if somebody know the solution of this problem, please help me.

im2

SRT_A_ing.py (220.8 KB)

Since

you have to allow all keys. You could untick “force end of routine” and then put the following code in Each Frame

if extrial_resp1_9.keys:
     if Letter in extrial_resp1_9.keys:
          continueRoutine = False
1 Like

Finally my experiment working well. Thank you for your great help!!! :grinning: :+1:

Hello!

I have one more question.
I used the following code in Each Frame, it’s working on online well.
( if extrial_resp1_9.keys:
if Letter in extrial_resp1_9.keys:
continueRoutine = False)

but another problem was here.
After using this code, the duration(resp.key) didn’t working so I added the following code(image1,2).
It is working well on local but it’s not working on online. when I start it on online, there’s an error(image3): TypeError:core.Clock is not a constructor.
I searched for this error and changed to Both from auto->js(like image1,2), but still it’s not working on online.
If you have any idea for this issue, please let me know.
Thanks a lot.

Best regard,



image3

Clocks need to be defined in a Both component. The JS is myClock = new util.Clock();

Only do this once (Begin Experiment. Then you can reset and read in an Auto component
myClock.reset()

1 Like

you always save me Thanks a lot!!! :+1: