psychopy.org | Reference | Downloads | Github

Slider marker not visible online

URL of experiment: general issue

Description of the problem: Whenever I create a rating slider in the psychopy builder, it works locally but doesn’t display a marker when uploaded online. The response is still recorded and the trial ends but I’d like to have the marker be briefly visible (i.e. how it is within psychopy) to visually confirm the rating choice. I’d like to avoid adding a second action like another mouse click or key press to confirm the rating, in the interest of time.

The experiment was made in the psychopy builder but I’d like to edit the psychojs code online, so I’m looking for a psychojs solution. Any help is appreciated!

Hi

Have you read through this thread?

Best wishes

Wakefield

Hi, the solution in the linked thread seems to be to set the slider to not end the routine and to add another action (e.g. keypress) to end it. I’d really like to avoid adding another step if possible, and to just have the initial selection be the only action in a trial.
Thanks,
Leigh

If you check the time when the slider is clicked then you could end the routine when a further 0.5 seconds (for example) has passed.

Thank you, I’m now trying that approach but I can’t get it to work. This is what I have currently:

if (slider.getRating() !== undefined && slider.status === PsychoJS.Status.STARTED) {
delayClock = m_trialsClock.getTime() + 500;
while (m_trialsClock.getTime()<delayClock){
//do nothing
}
continueRoutine=false;

}

That code has various aspects I’m not familiar with.

In what way is it not working?

Most clocks are in seconds so 500 means wait for 500 seconds.

I would have used delayClock = t+.5

Then instead of trying to stop the routine dead I would probably just have if t > delayClock: continueRoutine = False (Python code)

I tried changing 500 to 0.5 and now it waits 0.5 sec after I make a selection to end the trial. However I’m still not seeing the marker. (apologies if you received this notification twice, I responded to myself the first time I posted this and later realized you may not get a notification for that)

I haven’t tried sliders yet myself but if you implemented do nothing for .5s that may have included drawing the marker.

I’ve just added a slider with a 1 second delay to my template file.

https://run.pavlovia.org/Wake/brookes-template-2020/html

I used:

Each Frame

if slider.getRating() != None and sliderClick==0:
    sliderClick=t
elif sliderClick == 0:
    pass
elif t > sliderClick+1:
    continueRoutine=False

The slider component is set not to force the end of the routine and I have sliderClick=0 in Begin Routine.

This also requires the code to be switched to Both after the initial translation so you can change null to undefined in the JavaScript.

Hi, unfortunately I couldn’t get your code to work for my experiment, not sure why.
Here is how I solved it:

if (slider.getRating()!== undefined && (m_trialsClock.getTime() > (slider.getRT() + 0.3))){
continueRoutine=false;
}

Thank you so much for your help! You were completely right, doing nothing for .5s did include drawing the marker.