Howdy, Stranger!

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

Supported by

Correct vs Incorrect Button Responses

edited June 2016 in OpenSesame

I'm hoping someone can help me figure out how to create an experiment where a participant is shown a left and a right button containing different words on a screen (e.g., "done" and "ton", respectively).

In order to move onto the next set of words, the participant must click on the correct word (e.g., "done"). If they click on the wrong word (e.g., "ton"), nothing will happen, and they will stay on the same screen.

Here's what I have so far:

I've created two variables containing different lists of words, one list for the words that will appear on the left button (labeled "Left") and one list for the words that will appear on the right button (labeled "Right").

I've also included two variables indicated whether the word on the left or the right is correct. In this case if the word appearing on the left side of the screen is the correct response (e.g., "done"), the variable "LeftCorrect" says "yes" and "RightCorrect" says "no".

Here's what my variable lists look like for reference:

image

Now, I've been able to render the buttons to look how I want, but I can't figure out how to disable the left or right buttons according to the correct response lists.

The way it's running now, it doesn't matter if a participant clicks on "done" (the correct response) or "ton" (the incorrect response) the screen will move onto the next trial.

I want it so that the experiment only moves onto the next trial if the participant selects the correct button according to the "LeftCorrect" and "RightCorrect" lists. In the case of my example, the experiment would only move forward if the participant selects "done", whereas, nothing would happen if they select "ton".

Here's what the participant would see on the screen.

image

Here's the code I used to make the experiment in a form base:

set timeout infinite
set spacing 1
set rows "1;1;1;1;1"
set only_render no
set margins "25;25;25;25"
set description ""
set cols "1;1;1;1;1;1;1;1"
set _theme gray
widget 1 2 2 1 button center=yes frame=yes text="[Left]"
widget 5 2 2 1 button center=yes frame=yes text="[Right]"

What do I need to add to the code or to my experiment to make it so that the screen only moves forward when the participant clicks on the correct word?

Comments

  • edited 9:50PM

    Hi TifBiro,

    If I'm not mistaking forms don't have this functionality. What you could do is use the code below (you can save it as an .opensesame file) to basically check the response and keep re-showing the form until the response meets your demands. In the example
    below it will only continue when clicking next if checkbox is checked.

    # Generated by OpenSesame 2.9.7 (Hesitant Heisenberg)
    # Mon Jun 20 10:47:52 2016 (nt)
    # <http://www.cogsci.nl/opensesame>
    
    set background "black"
    set canvas_backend "xpyriment"
    set compensation "0"
    set coordinates "relative"
    set description "Default description"
    set foreground "white"
    set height "768"
    set keyboard_backend "legacy"
    set mouse_backend "xpyriment"
    set sampler_backend "legacy"
    set start "experiment"
    set subject_nr "0"
    set subject_parity "even"
    set synth_backend "legacy"
    set title "New experiment"
    set width "1024"
    
    define inline_script check_resp_script
        set _prepare ""
        ___run__
        #################################################################
        # Check if an checkbox is checked when clicking next; otherwise rerun rating_scale
        #################################################################
        while True:
            # If the response has the value 'None':
            if self.get('rating') == 'None':
                # Rerun the item (after preparing it):
                exp.items['rating_scale'].prepare()
                exp.items['rating_scale'].run()
    
            # Else, the experiment advances normally.
            else:
                break
        __end__
        set description "Executes Python code"
    
    define sequence experiment
        run rating_scale "always"
        run check_resp_script "always"
    
    define form_base rating_scale
        set cols "1;1;1;1;1;1;1"
        set rows "1;1;1;1;1;1;1;1;1;1;1;1"
        widget 0 1 7 1 label text="How attractive do you find:"
        widget 0 2 7 1 label text="activity_text"
        widget 1 4 5 1 rating_scale var="rating" nodes="not attractive;;;;;|;;;;;very attractive"
        widget 5 10 1 1 button text="next"
    

    Best,
    Jarik

Sign In or Register to comment.