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


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!


  • 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!



    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


    Buy Me A Coffee

  • 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 ( and step 8 here ( 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,


  • 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!



    Buy Me A Coffee

  • Thank you. It worked perfectly!

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games