Howdy, Stranger!

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

Supported by

Problems with "Run if" function

Hello!

I was trying to implement "run if" statement in the experiment sequence and faced an unexpected problem. Here's what I typed in "run if" in sequence:

It was supposed that correct_answer will be shown only if the participant provides correct answer during the trial, and incorrect_answer will be shown only if the participant provides incorrect answer. However, during the experiment only the option that has [correct]=0 statement is shown, regardless of whether the correct or the incorrect answer was provided.

Don't know how to fix this. Maybe the problem is somewhere in the code defining the correct answer, idk, wrote it according to tutorial.

if var.pic_test == 'Human':

var.correct_response = 'right'

elif var.pic_test == 'Nonhuman':

var.correct_response = 'left'

else:

raise Exception('Invalid picture' % var.pic_test)


kind regards for any help,

wyeird

Comments

  • Hi Wyeird,

    It looks like you are using those statements on sketchpads. Is that true? Could you try replacing them with feedback items? The difference is that sketchpad items are made in the prepare phase, whereas feedback items are prepared in the run phase. As your correct variable is only created in the run phase (after a response has been recorded), it won't exit to index the sketchpad. See here:

    https://osdoc.cogsci.nl/3.3/manual/prepare-run/

    Eduard

    Buy Me A Coffee

  • Hi @eduard,

    Thank you for the advice! Just tried to implement it, however, still doesn't work... Regardless of whether the answer is right or wrong, the program still only outputs the incorrect_answer screen.

    Just in case, I'm attaching screenshots of the experiment's structure, mb the problem lies there and I just don't see it...


  • What are the response keys?

    Can you also share your experiment? That way it will be quicker for me to find the problem.

    Eduard

    Buy Me A Coffee

  • Response keys: left; right

    Here's the experiment: https://dropmefiles.com/6zEQV

    Thank you so much!


  • I removed the images to save storage space, so you have to add them again to test your experiment. The problem had to do with too many keypresses required to proceed. Generally, the stimulus should not need a keypress as duration. ideally it is set to 0 and the stimulus duration is handled with the duration field in the keyboard response item. In any case, when I made those changes, your experiment seems to do what it is supposed to. Could you confirm that?

    Eduard

    Buy Me A Coffee

  • Thanks a lot! Now it works. I never would have guessed that the duration of the stimulus could break things down like this

  • Nice!

    It is not the duration itself, but the fact that you had to press a key that caused the issue.

    Buy Me A Coffee

Sign In or Register to comment.