Howdy, Stranger!

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

Supported by

Constrain Loop Randomization in OSWeb

Hello,

I am preparing a lexical decision task to be run online and I want to make sure that there will never be more than 4 words or pseudowords presented in a row. Does anyone know how to do that in OSWeb (so without python inline code and mindist funstion)

Thank you!

Comments

  • edited June 2020

    Hi Angelina,

    The only way I can think of is to use an inline_javascript ithat uses a counter (repetition ) to keep track of how often a particular value is repeated for, in the example, the variable condition . And then you can use a run-if statement to skip all items in the trial sequence when repetition exceeds a certain value. Conversely, a repeat_cycle is run only when it exceeds this value.

    It's not very elegant, but it should do the trick in most scenarios!

    Cheers,

    Sebastiaan

    if ((typeof(vars.previous_condition) !== 'undefined') && (vars.previous_condition === vars.condition)) {
        vars.repetition += 1
    } else {
        vars.repetition = 0
    }
    console.log('previous: ' + vars.previous_condition + ' current: ' + vars.condition + ' repetition: ' + vars.repetition)
    vars.previous_condition = vars.condition
    

    


  • Thank you so much Sebastian! This soulution works perfectly for my experiment!!

  • Hi Sebastiaan,

    I have tried this inline_javascript that you suggested to Angelina with the offline version of Opensesame, but it did not work (No module named inline_javascript). I assume this javascript only works for OSWeb. Is there similar code that can be used for inline_Pythonscript?

    I found this discussion from 2013 (https://forum.cogsci.nl/index.php?p=/discussion/310/solved-pseudorandom-with-lexical-decision) and step 8 here (https://kvonholzen.github.io/Tutorials_Open_Sesame_Lexical_decision.html#step_8:_pseudorandomize_the_order_of_trials). But these two solutions do not look as straightforward as the one for OSWeb.


    I am attaching my unfinished experiment. For example, in subblock 1.1, I would like to pseudo-randomize the trails to keep sequences of expected ‘yes’ (or 'no') responses to no more than three in a row. Is there an essay way to implement this?

    Thank you so much in advance!

    Best regards,

    Mengzhu


  • Hi Mengzhu,

    The solution described in this post is for OSWeb (the online runtime of OpenSesame), which doesn't support OpenSesame's normal pseudorandomization functionality. That makes it a bit complex.

    But if you want to run your experiment on the desktop, you can make use of loop constraints, which is much easier.

    For example, in subblock 1.1, I would like to pseudo-randomize the trails to keep sequences of expected ‘yes’ (or 'no') responses to no more than three in a row.

    Let's say that you have a variable expected_response , then you could add the following constraint to the end of the loop script:

    constrain expected_response maxrep=3
    

    See also:

    Hope this helps!

    Cheers,

    Sebastiaan

  • Thank you. It worked perfectly!

Sign In or Register to comment.