Howdy, Stranger!

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

Supported by

[solved] form base problem

edited July 2013 in OpenSesame

Dear community,

I'm working on a microexpression experiment and have a question about the form base. The participants have to watch different emotions and have to choose the right answer. So I created the following form:

set margins "50;100;50;100"
set rows "1;1;1;1;1;1;1"
set spacing "25"
set description "A generic form plug-in"
set cols "1;1"
widget 1 0 1 1 button var="fearful" text="Angst"
widget 1 1 1 1 button var="surprised" text="Ueberraschung"
widget 1 2 1 1 button var="angry" text="Aerger"
widget 1 3 1 1 button var="disgusted" text="Ekel"
widget 1 4 1 1 button var="contemptuous" text="Verachtung"
widget 1 5 1 1 button var="sad" text="Trauer"
widget 1 6 1 1 button var="happy" text="Freude"

right before the form the participants see a sketchpad:

set duration "150"
set description "Displays stimuli"
draw image -497 -309 "Rafd090_[Emotion].png" scale=0.604 center=0 show_if="always"

At the moment my logger file looks like this:

image

My goal is to have only one variable in the logger file that shows if the participant chose the right answer or not. Do you have any ideas how I could get this done? Any help is appreciated :-)

Best wishes
Daniel

Comments

  • edited 12:07AM

    Hi Daniel,

    My goal is to have only one variable in the logger file that shows if the participant chose the right answer or not. Do you have any ideas how I could get this done? Any help is appreciated

    You would need to add a simple inline_script after the form, that recodes the variables so that there is a single variable that contains the name of the emotion that has been selected. For example like so:

    # A list of all emotions, which should correspond to
    # the variables in the form.
    emotions = ['fearful', 'surprised',
        'angry', 'disgusted',
        'contemptuous', 'sad',
        'sad']
    
    # Walk through all emotions, and set the variable
    # `emotion_response` to the name of the emotion
    # variable that has been set to yes.
    for emotion in emotions:
        if self.get(emotion) == 'yes':
            exp.set('emotion_response', emotion)
    

    Alternatively, you could use checkbox widgets instead of buttons. Then you wouldn't need to recode at all:

    set margins "50;100;50;100"
    set rows "1;1;1;1;1;1;1"
    set spacing "25"
    set description "A generic form plug-in"
    set cols "1;1"
    widget 1 0 1 1 checkbox click_accepts="yes" text="Angst" var="emotion_response"
    widget 1 1 1 1 checkbox click_accepts="yes" text="Ueberraschung" var="emotion_response"
    widget 1 2 1 1 checkbox click_accepts="yes" text="Aerger" var="emotion_response"
    widget 1 3 1 1 checkbox click_accepts="yes" text="Ekel" var="emotion_response"
    widget 1 4 1 1 checkbox click_accepts="yes" text="Verachtung" var="emotion_response"
    widget 1 5 1 1 checkbox click_accepts="yes" text="Trauer" var="emotion_response"
    widget 1 6 1 1 checkbox click_accepts="yes" text="Freude" var="emotion_response"
    

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 12:07AM

    Hi Sebastiaan,

    works perfect! Many thanks!

    Best wishes
    Daniel

Sign In or Register to comment.