Howdy, Stranger!

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

Supported by

Breaking the loop after 5 Minutes

Hi all,

I'm sorry if my question may have been asked several times already, but I couldn't find anything appropriate in my research.

My challenge is to finish a loop after exactly 5 minutes, no matter how many rows are left.

For example, I have 5 rows and a subject arrives at row 3 after 5 minutes. I want the loop to end and log rows 4 and 5 as 0. I tried using the break if function but somehow it doesn't work or I'm doing something wrong.

I would be very grateful for a solution.

Comments

  • Hi @mirko,

    You can actually find some useful pointers here: https://forum.cogsci.nl/discussion/1281/solved-please-advise-countdown-timer-time-limit-in-sequence#latest

    the basic idea is to use some code to store the current time stamp before the loop starts, and then set the "break if" property of the loop to an expression that calculates the difference between the current time and the initial stored time stamp.

    I set up a working example for you to explore. the task just presents 10 digits in a loop that would repeat 50 times unless 15 seconds go by. I added a variable displaying the time elapsed with every stimulus, just for illustration.

    You should be able to adapt your task following that logic.

    Good luck!

    Fabrice.

    Buy Me A Coffee

  • Hey @Fab,

    thank you very much for this solution. As you may have also seen, I have already asked my question in the post you posted. The solution is good but does not target exactly what I need. So what exactly do I want? I'll try to explain it better.

    In your example, the loop will be terminated only after the completion of the respective task. The current task is therefore executed to the end before the loop is interrupted or terminated. However, I would like the loop to end exactly after 5 minutes, regardless of whether the task is still being processed or not.

    To explain it better, I try to describe it with my experiment. I present a total of 20 stimuli, i.e. 20 tasks. For each task, the test participants need several seconds or even longer. After solving the task, the subjects have to click on a "Next" button to move to the next task. Now I want the loop to end after 5 minutes, no matter if the subject clicks on the "Next" button or not. With your solution, they have to click first and then the loop ends. But then 5.20 minutes could have passed already.

    I hope I have described my problem better. Maybe there is a solution.

  • Hi @mirko,

    Thanks for your description. I get a better idea of what you're trying to do now.

    The solution would depend on your task characteristics... One option would be to set the "Run if" property of all the events in your sequence to only run if the time elapsed is shorter than the interval you're allowing (5 minutes in your description). That's in addition to the "Break if" set up I posted earlier.

    In my example, that would consist in adding the following:


    Doing this, it should mean that whatever stage of the trial you're at, events won't be initiated if the allowed interval has passed.

    Depending on how your task involves, that might be good enough (hopefully).

    Now, if you want to interrupt a specific event that can take some time (for example if you participant is typing something in a form_text_input object, you can't interrupt it (at least not in a way that only terminates the loop). One idea you could try is to set the duration or timeout property of your events based on a value that you calculate with code before the critical events, but I'm not sure it would work for objects other than the feedback object, because I think that its duration would be set during the "prepare" phase (and so, by definition, it could not be set to the value you'd calculate right before the event is executed). You could try it out and see how far you go.

    Best,

    Fabrice.

    Buy Me A Coffee

  • Hi @Fab,

    thank you for your answer. I think the problem is this. A loop always works task by task. As long as the loop "hangs" in a task, the "Cancel" command is not executed. Here is my example experiment with a very short "processing time" (originally it should be 5 minutes and much more itemrows). As you can see the loop ends after clicking the button.


  • Hi @mirko,

    Maybe the developers or other users will have some useful suggestions but I don't think you can constrain the duration of the form base dynamically. One option would have been to calculate the maximum time left before the form is displayed and set its duration to that value. Unfortunately, the form is prepared before the sequence is executed, so that method cannot work.

    I can't see a way around that issue at the moment, sorry... 🤔

    Hopefully someone else out there might think of a way around this problem!

    Best,

    Fabrice.

    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