Howdy, Stranger!

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

Supported by

Returning to a custom form from a sketchpad within a sequence

Hi, I am new to OpenSesame and am trying to figure out if I can set up the experiment as needed.

I have created a custom form (main_form) to appear first in a sequence which presents a calculation task the participants have to complete. Which task appears is directed from the loop to which the sequence belongs.

On the form they have a few different buttons: one to indicate whether they are done with the task and so the participants should not move on to the next task until this button is pressed. Other buttons provide access to different pieces of instructions. If participants press the instruction buttons I want to be able to return to the form (as the task is not finished). But I am having trouble figuring out how to get that accomplished.

I have created the instructions with sketchpad and in the sequence these items are only entered if the button is pressed. So that works fine. But I am not seeing a way where I can tell the sequence to return to the main_form if the finished task button has not been pressed. Instead the program quite naturally considers the trial to be over and presents the next task when I return from the instruction piece I am viewing.

I've tried a few ways to do it without success, and am now trying to use an inline script to direct the program back to the main_form if the variable taskFinished=="no" (this variable is set to yes when Task finished button is pressed). But there doesn't seem to be any way for me to go back to the main_form (none of the commands I thought I might use, such as goto or run seem to work).

Is there anyway for me to get this done? I must admit my programming skills are rusty so it might be something incredibly simple I'm just not seeing. Thank you for any help in advance!

Comments

  • Hi,

    This would require a little inline_script but nothing terribly complicated. Essentially, you can use the items object to explicitly execute items based on specific variables. So for example, say that your control_form sets three variables (task1, task2, and exit), then you could do something like the following:

    while True:
        items.execute('control_form')
        if var.task1 == 'yes':
            items.execute('task1')
        if var.task2 == 'yes':
            items.execute('task2')
        if var.exit == 'yes':
            break
    

    For more information, see:

    I also attached a simple working example.

    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

  • Thank you Sebastian! This was exactly what I needed and it works. The experiment returns to the form and the right task is set.

    However, one problem has emerged. Once I have pressed one of the instruction buttons and then returned to the main_form the buttons for the instructions on the custom form don't work anymore (the ones I have already pressed at least) - and I can see it on the variable inspection that the form buttons do not get set to "yes" when pressed.

    I want participants to be able to return to the instructions as often as they need while solving the task (this is one dependent variable). I can't find anything that could explain this in the manual - but like with the items object, I might be overlooking something obvious.

  • I was overlooking something obvious! As soon as I posted the comment (after struggling with this for a while) I figured it out. Feel free to ignore the previous post...

  • Good to hear your figured it out!

    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

Sign In or Register to comment.