Howdy, Stranger!

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

Supported by

inline script repeat

Dear all

I created a multiple choice questionnaire using inline scripts (there is a total of 4 questionnaires):

Out of experience I know that participant sometimes accidentally forget to answer a question. This is why I added an inline script (for each questionnaire - these are the scripts with "NA" at the end) which redirects them to the question so they have another chance to answer. This is the code I am using (e.g. for the first questionnaire "Q1_mp_check_1_SST"):

if var.Q1_effort_SST == None:
    no_answer.prepare()
    no_answer.show() #text warning participants that they forgot to answer a question 
    self.sleep(5000)
    cv.clear()
    exp.items['Q1_mp_check_1_SST'].prepare()
    exp.items['Q1_mp_check_1_SST'].run() #redirecting them to the question

if var.Q1_difficulty_SST == None:
    no_answer.prepare()
    no_answer.show()
    self.sleep(5000)
    cv.clear()
    exp.items['Q1_mp_check_1_SST'].prepare()
    exp.items['Q1_mp_check_1_SST'].run()

This code works the first time when a question is left out. However the second time it just skips to the next question. Is it possible to repeat the cycle untill every question is answered?

Thanks,
zsc

Comments

  • Hi zsc,

    What happens is that your script does not actually redirects OpenSesame back into the existing sequence, rather, it creates a copy of the questionnaire to display. Therefore, the script does not run again after the first time (since it is already passed in the sequence).

    A solution would be to replace the if statements for while loops:

    while var.Q1_effort_SST == None:
        no_answer.prepare()
        no_answer.show() #text warning participants that they forgot to answer a question 
        self.sleep(5000)
        cv.clear()
        exp.items['Q1_mp_check_1_SST'].prepare()
        exp.items['Q1_mp_check_1_SST'].run() #redirecting them to the question
    

    Now, the script will copy the questionnaire over and over until an answer has been given.

    Best,
    Laurent

  • Dear Laurent

    Thank you very much! This solves my problem (I totally forgot about the while statement :))!

    Cheers,
    zsc

  • I'm sorry, I have one last question:

    In my inline script (I posted above) I use 2 "while" statements. When I don't answer both questions then I get a message and I get another chance to fill out the questions (i.e. I'm "redirected" to the questionnaire). When I answer the 1. question and leave out the 2. question again I get the message and I get redirected. But after I get redirected and then only answer the 2. question then I get to continue with the questionnaire. I guess the problem is, that I have 2 while statements and the 1. question is somehow registered and the program thinks I already answered the 1. question. Do I have to combine the 2 statements in order to allow the particpants to continue with the questionnaire only when they answered BOTH questions?

    Thanks!

  • Hi zsc,

    I guess the problem is, that I have 2 while statements and the 1. question is somehow registered and the program thinks I already answered the 1. question.

    Exactly, the program does not start at the start of your script again. Therefore you'd need to combine both statements:

    no_answer = canvas()
    
    while var.mc1 == 'no' or var.mc2 == 'no':
        no_answer.text('You missed a question!') #text warning participants that they forgot to answer a question 
        no_answer.show()
        self.sleep(2000)
        no_answer.clear()
        if var.mc1 == 'no':
            exp.items['mc1'].prepare()
            exp.items['mc1'].run() #redirecting them to the first question
        elif var.mc2 == 'no':
            exp.items['mc2'].prepare()
            exp.items['mc2'].run() #redirecting them to the second question
    

    This is slightly different from your original script but the main idea should be the same. This could get quite complext though, depending on the exact procedure and design of your questionnaires.

  • Dear Laurent

    Brilliant, it works! Thank you very much for your help!

    Cheers,
    zsc

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