Issues with continueRoutine = True AND trials.finished = True on Pavlovia

Hello everyone,
I am having a struggle on building an online experiment with Pavlovia and I was hoping if anyone could give me some guidance.

The two big challenges that I am having specifically to Pavlovia is:

  1. Issues with the conditional phrases
  2. Getting Typed response that resonates with the participant’s screen; so basically participants could see what they typed.

For the first problem,
my experiment includes multiple conditional phrases and for the offline version (which works flawlessly) I have used “continueRoutine = True” and " ‘customized loop name’.finished = True" to achieve that.

So, my Excel file is called “itemTypes” and this includes a column called “condition”. variable “condition” includes 0 or 1 values. My psychopy experiment is composed of two Routines: “Part 2 Word Pair” and “Change Detection”. If the “condition” variable is 0, then the “Change Detection” routine should be skipped. For this, in the “End Routine” of “Part 2 Word Pair”, I embedded the code

in Offline (these codes works)
[Py Code]

if (condition == 0):
continueRoutine = False

     OR

if(condition == 0):
Part2loop.finished = True
#Part2loop is the custom loop that contains both Routine

in Online version, (these codes don’t work.)
[Py Code]

if (condition == 0):
trials.finished = True

  OR

if(condintion == ‘0’):
trials.finished = True
SkipThisTrial = True
continueRoutine = False
else:
trials.finished = False
SkipThisTrial = False
continueRoutine = True

These codes don’t work properly in Pavlovia experiment eventhough I tried putting continueRoutine = True code into the ‘Each Frame’ tab.

Could anyone help me with this issue?

Also, for the second problem, I just need some guidance on getting the typed response.
for offline, I have used

Begin Routine

modify = False
ResponseType.text = ‘’
event.clearEvents(‘keyboard’)
#ResponseType is $ResponseType in the empty word box

Each Frame

if(ChngDetecKey2.keys == ‘p’):
continueRoutine = False
keys = event.getKeys()
if len(keys):
if ‘space’ in keys:
ResponseType.text = ResponseType.text + ’ ’
elif ‘backspace’ in keys:
ResponseType.text = ResponseType.text[:-1]
elif ‘lshift’ in keys or ‘rshift’ in keys:
modify = True
elif ‘return’ in keys:
continueRoutine = False
else:
if modify:
ResponseType.text = ResponseType.text + keys[0].upper()
modify = False
else:
ResponseType.text = ResponseType.text + keys[0]

End Routine

thisExp.addData(“typedWord2”, ResponseType.text)
#typedWord2 is the word box’s name with $ResponseType in it.

Thank you for the help and I hope everyone is have a safe and healthy summer!

You need to use true (not True) and false (not False) online

What is the problem with the typed response? The auto- JS should set the python-code from uppercase to lowercase.

Cheers Jens

Please could you edit your post to include your Python indents. I assume you are using code_JS from my crib sheet and the code you have posted is all auto translated.

Hi @JensBoelte,
I am not sure if it’s the main source of the error, but when I end up in the typing response section, the experiment in Pavlovia briefly shows red error message (it always disappears very fast so I couldn’t tell what it said) and crashes. If the typed response code looks okay, then it may be other codes that are causing the error.

Hi @wakecarter,
Sorry, this is my first post. Could you tell me more about what you meant by Python indent? and I am using “auto -> JS” for the code.

Hi @lpxhs5,
Thanks for the tip! I will incorporate that into my code!

Hello Peter,

In order to est whether your text input cause your experiment to crash, you could simply exclude the text input from your experiment and try it out. From what I see, it should not be the problem.

Cheers Jens

Python code needs indents.

When pasting Python code here, you should select the preformatted text option (Ctl-Shift=C) and

type or paste code here
1 Like

Thank you for the info! I have solved the issue that I had before. Typing codes in JS have solved the issue.