How to skip the next rountine when time is up?

Hi,
I am currently implementing an experiment with 3 different routines:
first rountine “Stimuli”: the stimulus is presented with the request to solve the given task within 15 seconds max of time. If the participant solves the task before time is up, by clicking on a polygon they can end the routine and go on the next one.
second routine “Solution”: in this routine is possibile to enter the solution of the task just solved.
third routine “Feeling”: is possible to report the emotion felt during the task completion/ missed completion.
How do I code the: “Skip routine “Solution” if time is up in Routine “Stimuli”?”

NOTE: IF IN ROUTINE “Stimuli” THE TIME IS UP (the 15seconds are over) THE ROUTIN WILL END AUTOMATICALLY AND THE PARTICIPANT WILL NOT SEE THE ROUTINE “Solution”, BUT THEY WILL SEE DIRECTLY THE ROUTINE “Feeling”.

Thank you,
Cecilia

Put a code component in Stimuli with skipSolution = False in Begin Routine and skipSolution = True if the task has been solved in End Routine.

Then go to the routine settings for Solution and put skipSolution in the skip if field.

1 Like

Thank you so much!
With your suggestion, now when the time is up, the Solution routine is skept.

However, can you help me adding an extra step?
The Stimuli routine has an arrow that the participant can press to skip to the Solution routine. If the participant solves the task before time is up, by clicking on a polygon they can end the routine and go on the next one, the Solution one. However with your suggestion this is not possible, the arrow is disabled. I would need a code line which tells me “if the arrow is pressed, egnor the request to skip Solution/ go to Solution and follow the normal loop”.

To clarify…

if Stimuli ends because arrow is pressed: show Solution
else if Stimuli ends because polygon is pressed and task solved: show Solution
else if Stimuli ends with no solution: skipSolution

What does your current code look like?

This is it:
if Stimuli ends because arrow is pressed: show Solution
else if Stimuli ends because time is up (time out after 15seconds): skip Solution

My code:

Thank you so much for your help

That looks like Builder code not your code component. Please could you copy and past from your code component. My assumption, unless you say otherwise, is that the code comes from the End Routine tab in the Stimuli routine.

Exacty this is the Builder code.
Here the codes I put in the code component of the Stimuli routine + the setup of Routine Setting of “Solution”.

Sorry for the misunderstanding.


That code will always skip the solution, if you have put skipSolution in the Solution routine settings. My recommendation was

skipSolution = True if the task has been solved in End Routine.

How about:

if mouse_6.clicked_name != 'arrow_6':
     skipSolution = True

I tried as you suggested, using:
(in Stimuli < Code < End Routine)
if mouse_6.clicked_name != ‘arrow_6’:
skipSolution = True

It didn’t work, if I click or not is always showing me the Solution routine.

So I tryed again:
(in Stimuli < Code < Begin Routine)
skipSolution = False
(in Stimuli < Code < End Routine)
if mouse_6.clicked_name != ‘arrow_6’:
skipSolution = True

It didn’t work, if I click or not is always showing me the Solution routine.

So I tried to improvise, but I failed:
(in Stimuli < Code < Each Frame)
if mouse_6.clicked_name == ‘arrow_6’:
skipSolution = False
(in Stimuli < Code < End Routine)
if mouse_6.clicked_name != ‘arrow_6’:
skipSolution = True

Is possible I am missing something out, is there something elese I can try?

Thank you so much for your help, I really appreciate it!

Was it skipping when you just had skipSolution = True?

Please show a screenshot of the Solution Routine settings where you have added skipSolution

Was it skipping when you just had skipSolution = True?
No.

The Solution routine was skipped only when there was “Skip if $ skipSolution” was setted in the Solution Routine setting. With no distinction between click or not click.

Here the screen shot of Solution Routine setting:

For this to work you need

  1. skipSolution = False in Stimuli Begin Routine
  2. skipSolution = True in Stimulis End Routine (Add if mouse_6.clicked_name != ‘arrow_6’: once you have confirmed that it works at all)
  3. Skip if $ skipSolution in Routine Settings in Solution

My post was about how to modify step 2 and I did not mean to imply that you should remove/change step 1 and 3 when you change step 2.

Thank you for clarifying.
I tried, but still is not working. If I click or I don’t click, the Solution is skipped.

Okay – but that’s different from when you previously said it wasn’t skipping. What does your code in End Routine currently look like?

I tried both:
option 1: skipSolution = True
(and it wasn’t working);

so I tried option 2:
if mouse_6.clicked_name != ‘arrow_6’:
skipSolution = True
(it didn’t work)

Now is settled as:
if mouse_6.clicked_name != ‘arrow_6’:
skipSolution = True

By option 1 not working do you mean that it skipped Solution no matter what you clicked?

Please try:

print('mouse_6.clicked_name',mouse_6.clicked_name)
if mouse_6.clicked_name != ‘arrow_6’:
     skipSolution = True

and tell me what appears in the console as values for mouse_6.clicked_name?