Howdy, Stranger!

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

Supported by

[open] Form plugin and loop

edited September 2014 in OpenSesame

Hello all,

I am new to OpenSesame and I'm currently evaluating whether I can use OpenSesame for my postdoc project in which I'll be designing a toolbox with several questionnaires and tasks. I just had a first try at constructing a questionnaire in OpenSesame with the Form plugin but the experiment got stuck in a sequence with form_multiple_question items. Since I am new to OpenSesame, it is very well possible that I missed something obvious, so please be kind :)

In my experiment, I created a loop with two variables (question and question_text), in the loop a sequence with a form_multiple_choice. The script for the form_multiple_choice is:

set allow_multiple "no"
set description "A simple multiple choice item"
set question "[question_text]"
set button_text "Ok"
set advance_immediately "yes"
set form_title "Form title"
set form_var "[question]"
__options__
Zeer mee oneens
Beetje mee oneeens
Beetje mee eens
Helemaal eens
__end__

I get the following error message (the phrase between brackets is the text of the first question): "Familie is het belangrijkste in iemands leven" is not a valid variable name. Variable names must consist of alphanumeric characters and underscores, and may not start with a digit.

I am aware that there are alternative approaches such as creating a form_multiple_choice for each separate question or programming this loop in python myself (or with a form_base item), but I am mainly curious why this current approach does not work?

I hope you can help me understand this! Thanks in advance!

Comments

  • edited 6:22AM

    Hi Nynke,

    Since I am new to OpenSesame, it is very well possible that I missed something obvious, so please be kind

    Only nice folk here, don't worry.

    Your problem is an interesting case of recursion, or rather something that is recursion-like. You have told OpenSesame to use a response variable of which the name is itself defined by the variable question:

    set form_var "[question]"
    

    However, the variable question is also used by the plug-in itself, to store the question. You can see that here:

    set question "[question_text]"
    

    So now form_var, via question, is actually defined by question_text. You see? And question_text has values like Familie is het belangrijkste in iemands leven, which is not a valid name for a variable. And that's why OpenSesame complains.

    So what you want to do is avoid using the variable name question, because it is already used for another purpose. You can use something like _question, that's fine.

    See also:

    Cheers!
    Sebastiaan

  • edited 6:22AM

    Many thanks for the quick reply! This was indeed the problem and it is now working perfectly!

    B.t.w., Is it correct that there is no easy direct way (e.g., a gui-based configuration as for the form_multiple_choice without programming) to make a question with a rating scale? (I know I can do that with the form_base_item, but I am also thinking about the potential use of the program for students who have less affinity/experience with coding).

  • edited 6:22AM

    I'm afraid that the problem is not solved completely yet. Although the script runs fine after changing the variable names (FYI variable names are now my_question_text and my_question_label), the problem reoccurred after I added a logger item to the sequence (after the form_multiple_question). The task still runs but I get the following message when I click on 'Apply and close script editor' of the Logger. Also, the logging is not performed correctly.

    OpenSesame says...

    Recursion detected! Is variable 'form_var' defined in terms of itself (e.g., 'var = [var]') in item 'form_multiple_choice' (Edit the script to fix this).

    However, I am not aware of any recursion, see script in form_multiple_question below:

    set allow_multiple "no"
    set description "A simple multiple choice item"
    set question "[my_question_text]"
    set button_text "Ok"
    set advance_immediately "yes"
    set form_title "Form title"
    set form_var "[my_question_label]"
    __options__
    Zeer mee oneens
    Beetje mee oneens
    Beetje mee eens
    Helemaal eens
    __end__
    
  • edited 6:22AM

    B.t.w., Is it correct that there is no easy direct way (e.g., a gui-based configuration as for the form_multiple_choice without programming) to make a question with a rating scale? (I know I can do that with the form_base_item, but I am also thinking about the potential use of the program for students who have less affinity/experience with coding).

    No that's correct, there's no rating scale plug-in. Might be something to add, though.

    Regarding the problem. Based on your description I cannot tell what the problem might be. (Or well ... it's clearly some kind of recursion issue again.) Could you upload the full experimental script to pastebin.com or a similar website?

    Cheers,
    Sebastiaan

  • edited 6:22AM

    I have pasted the script to: http://pastebin.com/3pqk4V82
    Hopefully you'll notice what the problem is!

    A rating-scale plugin might be something that I'll be making anyway, if I manage so I'll share it!

  • edited 6:22AM

    A rating-scale plugin might be something that I'll be making anyway, if I manage so I'll share it!

    Your contribution would be most welcome. You could take a look at the other plug-ins to see how those are implemented. It's not too difficult, really.

  • edited 6:22AM

    I certainly will, I already had a look at how plugins can be made.
    BTW I still didn't figure out what the problem is with my script, would you please have a look? : http://pastebin.com/3pqk4V82

  • edited 6:22AM

    Hi Nynke,

    It was a sneaky little bug in the form_multiple_choice plug-in. Harmless, as long as you don't try to view the logger or variable inspector. I'll upload a new pre-release of 2.9.0 later today in which this should be fixed (look for >= 2.9.0~pre16; it's still present in pre15 and earlier).

    Cheers,
    Sebastiaan

  • edited 6:22AM

    Hi Sebastiaan,

    Thank you for the new release and fixing the small bug! I do not get the recursion errors anymore and the task runs.
    However, the logging is still not performed properly. As you see, I have logger items after each question but the responses clicked during the task are not in the log file, all responses are NA. In the variable inspector, the response variable is in item 'welcome' (the start screen I put in the unused items). When I permanently delete the 'welcome' item, the response column in the log-file is not there anymore at all.

    I understand from responses to other people that I could also use inline scripts for identifying/logging responses. But I thought that with my current approach it would work with the regular logger item?

    Do you have any idea what is going wrong?

    Greets, Nynke

  • edited 6:22AM

    I solved the problem. I guess it is bad practice to change the name of the response item each log (as response var name I gave [my_question_label] so that changes in every question). Now I just gave a single response variable name and logging works fine!
    Thanks for the help!

  • edited 6:22AM

    I guess it is bad practice to change the name of the response item each log (as response var name I gave [my_question_label] so that changes in every question). Now I just gave a single response variable name and logging works fine!

    Right, it's not bad practice per se, but it's unusual and will confuse the logger. What happens is that a logger checks which variables exists the first time that it is executed. So when you add new variables afterwards, they won't be logged, unless you explicitly add them using the 'Add custom variable' option in the logger.

    Cheers!
    Sebastiaan

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