I have created an experiment that works well on my device and is in the process of being run online. The experiment keyboard keys to move the slider.marker left and right. Currently, the keyboard moves the slider.marker in set increments in either direction, is it possible to create a code that allows the slider.marker to move continuously when the keys are pressed down? I tried this code (3 pictures) in the begin exp tab, but it is JS so I am not sure if it works yet, as my experiment has not been put online yet. Is there an alternate code I can try that will work on both my local device and online? I also have this in my “each frame” tab. This code allows each key to indicate a certain direction.
"#creating option to confirm slider location
if ‘3’ in key_direction_resp.keys:
slider_locked = True
#setting left and right directions using button press
if not slider_locked:
if ‘1’ in key_direction_resp.keys:
slider_Objects18in.markerPos -= .1
elif ‘2’ in key_direction_resp.keys:
slider_Objects18in.markerPos += .1 #counting following frames
thisFrame += 1 "
Thank you @wakecarter ! I see there are two scripts, java and python to do this. This experiment will be run online so I assume I should use the JS? Is there a set of lines that you recommend to use that is specific for keyboard presses to be continuous? As I will not be using mouse responses in my experiment. Could line 775 - 814 work? Again much thanks for your help!
my experiment requires the ‘slider’ instead of the ‘rating’ slider style. I tried to change this by adding a code in the begin experiment tab (slider_style='slider), however this does not do the trick.
secondly, my experiment uses the 1,2, and 3 keys. 1 moves the slider marker left, 2 moves the slider marker right and 3 confirm the slider marker location by ‘locking it.’ Upon running my experiment, when any of these keys are pressed, there is no movement in the slider marker position. Below is the code I have
I see, I’ve deleted the keysWatched=[‘1’, ‘2’, ‘3’] from my begin routine. I am still running into the issue that I started with: the marker is still moving in increments rather than smoothly along the slider. I have tried changing my slider does not move smoothly along the slider_granularity =.1, sliding =slider_granulairty and slideSpeed=3. I’m assuming my error is with one of these 3 variables?
since there are 36 dashes, is it possible to create a code that allows the slider to continually move along the 36 dashes when the keys are pressed rather than jumping from each tick mark to the next? or is it as simple as creating a variable: slider_increment = continuous? I am having trouble narrowing down the line in your builder that allows the left and right keys to produce continuous movement in each direction.