Howdy, Stranger!

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

Supported by

Variable updating one block later

Because I've had some issues with the built-in 'acc' variable when converting to OSWeb, I've created a variable 'roundAcc' which calculates the accuracy manually. This works fine for the practice part of my experiment, but in the experimental loop, it updates one loop late. So in the first repeat of the experimental loop, the accuracy from the practice loop is displayed, and in the second repeat, the accuracy from the first experimental loop is displayed. The same happens with a variable 'blockCounter' which starts at 0, and then at the beginning of each experimental loop, it increments with 1.

The problem is that when I use console.log to display the variables, I can see that they are logged correctly in the browser console. However, when I try to display them on a sketchpad (at exactly the same point in the loop as when I use console.log) by using [blockCounter] and [roundAcc], they are wrong. What could be happening here?

Any help would be much appreciated!

Comments

  • Hi @afkeve ,


    Could you upload your experiment here (by pressing the paperclip icon)? It sounds like your issue is related to OpenSesame's prepare-run strategy:



    The problem is that when I use console.log to display the variables, I can see that they are logged correctly in the browser console. However, when I try to display them on a sketchpad (at exactly the same point in the loop as when I use console.log) by using [blockCounter] and [roundAcc], they are wrong. What could be happening here?

    Did you put the console.log statement in the Run tab of your inline_javascript item? Given the prepare-run logic, the values of the variables may indeed differ between the prepare phase and the run phase of your experiment.


    Cheers,


    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

Sign In or Register to comment.