How do I log whether the person pressed the right key or not?

PennController for IBEX Forums Support How do I log whether the person pressed the right key or not?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #6836
    uppsalas
    Participant

    Hello, I want to log in my results sheet if the person pressed the right key or not. From what I can see in the results, this is not being logged so how can I change that?

    This is the code of the trial part:

    Template( "StroopTable.csv" , row => 
      newTrial ("experimental-trial" ,
        defaultText.center()            // Horizontally center all Text elements automatically
        ,
        newText("word", row.Word)       // Show the text from the 'Word' column
            .color(row.Color)          // Color the text as specified in the 'FontColor' column
            .css("font-size", "24pt") // Increase the font size
            .log()                      // Reports when the Text is displayed in the results file
            .print()
        ,
            newVar("RTword")
        .global()
        .set(v=>Date.now())
        ,
        
        newKey("keypress", "rav")
            .log()                      // Reports when the key is pressed in the results file
            .wait()
        ,
        getVar("RTword")
        .set(v=>Date.now()-v)
        ,
            
        // Wait 1s before moving to the next trial
        newTimer(500).start().wait().log()
      )
      
      .log( "word"    , row.Word       ) // Append the value of 'Word' at the end of the results lines
      .log( "color"   , row.Color  ) // Append the value of 'FontColor' at the end of the results lines
      .log( "correct" , row.Key ) // Append the value of 'CorrectKey' at the end of the results lines
      .log( "RTword" , getVar("RTword") )
    )
    
    SendResults("send")
    

    This is what I see in results of only one item. I also wonder why it appears six times:

    
    1617676900,f980c64f763d5ccdd4e0c41a484e74dc,PennController,60,0,experimental-trial,NULL,PennController,61,_Trial_,Start,1617676806885,MOMENTO, red, r,4610,NULL
    1617676900,f980c64f763d5ccdd4e0c41a484e74dc,PennController,60,0,experimental-trial,NULL,Text,word,Print,NA,1617676806887,MOMENTO, red, r,4610,NULL
    1617676900,f980c64f763d5ccdd4e0c41a484e74dc,PennController,60,0,experimental-trial,NULL,Key,keypress,PressedKey,R,1617676811495,MOMENTO, red, r,4610,Wait success
    1617676900,f980c64f763d5ccdd4e0c41a484e74dc,PennController,60,0,experimental-trial,NULL,Timer,Timer,Start,Start,1617676811498,MOMENTO, red, r,4610,NULL
    1617676900,f980c64f763d5ccdd4e0c41a484e74dc,PennController,60,0,experimental-trial,NULL,Timer,Timer,End,End,1617676812001,MOMENTO, red, r,4610,NULL
    1617676900,f980c64f763d5ccdd4e0c41a484e74dc,PennController,60,0,experimental-trial,NULL,PennController,61,_Trial_,End,1617676812003,MOMENTO, red, r,4610,NULL
    

    Thank you in advance.

    #6839
    Jeremy
    Keymaster

    Hi,

    PennController adds one line to the results file per event that is logged. The start and end of a trial are logged by default, and you additionally log your Text, Key and Timer elements: you get one line for when the Text element was printed, one line for when a key was pressed, and two lines corresponding to the start and end of the Timer element. The third line is the one for the Key element, and you can see that the key that was pressed is R, which matches the correct column, which reports r (it’s not a perfect match because you added a space character before r in your table, and you use lower-case when the pressed character is reported in upper case)

    Jeremy

    #6843
    uppsalas
    Participant

    Thank you for answering. The issue is that in all instances it says success when I tried it myself and I pressed the wrong one to see it in the resutls. Why does this happen?

    #6844
    Jeremy
    Keymaster

    It says “Wait success,” which means that the keypress successfully validated a wait command

    Jeremy

    #6845
    uppsalas
    Participant

    Oh, okay, thank you.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.