[open] Form plugin and loop
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
Hi Nynke,
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
:However, the variable
question
is also used by the plug-in itself, to store the question. You can see that here:So now
form_var
, viaquestion
, is actually defined byquestion_text
. You see? Andquestion_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
Check out SigmundAI.eu for our OpenSesame AI assistant!
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).
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...
However, I am not aware of any recursion, see script in form_multiple_question below:
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
Check out SigmundAI.eu for our OpenSesame AI assistant!
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!
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.
Check out SigmundAI.eu for our OpenSesame AI assistant!
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
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 thelogger
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
Check out SigmundAI.eu for our OpenSesame AI assistant!
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
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!
Right, it's not bad practice per se, but it's unusual and will confuse the
logger
. What happens is that alogger
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 thelogger
.Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!