Howdy, Stranger!

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

Supported by

[solved] A conditional statement does not work

edited December 2020 in OpenSesame

In this experiment, when the answer 'Rep' is correct, the program executes the 'Exact' sequence but after leaving the feedback screen (Vrai_1 ...3), it goes ANYWAY through the 'Erreur' sequence, although the execution of that sequence is conditioned to a correct response in 'Sequence'. When the answer is not correct, the program goes directly to 'Erreur' and loops normally in 'Entrainement'. Why does the program also execute the 'Erreur' part when the answer is correct ?

Please note also that, in reference to my post 'Unable to use sound file', in this program, OS uses correctly the .wav files !

Thank you in advance.

Gérard

Comments

  • edited December 2020

    Hi @gerhono

    The keyboard response that you are collecting with the sketchpad items "Vrai_1", "Vrai_2" and "Vrai_3" are interrupting with the built-in variable "correct". If you set the duration of these sketchpads to something else than "keypress" or "mouseclick" (like 1000 ms) your Run-if statements should work as desired.


    Cheers,


    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • Hi Lotje,

    Thank you for your advise. I understand the mechanism, but my problem is that the "Vrai_n" items will contain a detailed feedback and that I do not want to set a limit of time for reading that text. Have you got an idea about how I could redesign the experiment in order to meet that objective ?

    Have a nice weekend !

    Gérard

  • Hi Gerard,

    Lotje is right, the variable var.correct interacts with every response a participant is giving. So even, if the response is just a keypress to proceed on a sketchpad, if will overwrite var.correct

    To avoid the problem, you either have to avoid other responses during a trial (avoid var.correct to be redefined), or make your own correct variable, that is not touched by Opensesame's internals. For example, once var.correct is defined, you can copy the value to `var.custom_correct = var.correct` and then use this new correct variable to structure your code.

    In the attached experiment you can see a demonstration what happens to the correct variable through the course of the trial, but also an implementation of a custom correct variable.

    Hope this clears things up.

    Eduard


    Buy Me A Coffee

  • Hi Eduard,

    Your solution works fine, thank you very much for the corrected experiment.

    Gérard

Sign In or Register to comment.