Hi!
Use a percentage - the percentage that the entered number represents in the range (e.g, if the slider goes from 1000 to 5000, 3000 would be 50%) multiplied by the span that the thumb (the thing on the slider you drag) can travel.
You can do the following by referencing the location and sizes of objects on the screen using local variables to access properties (e.g. LVAR_slider.left; I strongly encourage this) but for simplicity’s sake, say you had the following global variables:
sliderLeft - the sliders left location
sliderWidth - the width of the slider in pixels
thumbWidth - the width of the thing you drag in pixels
sliderStartVal - 1000 (in the example above)
sliderEndVal - 5000
userEntryVal - the entered number
move thumb to [[sliderLeft + (sliderWidth - thumbWidth) * (userEntryVal - sliderStartVal)/(sliderEndVal - sliderStartVal)]]
[ul]
[li]The (sliderWidth - thumbWidth) part is the distance the thumb can travel.[/li][li](userEntryVal - sliderStartVal)/(sliderEndVal - sliderStartVal) gives you the percentage of the user entered value relative to the value range.[/li][/ul]
Here’s a sample file using local variables, a good thing to learn if you don’t already know them:
File: adjust_slider_from_number.rp (58.8 KB)