Psychopy to pavlovia error

URL of experiment: https://pavlovia.org/run/eloipuig/aspect/html/

Description of the problem:

Hey all,

so I have created an experiment using the latest version of PsychoPy and it works well when I run it with builder. However, when I run it through pavlovia it gives me the error below. The task is one where participants need to type in a word, I created a customized code for it so that the answer would display in the screen. Does anyone know why it is giving me this error?

Unfortunately we encountered the following error:

  • **TypeError: ‘’.join is not a function. (In ‘’’.join(key_resp_12.keys)’, ‘’’.join’ is undefined)**z

.join is a method. Shouldn’t the syntax be key_resp_12.keys.join() ?

Thanks, wakecarter. I have this in the builder so that it gives me the text they type. I followed a tutorial and it seemed to work in the builder version. What would you suggest I change this to?
‘’.join($key_resp_12.key)

Ah. I think I see the problem.

In Python the syntax is delimeter.join(array) and in JavaScript the syntax is array.join(delimeter)

How about

displayText=''
for Idx in range(len(array)):
    displayText +=array[Idx]

this the bit of code I have in “each frame”

templist=key_resp_12.keys
if templist.count(‘return’)==1:
key_resp_12.keys.pop()
key_resp_12.keys=’’.join(key_resp_12.keys)
key_resp_12.rt=key_resp_12.rt[0]
continueRoutine=False
elif templist.count(‘space’)==1:
key_resp_12.keys.pop()
elif templist.count(‘lshift’)==1:
key_resp_12.keys.pop()
elif templist.count(‘backspace’)>=1 and len(key_resp_12.keys)>=2:
key_resp.keys_12.remove(‘backspace’)
key_resp_12.keys.pop()
msg=msg[:-1]
elif templist.count(‘backspace’)>=1 and len(key_resp_12.keys)==1:
key_resp_12.keys.pop()
elif (len(key_resp_12.keys)-1) == numkeys:
msg=’’
msg=msg.join(key_resp_12.keys)
numkeys=len(key_resp_12.keys)

I do not seem to make this work…

Can I add this code by using the “code component” or do I have to make in the coder itself?

Thank you in advance!

I never use the coder and strongly discourage it for online experiments.

Hello,

I couldn´t make it work. I will use images again since they are now working.

Thank you for your help!

Hi @wakecarter thanks for your advice on my digit span. I have now ran into another error with using ‘join’ https://run.pavlovia.org/hk-adams/forwardds

I get the following error * TypeError: Cannot read property ‘join’ of undefined

Any advice is much appreciated, I am very new to all of this!

Hi

The error is related to the line

current_resp = key_resp_2.keys.join('');

The issue is that you need to only execute this line if at least one key has been pressed.

You could try

if key_resp_2.keys:
     current_resp = key_resp_2.keys.join('');

or

if (_key_resp_2_allKeys.length > 0)

as I suggested here. Cannot read property 'length' of undefined (getting typed response on Pavlovia) - #5 by wakecarter