Howdy, Stranger!

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

Supported by

JavaScript sleep and cross trial constraints

Dear all,

sorry if these are newbie questions but I did not find information in the documentation or forum. Two questions. We have cross trial timing and randomization constraints:

(1) I could solve cross trial timing with inline_javascript. However, the only way I got this to work was using a tight loop and burning cpu cycles. None of the suggestions I found online mostly including setTimeout worked. Is there a JavaScript alternative for sleep working in OSWeb?

(2) I have to avoid repetitions of certain trial types. In OpenSesame this was easy using constrain. This appears not to work in OSWeb, neither can I load loops from files. Is there an accessible way to constrain randomization in OSWeb? I'm aware that I could use a manually defined sequential table. However, then order is the same for all participants in JATOS.

Thanks a lot for any input!

Andreas

Comments

  • Hi Andreas,

    I am not sure I fully understand your first point, but both problems seem to be fixable with the inline javascripts, no? You could implement your own randomization in it, and set experimental variables once you are done. So basically, create some conditions/timings in list and combine them in a way that makes sense given your constraints. Once you are done, you can set the variables with vars.set('timing_variable','timing_value')or whatever the precise code in javascript is.

    Does that help?

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    thank you for your input!

    The short version of the first question was: Is there a JavaScript equivalent for clock.sleep?

    My JavaScript skills are very limited. With my second question I was hoping for an accessible solution without having to learn lots of JavaScript. But if this appears not to be possible, right?

    Thanks a lot!

    Andreas

  • Hi Andreas,

    Sorry for the late reply! Unfortunately, my Javascript skills are also close to non-existent. So, I would also have to google.

    I think getting away without learning any javascript will be challenging, particularly for slightly more complex study designs. But maybe you can find some experiments on the forum that used javascript and use it as inspiration.

    Sorry and good luck,

    Eduard

    Buy Me A Coffee

  • Hi @widmann.

    Sadly no, there are no equivalents for clock.sleep in JavaScript. This is one of the main reasons why it is impossible to port the Python inline script items from OpenSesame to Osweb. Python by nature is a linear programming language, which can be paused, while Javascript is asynchronous, and thus cannot be paused (Google these terms if you like to know more).

    There are ways to sort of mimic a sleep period in JavaScript, but these are not easy, and most likely will involve a callback structure (such as with setTimout) that is not possible to achieve with inline_javascript items.

    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