Howdy, Stranger!

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

Supported by

Timing out Experiment after specified time.

Hi everyone,

I'm trying to run a switft Letter Comparison Test where participants are asked to judge whether two character strings on screen are the same or different. Their score is determined as the amount of correctly-answered trials in a thirty-second period.

Trouble is, I'm not sure how to terminate my trial sequence after the 30-second time limit. So far, I've built my experiment as normal with a practice and an experimental block (see image below).

I've tried ending the experiment with an inline script at the start of the experiment, as below. I first define a maximum time of 30 seconds (30000 ms) in the Prepare phase, and call time values from the start of my sequence and block. In the Run phase, I have tried setting an "option" variable as 'timeOut' when the counter exceeds the maximum time of 30000ms, and this "option" is then called in the trialSequence to prevent stimuli from running if it is valid.

However, when attempting to run this, OpenSesame returns a

The variable 'time_trialSequence' does not exist.

error. What am I doing wrong here? Am I calling "time_trialSequence" before it is 'created' when trialSequence is run? If so, how do I script this 30-second timeout such that I can call all the variables I need and still initialise the timeout effectively?

I'm running OpenSesame 3.3.9b1 on Ubuntu Linux 20.04. Any help would be very appreciated!


  • Hi @Artabanos,

    This is happening because at the time you define trialTime (trialTime = self.get("time_trialSequence")), the trialSequence object has not started, hence it's time of onset has not been defined.

    You could try is the following:

    (1) define the maxtime as you currently, remove everything else from your timer script.

    (2) at the beginning of your expSequence, define blockTime

    (3) at the beginning of your trialSequence, define your trialTime

    (4) in the settings of your expLoop, use the "break if" option and set it to ([trialTime]-[blockTime] >= [maxtime]. Now, whenever that condition is met, the expLoop will be interrupted and the task will move to whether comes after that loop. If the Break if condition can't include operations, go back to step 3 and add a variable measuring the difference between trialTime and blockTime (let's say you call it timeElapsed), and set the break if condition to [timeElapsed] >= [maxTime].

    Haven't tried implementing this myself but I think it should work.

    Good luck!


    Buy Me A Coffee

  • Hi Fabrice,

    Thank you for your extensive and helpful reply! I didn't actually manage to get your solution to work, but your suggestions did lead me to a solution that ended up doing what I wanted it to do.

    1) Before any loops began, I defined maxTime as 30000 ms well as elapsedTime as an empty integer (using the int() function). This allows the trial loop later to call elapsedTime even though there is no value to this yet. I also allowed both of these values to be called by OpenSesame using the self.experiment.set() function.

    2) Then, I added another inline script as the final step in my trialSequence. This script defines: timeStart = self.get("time_trialBlock") as well as timeOut = self.get("time_LCTstring"). timeStart, in this case, is the time at which the trial block started, and timeOut calls the time at which the last stimulus was presented. timeStart is a static value, whereas timeOut updates every time a stimulus appears on screen.

    3) In the same script, I defined another variable as the difference between these two points in time: elapsedTime = timeOut - timeStart (and, again, set this variable to be used with self.experiment.set())

    4) Finally, in my trialBlock loop, I used the 'break if' function and set this to [elapsedTime]>=[maxTime].

    In this way, trialBlock calls only values already initialised and therefore won't terminate the experiment, and it neatly times out 30000ms (30 seconds) after the start of the trial block.

    Thanks again for your help @Fab , much appreciated!


  • Hi Willem @Artabanos,

    Great stuff! Glad you got it to work and solved the problem! 👍️

    Good luck with your experiment!


    Buy Me A Coffee

  • Hello everyone,

    i´m trying to do the same thing but i´m not able to see my mistake here. I want to implement different block times so i guessed that i needed more scripts, since i was trying to set either one minute or like 52000ms or so. (2 scripts for each block varying in its maxTime)

    After trying to trouble shoot i came across this thread. Maybe you can help me out by giving me either some further instruction or showing me the script that seems to have worked out in the end.

    Here are my scripts so far.

    Since i´m new to OpenSesame, please try explaining step-by-step.

    Thank you in advance.

    Kind regards, Chris😊

  • edited September 15

    Hi Chris,

    This example demonstrates the principle. You can adapt it to your needs.

    Since i´m new to OpenSesame, please try explaining step-by-step.

    As I see, you are not only new to Opensesame but also to Python. Understanding both is quite useful when using the software and building your experiments. I recommend you try some of the tutorials, and maybe also a Python course. If you have a basic understanding of those things, your coding experience will be much nice ;)


    Buy Me A Coffee

  • edited September 15


    i‘m quite new to all of this. The Experiment is required for my bachelor thesis. I‘ll try this out First thing in the Morning, thank you so far, Eduard.

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 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