Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Endless loop caused by javascript?

Hi,

In the recent script I have solved the difficult issues (see the post:Challenges to conduct the randomized memory trials between the primary task trials.), I designed a self-restart loop for practice. The loop will restart once the participant made one error. This loop works well in the local, but it never stop when it was on OSWEB. The original algorithm was from a python code. Here is the .osexp with the practice loop only.


Comments

  • Hi @CSC,

    If it works locally in OpenSesame, but not in osweb, then it is likely a bug in osweb that still needs to be resolved. I checked your experiment and it all looks ok what you did. I remember there still being some problems with break_if statements of loops not being properly evaluated in osweb, so that might be what you are facing here.

    I also noticed that your Prac_list2 loop immediately follows your Prac_list1 loop, without any display in between. It may be that the Prac_list1 loop successfully ends, but you don't notice this because you immediately continue to Prac_list2. I assume you have checked if this happens too and it isn't part of the problem?

    Buy Me A Coffee

  • Hi @Daniel

    I randomly selected one of practice lists before the experimental session. A "Run if" parameter [PList] decided which list will be ran for this participation. Below picture shows how I decided the value of [PList] in the procedure.


  • Right, I missed that. I have to look a little bit deeper into why this doesn't work and sadly I am a bit strained on time at the moment. I can reiterate though that if it works in OpenSesame and not in osweb, it is probably a bug in osweb, as the two should have behaviorial parity. Likely the problem lies in the break_if evaluation of osweb, so that's a place where I'll start looking once I get to it.

    If you can create a minimal reproducible example, you can post an issue on osweb's issue board: https://github.com/open-cogsci/osweb/issues (an also check if a similar issue hasn't already been reported there)

    Buy Me A Coffee

  • Hi both,

    I've had the exact same problem; for some reason in OSWeb the loop item doesn't correctly validate the break-if statement. Perhaps it expects java code (although I tried a lot of variations without success).

    Here's my own temporary solution: give all items in the loop a run-if statement that is the opposite of your break-if statement. When your break condition is met, the loop will continue running until its final cycle, but it's simply not running any items anymore - so it's almost as if you broke out of the loop.

    Cheers

    Josh

  • I've also learned just now that the space and return keys (which may have been pressed following a keyboard item) cannot be used for run-if and break-if statements. Return is a reserved keyword in java and cannot be used as identifier. The space triggers a scroll-down action in your browser (in Chrome at least), and isn't registered in the experiment.

    When switching these keys for random other keys in my if-statements, everything worked fine..

Sign In or Register to comment.