This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-06-24 18:36:07

mohlar
Scratcher
Registered: 2007-05-24
Posts: 100+

How to make sliders affect variable values? And problems of scale.

I've got the first part of a graph-plotting project working but to make it useful for investigation, two sliders need to directly influence the values of two variables (F1 and F2). What happens at the moment is that the sliders show values as normal but don't influence the variables. They always start with F1=1 and F2=2. They then update their display as you'd expect when I run the program - but I don't know how to use the sliders at the outset to set the starting value of the variables.

Also - how do you specify the minimum/maximum range for sliders? (something like -100 to 100)

Once that's all solved, I have to find a way to scale the graph because output values are very small. I know I can multiply them by a fixed value (50) and that works OK - but I need the true result to be seen and obvious. Maybe I need to create an additional variable which divides the result by 50 and displays that?  Feels complicated and clumsy but I can't think of much else at the moment.

Offline

 

#2 2007-06-24 18:52:19

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: How to make sliders affect variable values? And problems of scale.

when greenflag
   set F1 to 1
   set F2 to 2

option-click on the variable display and choose "show slider"
option-click on the slider and choose "set slider min and max"

See calculus's bouncing ball simulation for how to get scaling:
http://scratch.mit.edu/projects/calculus/2200

Offline

 

#3 2007-06-25 02:54:37

mohlar
Scratcher
Registered: 2007-05-24
Posts: 100+

Re: How to make sliders affect variable values? And problems of scale.

Thanks again Kevin - realised after going to bed that the scale problem didn't exist, I was just too tired to see it, but thanks for the reference, I've checked that out for future use and the neat way the horizontal 'graph lines' are drawn is a useful little feature in itself.

Last edited by mohlar (2007-06-25 02:57:21)

Offline

 

Board footer