Howdy, Stranger!

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

Supported by

Block randomisation with inline JavaScript

Hi !

I am trying to randomise the execution order of blocks within a sequence. This two posts show similar solutions, working perfectly, but using an inline Python script:

https://forum.cogsci.nl/discussion/521/open-block-randomisation-with-inline-script-at-the-run-phase

https://forum.cogsci.nl/discussion/2580/how-to-randomize-blocks-in-opensesame-a-solution-not-a-question

However I will run my experiment online, and so I must use inline Javascript (and not Python). Here are the problems associated to both solutions given above:

  • In the first solution given above, I have not found a way to write the prepare/run strategy in Javascript. Is there a solution for that ?
  • In the second solution, I have not found a way to write a Javascript-style conditional statement for the "run-if" statement. Is there also a solution for that ?

Thank you very much !

Comments

  • Hi @bbkm ,

    That code is certainly possible to rewrite in Javascript if you know that language, but you want to consider a simpler solution that requires no programming at all.

    It may be that you want to shuffle the conditions following certain rules, in which case some programming will be needed (hopefully someone with knowledge of Javascript can help you with this). But if what you just want is to execute blocks in a random order (that what I understand from your post), you could simply use a nested design and take advantage of the "Run if" option of sequences....

    First, create a loop of blocks with some variable that identifies each block separately:

    Next, create a block sequence in which you insert a loop for each block, and use "Run if" to condition the execution of one of these blocks to the value of "BlockID":

    Et voilà! Bob's your uncle! Now the task runs blocks A, B, C and D in a random order.

    You can download this basic example here:

    Note that in this example, I've assumed that in each block you want to run the same sort of sequence, just change the stimuli, so I pasted a linked copy of the same sequence (Trial_sequence) in each block. However, if you wanted something entirely different to happen in each block, you could of course create a unique sequence for each block.

    This method uses no programming code at all and will run fine in your browser. It's is JATOS compatible.

    Hope this helps.

    Fabrice.

    If you found my reply helpful and wish to invite me to a coffee, you can do so here ๐Ÿ˜‰ Buy Me A Coffee

  • Thank you very much Fabrice! This saved me a lot of time and it worked perfectly :)!

  • You're welcome, @bbkm . Glad it helped. Coding is great but sometimes simpler solutions do the trick just fine.

    If you found my reply helpful and wish to invite me to a coffee, you can do so here ๐Ÿ˜‰ Buy Me A Coffee

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 http://45.77.173.118/ 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