Howdy, Stranger!

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

Supported by

Status of the ENTER key

Hello,

Could you please document the behavior of the ENTER key as a code used for instance in a keyboard_response element, or for testing in a sequence element. ENTER and NUM_ENTER appear in the list of the available keys documented in keyboard_response, but they are actually unusable. They have no effect in any kind of operation so I guess that they may have a special status. I use OpenSesame 4.0.37 on a Windows 11 computer.

Kind regards,

Gérard

Comments

  • Hi @gerhono,

    I'm not sure I understand your question. But if what you're after is to know what code corresponds to specific keys on your system, just create a keyboard object and then use a line of code to output the response to the console. That way you'll see exactly what gets registered when you pressk a key on your keyboard.

    Hope this helps,

    Fabrice.

    Buy Me A Coffee

  • Hi Fabrice,

    My problem is that the ENTER key is not recognized at all. Whatever the context, inside of a keybord_response list of possible responses or a line of code inside of a sequence conditional line of code, the code 'enter' or 'ENTER' has no effect, it is ignored.

    Gérard

  • Hi @gerhono,

    I'm not sure I understand your description. When you say that the ENTER key is recognized, do you mean that when you press the ENTER key on your keyboard in response to a keyboard object, nothing is registered?

    Could you upload your btask (or a stripped down version of it)?

    Best,

    Fabrice.

    Buy Me A Coffee

  • Hi Fabrice,

    An example of test is attached.


  • Hi @gerhono,

    As I mentioned above, a good way to work out what is being registered is to allow any key to be registered by the keyboard object and use code to write what-s been registered to the console.

    In your case, because your keyboard object is named Rep, you can then use an inline_script and insert the following line:

    print (var.response_Rep)
    

    This will output the key pressed to the console and you'll be able to see what is being registered. If you do so you'll see that under PsychoPy (at least on my computer, but I suspect it's the same on yours), you get return (and not enter) when you press the ENTER key. So you need to change your conditions to expect return and not enter.

    Also, though the use of [ } is still allowed in Open Sesame 4, please not that you can now use the variable names directly and even include Python functions.

    Using this nea feature, the "Run if" conditions can be written as illustrated above. Note that pressing the ENTER key will always be registered as return and not RETURN. However, for your information, in case it is useful to you on some other occasion, I inserted abovce the method that allows you to test a condition irrespective of whether the string contains lowercase, uppercase or a mix of lower and uppercases characters.

    Take a look at this modified version. You'll see that it is now working properly.

    Hope this helps,

    Fabrice.

    Buy Me A Coffee

  • Hello Fabrice,

    Thank you for your time and efforts. Unfortunately, your code does not perform as expected. The error message is attached.

    Best regards,

    Gérard

  • Hi @gerhono,

    I inadvertently moved the inline_script object before the keyboard object. That's why you got this error message. If you read the error message you'll see that it located the isue in the inline_script object and that it says that "Variable response_Rep does not exist". That's because as I inadvertently moved the code before the keyboard object and that keyboard object creates the response_Rep variable, it doesn't exist yet by the time I try to write it to the console.

    Anyway, if you move the inline_script after the keyboard object (where I should have left it before saving the file), the task does run.

    Here it is:

    Best,

    Fabrice.

    Buy Me A Coffee

  • Hi Fabrice,

    Thank you for solving the problem and for the additional explanations. Now, I can catch the enter key.

    However, it could be a good idea to update the list of keys that documents the keybord object in a future release of OpenSesame because that is the source of confusion.

    Enjoy your coffee !

    Gérard

  • Hi @gerhono,

    Glad it now works!

    I think the key code can vary across systems (I do seem to remember that on one occasion, on my keyboard, the main ENTER key and that on the numerical keypad produced different codes). Key names can for example differ between backends (see https://osdoc.cogsci.nl/3.2/manual/python/keyboard/#response-keywords).

    I can alert the makers of Open Sesame about any possible confusing info in the documentation. Was there a specific page or document you thought should be updated?

    In my own tasks, what I do is allow any key as a response and then output the key registered to the console, so that I can check what key name is being registered on my system and what specific backend (can be useful if you're using special keys like back space, delete, etc.).

    Best,

    Fabrice.

    Buy Me A Coffee

  • Hi Fabrice,

    The document to which I refer is the list of keys that you get when you press the button "List of available keys" of the keyboard object. It is a standard list that does not always fit the current keyboard. Because OpenSesame is supposed to be an easy to use system of design, that allows to concentrate on the contents of the experiment and reduce tedious programming, that button could provide a list of the ACTUAL keys detected by a background code of the kind that you are referring to.

    Best,

    Gérard

  • Hi @gerhono,

    Thanks for the information, The list in indeed generic. I believe the exact key code return can vary with the backend selected but it can also vary with the user's system (I think Macs differenntiate between Enter and Return keys), or the type of keyboard. Currently, the list of available keys showing when you press that button does not adapt to the specific user and system. I'll flagg this to @sebastiaan just in case this is something the developpers might be interested to look into.

    In my own programming, I either use the console to ouput the key registered so that I can check what is being registered exactly, or I declare both RETURN and ENTER as allowed keys.

    Best,

    Fabrice.

    Buy Me A Coffee

  • Hi @gerhono and @Fab ,

    The list does actually depend on the backend and system. It may not be foolproof though, because it depends on introspecting the library that is used, so I actually also typically do what @Fab suggests: recording a key and printing it to a sketchpad or the console.

    — Sebastiaan

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