Howdy, Stranger!

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

Supported by

Adding Conditional Changes in Sequence based on Keypress

I am working on creating a psych experiment. My goal is to create an experiment where a photo is shown for 2 seconds. After, participants are given the choice to press "1" to see the image again for 4 seconds or "9" to see a black screen for 4 seconds.

I have found that keyboard responses only collect keypresses and cannot change the sequence of the experiment. Is there a way to override this/change it with adjusting the code in the script? I have tried rewriting the sketchpad script (where the image is shown) to "show if: keypress=1" but this has been unsuccessful.

Looking for tips from someone with a more extensive background in coding!


  • Hi,

    yes, scripting will be necessary I think. But it is not terribly complicated. Check out the documentation to get an idea of how to use python code:

    It is not clear from your description how the sequence should end, but if seeing it once is enough, a regular sequence could be enough. If so, then you can simply have a sequence consisting of following items:

    • first stim
    • keyboard response
    • second stim (same visuals as first stim, but different duration)
    • alternative second stim (black screen)

    Only important thing to keep in mind here is that you have to use feedback time for the last two items, otherwise the experiment will crash (see [here]( The run if fields you can then set to the response that needs to be given ([response]=<value>)

    If it has to repeat multiple times, you would need inline script. Let me know if you need help, then I can try to implement an example for you.


    Buy Me A Coffee

  • Hi Eduard,

    Thank you for this advice! I already have the sequence you described but I'm not sure how to incorporate the run if fields. Do you know the "run if" code that would connect the keyboard response to the stimulus?

  • After a response is given, OS automatically creates a variables called var.response that represents the key that was pressed. You can use this variable to show/omit certain parts of the sequence, the way to do it is described in the beginner's tutorial for example, but the attached example also demonstrates it.

    Let me know if it still is not clear.


    Note: This is just a demonstration of the procedure, the code is not yet doing what you described above.

    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