timeout and skip to next task

PennController for IBEX Forums Support timeout and skip to next task

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #6433

    Hello Jeremy,

    I’m planning my next experiment and I am having some problems with the newTimer function. I already used this function to provide feedbacks but what I need this time is slightly different.
    Participants will be doing task_A for 4 minutes and when the time is over (regardless how many trials they completed) they will go the next task_B.

    I have two problems with what I have writted so far: 1) I get the message only when a key is pressed (so if the 4 minutes ends in the middle of a trial, the message pops out only once that trial is over). 2) I do not know how to end the present task_A and go to the next after the 4 minutes.
    Any suggestion? Thank you in advance!

            row => 		
              newTimer("kt", 240000).start(),
                .success(clear(), getTimer("kt").stop(),
                newText("I'm sorry, the time is over").css({'font-size':'1.5vw'}).print("center at 50%", "middle at 30%"),
                newButton("go","Go to the next task").css({'font-size':'1.5vw'}).print("center at 50%", "middle at 50%").wait()),  
    // ...?


    Let me know whether I understood your design correctly: you have a first block of trials labeled task_A and a second block of trials labeled task_B. In case your participant takes more than 4 minutes completing the first block (task_A) you want to prematurely end whichever trial the participant is currently on and skip all the remaining task_A trials, and jump directly to the first task_B trial.

    What you can do to that end is set a global Var element before starting block task_A to a timecode corresponding to four minutes later. Then at the beginning of each trial of block task_A, you look up the current timecode and skip the trial if it’s over the timecode from the global Var element. Otherwise, you launch a Timer element that will check again later and either end the trial prematurely or re-launch itself.

    Here is an example:

    newTrial("pre_task_A", newVar("four_minutes_later").global().set(v=>Date.now()+4*60*1000) )
    Template( row => newTrial( "task_A" ,
            newTimer("check_end", 100).callback(
                    .success( end() )
                    .failure( getTimer("check_end").start() )
            newText("Task A").print(),
    ) )
    Template( row => newTrial( "task_B" ,
        newText("Task B").print(),
    ) )

    Let me know if you have any questions



    Thank you Jeremy! It worked!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.