Howdy, Stranger!

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

Supported by

Sequence timing

Hi!

In my current experiment I want people to be able to fill something in for 12 seconds. If they haven't filled anything in by that time, they should automatically go to the next trial.

Participants will type in a score and are able to switch between the boxes with the left and right arrow keys (the green box around the textbox indicating which one they've selected). Once they are done and rated all 3 items they can press enter and continue to the next trial themselves if they don't want to wait out the 12 seconds.

The issue here is that I've set the keyboard response timer to 12 seconds, which works if they never touch anything. However every time they click a button the loop is repeated. This means that 1 trial can basically go on forever if people just keep switching between textboxes for example.

Therefore I was wondering if there is a way to time how long a sequence (click sequence in this case) has been running, if the sequence has been running for 12 seconds, then the loop should end.

I hope you can help!

Kind regards,

Sanne


Comments

  • Hi @Sannee ,


    Sorry for not getting back to this question earlier. And yes, you did the right thing opening different threads for different questions! :)


    Could you check whether the following logic works?

    • Append two more inline_javascript items. One before starting the loop that collects the clicks, the other one at the beginning of the click sequence, like so:



    • Place something like the following in the Run tab of the first inline_javascript item:
    // Initial timeout
    vars.var_timeout = 12000 
    // Current time stamp (right before starting the click loop)
    vars.starting_time = new Date().getTime();
    // Create a variable that checks whether a timeout
    // occurred
    vars.timeout_occurred = "no"
    


    • And something like this to the second one (also in the Run tab):
    // Get current timestamp
    vars.current_time = new Date().getTime();
    // Calculate the time that is passed:
    vars.time_passed = vars.current_time - vars.starting_time
    // Update the timeout:
    vars.var_timeout = 12000 - vars.time_passed
    // Make sure that the timeout cannot be negative:
    if (vars.var_timeout <= 0){
        // Change the variable keeping track of whether
        // a timeout occurred
        vars.timeout_occurred = "yes"
        }
    console.log("time passed = " + vars.time_passed)
    


    • Use the Run-if statements to only run the remainder of the click sequence if no timeout occurred:


    • And change the Repeat-if statement in the repeat_cycle element, making sure that we break from the loop if a timeout occurred:

    [check] == no and [timeout_occurred] != "yes"


    I attached the modified script. I hope this results in the behaviour that you are looking for.


    Cheers,


    Lotje


    Did you like my answer? Feel free to Buy Me A Coffee :)

  • Hi Lotje!

    No worries at all!

    And this indeed works exactly as I wanted it too! Such a simple solution but in all honesty I would never have found it myself. Thanks so much for your help not just on this question but all the others as well!

    Kind regards,

    Sanne

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