OS (e.g. Win10): Mac Catalina
PsychoPy version (e.g. 1.84.x): 2021.2.3
Standard Standalone? (y/n) If not then what?: Standalone
What are you trying to achieve?:
After proceding through series of practice stimuli in a loop, participants are supposed to rate a test stimuli using a rating scale (called testSlider). I would like to create a condition for the “continue” button (testContinueButton) to appear below the scale only after the participant has interacted with it, so they can’t skip answers. (aka, force answers).
The participant does not need to answer in any particular way on the scale, they just need to have clicked it.
What did you try to make it work?:
my testContinueButton is set to “set every repeat” and have the start set to “condition” with the condition being mouse_testSlider (I saw another person using a similar line so I tried it…).
What specifically went wrong when you tried that?:
Traceback (most recent call last):
File “/Users/libbyroberts/Documents/ContourPhase1/Phase1Procedure_lastrun.py”, line 2437, in
if testContinueButton.status == NOT_STARTED and mouse_testSlider:
NameError: name ‘mouse_testSlider’ is not defined
The button worked fine (albeit appearing before interaction with the ratingScale) until I changed the start to conditional. I believe the issue is that I don’t know what exactly to write in the box that defines the interaction with the testSlider element.
I checked out the conditional component instruction page on the website, but it speaks more to timed/framed conditions rather than interaction with another component.
Thanks for your help!
Hey there, funny thing, I had the same problem a few days ago.
I got it to work using the form and button responses (betas) in the builder.
The form-response lets you create an excel-sheet, I used this instead of the one I created previously.
You’ll need to deselect the “force end of routine”- Box for the button.
Using the form component with the slider-option, it has the function “form.complete”. I used this function as the start-condition for the button-component.
My form was called form_demografie, so I set form_demografie.complete as start time for the button.
Doing it this way, you won’t need a mouse component, because in the button component is one.
Worked pretty good for me, let me know if you have any questions and if it worked in your case as well.
I’m guessing in the example you saw,
mouse_testSlider was the name of a variable they’d defined elsewhere, whereas in your experiment it doesn’t exist. To make the button appear when there’s been a response to your
testSlider you’d do:
testSlider.rating is not None
Interesting solution! TParson’s suggestion worked/was the quickest fix, but I will keep this in mind as I will most definitely be working with more complex situations in the future. Thank you!
Quick update: I pushed the experiment to Pavlovia and the continue button now appears when the routine starts instead of when the participant engages the rating scale. Any idea on an alternative I can replace this command with that runs on JS?
You could try
or possibly even
The problem might be None translating to null instead of undefined rather than .rating