OSWeb Fatal Error
Hi,
I have an OS experiment with a Python backend, which I am trying to now transform to OSWeb. I'm changing all of my inlines from Python to JavaScript and it seemed to be going okay until the experiment crashed after the first trial due to a 'fatal error' which seems to be attributed to some stacking issue which I don't understand.
About the experiment itself: it's a lexical decision task, in which sentence stems end with either words or nonwords. Each sentence has several versions and I want each participant to randomly get one of the versions, as long as the number of trials per condition is balanced. For this reason, the list of trials each participant gets is created randomly using script, before the experimental loop begins. Accordingly, I define the loop using inlines but I think something went wrong: it looks like the experiment crashes immediately after finishing the first trial and entering the next one. So once the 2nd trial begins, one inline is run successfully, and then the experiment crashes, before anything actually appears on screen. I don't know if this is because the loop does not know how to move forward. At the end of the sequence (e.g., at the end of the first trial), I attempt to continue the loop using the following commands (inline loop_JS in the attached picture):
exp.items._items['sequence'].prepare()
exp.items._items['sequence'].run()
And these commands seem to be working, as the first inline of trial 2 (resest_JS in the attached picture) is executed perfectly, and then the crash happens. So maybe the above commands are not enough to propel the entire loop forward, but rather just the first part of the following trial.
Attached is a screenshot of the error I get. Any advice would be super helpful.
Best wishes,
Elinor
Comments
Hi @elinora18,
Could you upload your task or a stripped down version of it to this forum?
Best,
Fabrice.
Hi @Fab ,
No problem. Please find attached the simplified version with JavaScript. I did the exact same thing with a Python backend and it worked perfectly.
Thanks!!
Best,
Elinor
Hi @elinora18,
I had a quick look at the task. the task stops after one trial becasue it reaches its end. I don't think you can trigger a seuqence from within itself in Javascript. My recommendation would be to use a loop with a high number of cycles and the break if function to condition it to the value of repeat_count (which seems ot be the variable you're using to decide whether another trial should be presented).
I assume that you have your own reason to create the stimuli through code instead of using loops or nested loops. I don't reallly grasp your desig and so it may be that coding is the way to go. I assume that you checked that the shuffling is producing what you're after. Assuming it is, I think that the solution is to place the sequence in a loop so that it keeps running unless the break if condition is met.
Hope this helps,
Fabrice.
Hi @Fab ,
Yes, the shuffling is working well and I want each participant to be able to get a random set of stimuli (one sixth of available stimuli, to be exact), while still keeping the same number of trials per condition (there are 12 conditions). So coding has been really helpful so far and has allowed a lot of flexibility and randomization but your suggestion definitely seems to be working. I added a loop, with the same sequence nested in it, with the same variables I already defined in the code, and simply entered the number of trials I want with a break if condition which indeed depends on 'repeat_count', as you pointed out.
So overall, I am happy with the result! Thanks for the help!
Best wishes,
Elinor
Hi @elinora18,
Glad I could help!
Best,
Fabrice.