Pavlovia: empty output

URL of experiment: Sign in · GitLab

I wrote a digit span task with main 2 loops. the first is for the direct order, and the second for the inverse order. Both work fine, but the second one does not write anything in the output file. Actually, in the psychopy coder there is a message complaing about syntax error when I write digits_inv[::-1] == msg, to check if the typed answer is the inverse of the list of stimuli. I am afraid this is the reason nothing is written in the output from pavlovia, but didnt figure out how to change it. Here is the entire code from the End Routine part of my coder component:

thisExp.addData(“digit_span_serie”, “inversa”)
thisExp.addData(“digit_span_lista”, digits_inv)
thisExp.addData(“digit_span_resposta”, msg)
thisExp.addData(“series_comprimento”, series_len)

if digits_inv[::-1] == msg:
corr = 1
corr_answers += 1
else:
corr = 0

thisExp.addData(“acerto”, corr)

digits_inv = “”
if span_trials_2.thisN == 1:
if corr_answers == 0:
trials_2.finished = True
else:
corr_answers = 0

thank you!

Hello,

when there is a syntax error, your program will not run online, at least not as intended :smile: :wink:

Did you try:

digits_inv.reverse()

Does that translate to

digits_inv.reverse();

Best wishes Jens

1 Like

dear jens, thank you for the reply.
it worked in psychopy, but not in pavlovia. got a reference error complaining that reverse() is not defined
any clue?

volved it!

digits_inv = digits_inv.split(“”).reverse().join(“”);
if ((digits_inv === msg)) {
corr = 1;
corr_answers += 1;
} else {
corr = 0;
}

Cool