Howdy, Stranger!

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

Supported by

[solved] Piping text error

edited September 2014 in OpenSesame

Hello! I'm having a hard time getting OpenSesame to pipe text correctly. From what I can tell, this is supposed to be easy to do: the text input is stored as a variable (e.g., "input1") and this can be called up in a text display/sketchpad by referring to the variable (e.g. "[input1]"; http://osdoc.cogsci.nl/2.8.3/usage/feedback/)

Sounds okay in theory, but I'm finding that it won't print the contents of an initial variable in this way. All of the other text appears and no error occurs, but instead of printing the contents of that variable, it only prints a blank space. I KNOW that OpenSesame records the response to the first variable, because the logger records the response in the output file.

Here's the relevant syntax for a variable named "target" in the initial question and called up by the second form and the logger. The logger has no trouble reading the "target" variable, but the form won't.

What am I missing here?

define form_text_input TargetSelect
    set rows "5;2"
    set cols "1"
    set form_question "Now, write the first name of that person in the box below."
    set form_var "target"
    widget 0 0 1 1 label center="no" text="[form_question]"
    widget 0 1 1 1 text_input focus="yes" stub="" return_accepts="yes" var="[form_var]"

define form_text_input Targ1
    set rows "4;3"
    set cols "1"
    widget 0 0 1 1 label center="no" text="Now, take a few moments to think about a personal experience in which you felt this way about your relationship with [target]."
    widget 0 1 1 1 text_input focus="yes" stub="" return_accepts="yes" var="Targ1"

define logger logger
    set ignore_missing "yes"
    set description "Logs experimental data"
    set auto_log "no"
    set use_quotes "no"
    log "target"

Comments

  • edited 6:42PM

    Hi,

    The problem is the time at which forms are prepared. OpenSesame uses a prepare-run strategy, which is explained here:

    In all likelihood, what happens is this:

    1. TargetSelect is prepared
    2. Targ1 is prepared
    3. TargetSelect is executed, collecting the variable target
    4. Targ1 is executed, but doesn't show target because it was prepared before this variable was collected.

    Does that make sense?

    What you could do to work around this is put both form items in a sequence of their own (so not in the same sequence). This helps, because, as described under the link I posted above, the prepare-run strategy occurs at the level of sequence items. Put diffrently, a sequence will prepare its items during its own run phase.

    Hope this helps!

    Cheers,
    Sebastiaan

  • edited 6:42PM

    Sebastian,

    Thank you for your help, that makes a lot of sense.

    However, I've tried putting each form item in a separate sequence in the study, but the problem persists. Is this because they are both in the same sequence at the level of the study? If so, is there any way around this?

    Am I missing something? Any other advice would be greatly appreciated!

  • edited 6:42PM

    I found a solution that works. Basically, I just had to put the separate sequences into their own separate loops (since loops aren't prepared beforehand). Each "loop" just runs once to go through the sequence.

    I hope this helps others who need to pipe text. Thanks again, Sebastiaan, for the advice!

Sign In or Register to comment.