Howdy, Stranger!

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

Supported by

[solved] Coding correct responses with a form

edited February 2016 in OpenSesame

Hi there,

I have a form set up with four mouse button responses, which are being logged as 'a', 'b', 'c' and 'd' in the data file with yes/no as responses. I am using this for a cognitive task in which each question has a correct response. I want to to add some script so if 'a' codes as 'yes', it adds a '1' into a new variable, and 'b' as 'yes' would add a 2 into the same variable etc. Ideally I want an additional variable column with the correct answer for each question to be able to automatically code if the answer is correct for each participant.

Apologies if this has been asked before; I had a search around and couldn't find an answer.

Many thanks,
Alex

Comments

  • edited 6:44AM

    Hi Alex,

    So the idea is that participants can always respond yes or no, with either one of 4 buttons? And then you just want to be able to specify which button was pressed?

    Depending on whether you used the mouse item or an inline_script, the button is stored either in a variable named button, or a variable named response. With this variable you can do anything you want, like creating a new variable. If you have a logger item in your trial sequence, then a variable will automatically be logged (meaning there will be a column for this variable), as long as you "set" it, using exp.set('variable_name', value). The correct response is already automatically logged if you use the mouse item. Otherwise you have to "set" the correct response for each trial separately.

    Cheers,

    Josh

  • edited 6:44AM

    Hi,

    Thanks for the response. Not 100% sure if I explained clearly. I created a form using a form base and opensesame script, and have four button widgets on screen, which have named A to D as variables. Participants click one of the four options to indicate their answer, which is giving me 'yes' or 'no' in the data sheet for each variable. The 'response' column says N/A.

    Thanks,
    Alex

  • edited 6:44AM

    Hi Alex,

    I don't want to hijack but i think i understand what you want, i had the same issue. The response variable is indeed not automatically collecting responses from the form. You need to add an inline_script directly after your form that contains the following statements to recode the answer and check if the answer is correct:

    # define the variables (just as an example)
    var.Answer = 0
    var.Correct = 2
    var.CorAns = 0
    
    # recode into one variable
    if var.A == 'yes':
        var.Answer = 1
    elif var.B == 'yes':
        var.Answer = 2
    # etc. etc.
    
    # check if answer is correct
    if var.Correct == var.Answer:
        var.CorAns = True
    else: 
        var.CorAns = False
    

    I hope this helps

    Laurent

  • edited 6:44AM

    Hi Laurent,

    Yes, this is what I meant. Thank you.

    A couple of other questions you might be able to help with... I have it set up with a loop, with a variable for each of the image files and questions used in the form. In the output I get a response time for all of the questions in the loop. Is there a way I can record the response time for the form click on one of the four boxes, for each condition?

    I was also wondering if, using the method you explained above, I can link the correct answer to the conditions in the loop by adding an extra column with the correct answer? So the value of Var.Correct would change for each of the questions?

    Thanks,
    Alex

  • edited 6:44AM

    Is there a way I can record the response time for the form click on one of the four boxes, for each condition?

    I don't think there is a direct way to do this no. You could decide to create the form with an inline_script instead of the custom_form item and manually obtain the timestamps. This thread has it written down better than i could.

    I was also wondering if, using the method you explained above, I can link the correct >answer to the conditions in the loop by adding an extra column with the correct answer? >So the value of Var.Correct would change for each of the questions?

    Yes, if you add the variable var.Correct to your loop and insert the correct values it should update the variable for every trial run. Don't forget to remove var.Correct = 0 in the script above to avoid it being overwritten every trial.

    Good luck!

  • edited 6:44AM

    Thank you. I really appreciate the help! :)

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