Howdy, Stranger!

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

Supported by

Typing multi-character responses with keyboard

I'm creating an experiment in OpenSesame where participants need to answer multiplication problems by using their keyboard. However, the keyboard response only registers the first of two digits when the solution is a two-digit number, and also continues to the next trial immediately after typing the first digit. How can I make sure that the program registers the full two-digit keyboard response before continuing to the next trial? Thanks!

Comments

  • Hi @EJacobs,

    In OpenSesame, collecting and appending multiple keyboard responses in the same trial involves using a loop to repeatedly capture keyboard input and then appending these inputs to a list or string.

    The simplest way to achieve this is to use a loop containing a sequence containing the keyboard object, to set the loop to repeat a high number of times, to use code within the sequence to append the keys pressed as they get pressed, and to detect when "Enter" is pressed to then set a variable serving as a check that the input is complete, which you check against a certain condition in the "Break if" section of the loop.

    In other words, the keyboard object should run in a loop within the trial's loop (i.e., nested loop) and you'd use code to track what is being pressed and define the condition under which that nested loop breaks so that the trial continues.

    Alternatively, if you'd rather use pure Python code and avoid creating nested loops, using the keyboatrd object etc., you can use the method described here: https://forum.cogsci.nl/discussion/31/solved-multi-character-keyboard-response-or-simultaneous-sketchpad-and-text-input

    Hope this helps,

    Fabrice.

    Buy Me A Coffee

  • Hi Fabrice,

    Thank you for your help! I managed to create a nested loop, so I'm now able to type multiple keyboard responses. However, I'm still struggling with the code within the sequence to make sure all of the pressed keys are detected/registered, as well as using code to break the keyboard loop when "enter" is pressed. Could you maybe provide me with a code that I can use for this? Thank you!

  • I also have another question that is related to this. I want the participants to be able to see the answer that they're typing. Is this possible? If yes, how can I do this?

  • Hi Fabrice,

    I've worked on it a little bit more: I've used code and managed to make the nested loop break when 'return' is pressed and the participants are also able to see what they're typing, so this is solved. However, in the log file only the last keypress is registered (which is 'return') and, therefore, the log file always says the participant's answer was incorrect. I need the experiment to log the full response before return is pressed and this response needs to be checked against my variable 'Correct_Response' to determine the accuracy of the response. Could you help me with this?

  • Hi,

    I don't know how your experiment looks like, but if the logger is only logging the last response, it usually helps, to move it inside the nested loops one level, so that it is called more often, and not just once in the end. Do you know what I mean?

    Eduard

    Buy Me A Coffee

  • That helped, thank you! It is logging all off the keyboard responses now. However, the var.accuracy is still showing the responses as incorrect, because it is logging each keyboard response separately. For example, if the correct response is 12, the participant has to type '1' '2' and 'return', which is logged as an incorrect response, because the program checks all of the keyboard presses separately against the correct_response (which is 12). Does that make sense? Is there a way to solve this?

  • I just read your initial post, and I am surprised you haven't tried the text_input form. It was added to Opensesame for exactly this reason. So, no need to nest loops or anything alike. Just use a text input.

    Eduard

    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