Howdy, Stranger!

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

Supported by

Logging Multiple Key Duration While Video Running

Hello there,

I currently learning about OpenSesame and find a problem with logging. Here is my experiment that I want to make :
1. There is one video stimulus and it will last long 8 seconds.
2. I want to asses the hallucinations-experiences from participants while they watch the video stimulus.
3. Participant will press and hold "space" when the hallucination comes.
4. I already read your articles in http://forum.cogsci.nl/index.php?p=/discussion/37/solved-how-to-log-the-duration-of-a-key-press and http://forum.cogsci.nl/index.php?p=/discussion/1199/solved-log-time-and-duration-of-multiple-key-presses
5. I think the second link suits me well, but unfortunately the log file is empty
6. What I really need is the key press duration time without forcing video end

Could anyone help me solve this problem?

Kind Regards,
Satrio

Comments

  • Hi Satrio,

    I haven't tried it, but if you modify the code in the link above in this way, does it work?

    # needs to be put in the run phase!!!!
    import pygame
    t0 = clock.time()
    keydown = False
    keyup = False
    timeout = 10000 # how long do you want to wait?, Probably length of video
    while True:  
        # Determine the RT, i.e. the time relative to the loop start
        response_time = clock.time() - t0
        # Get all input events
        for event in pygame.event.get():
            # Print KEYDOWN and KEYUP events, including the key name
            # and the RT.
            if keyup == True and event.type == pygame.KEYDOWN:
                   keydown =True
            if keydown:
                 if event.type == pygame.KEYUP:
                     var.key = pygame.key.name(event.key)
                     var.respTime = clock.time()
                     keydown = False
                     keyup = True
        if clock.time()-t0 > timeout: 
            break
    log.write_vars()
    

    Hope this helps.

    Eduard

    Buy Me A Coffee

  • Hello Eduard,

    Thanks a lot for your reply! It worked and the log files shown up but unfortunately it was very messy. Also the things that I need (multiple duration key-presses) weren't there.

    For now, I change it into multiple single press with two buttons (z for when they saw the hallucination and m for when they think the hallucination ended) since I still confuse about pygame's syntax. It helps me to fulfill my need now, but I still want to know how to record multiple duration key-presses and I still try to find it hehe. I hope you would continue to discuss this topic until we find it :smiley: .

    Once again, many thanks for you Eduard!

    Kind Regards,
    Satrio

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