Howdy, Stranger!

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

Supported by

Programming a multi-character (correct) response

Hi everyone,

I am programming my first OpenSesame experiment. The goal is a spelling bee task. My current trial sequence looks like this:

1) a word is presented through a sampler calling on a random word defined as [word] in the block loop

2) the answer_input_form is used to collect the participants answer

3) an inline script is written to compare the answer of the answer_input_form to the correct answer [word].

4) feedback is presented (correct/incorrect)

This set-up has some flaws: The answer_input_form cannot be timeout by the press of a butten (i.e. press enter when you have finished typing the word). Therefore, I have also tried this method: but am unsure how to adapt the code to my situation.

Any help is appreciated, thanks in advance!


  • Hi @elisevt,

    Here's a hybrid solution using code inspired from that you found.

    It kind of works, with one limitation: it is not possible to enforce a strict timeout on the keyboard object using that method. This is because the keyboard call awaits a response before executring any other code, and so the timeout condition cannot be assessed until after a key has been pressed. This means that if you wanted to enforce a time limit of, say, 5000 ms, the response taking would not be interrupted until the first key being pressed after that 5000 ms interval. I searched for a solution to this but I don't think one exists (through I'm no Python expert; perhaps @eduard knows of a way around it).

    Other than that, I attach a demo task that does most of what you require: presents words in random order, takes multiple key presses (handles back spaces, special characters), kind of limits the response time window, and scores the response and provides feedback. Hopefully you can modify it and adapt it to your needs.

    I included notes throughout the code inside the task so that you can see what each bit does.

    The general logic is to encapsulate the registration of multiple key presses with it s own loop, nested within the loop controlling the trial. That way, we can interrupt the registration of responses when the subject presses "ENTER" or when the last response registered comes later than the maximim allowed time (not that I coded this as the "time_limit" variable inside the "words_list" loop, so that it could be set differently for different trial if you wanted to).

    Please also note the use of the break it function in the loop tasked with registering key presses:

    Here's my version of the task:

    Hope this helps,


    Buy Me A Coffee

  • Hi Fabrice,

    Thanks so much, the experiment is running now!


  • Hi @elisevt,

    Glad I could help! Good luck with your experiment!



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