Discuss Scratch

scratchdoodlegirl
Scratcher
25 posts

Need help with variables.

I'm making a music game where you can change the instrument, note, drum, rest, etc. with sliders (a form of variables). The sliders are preset from 0-100. How do I change the range of the variable numbers? Is it possible to use decimals, like 0-1 (including all the decimals in between)? Because I'm sure that people don't want to have 19 second rests. And there are only so many instruments, notes, and drums.

http://versatilenerd.weebly.com | http://haiitsnikkih.deviantart.com | http://www.colourlovers.com/lover/colorfulmuffin

Scratch | Java | JavaScript | Python

Photoshop | Pixelmator | Flash | GIMP | ArtStudio | Brushes 3
CAA14
Scratcher
500+ posts

Need help with variables.

scratchdoodlegirl wrote:

I'm making a music game where you can change the instrument, note, drum, rest, etc. with sliders (a form of variables). The sliders are preset from 0-100. How do I change the range of the variable numbers? Is it possible to use decimals, like 0-1 (including all the decimals in between)? Because I'm sure that people don't want to have 19 second rests. And there are only so many instruments, notes, and drums.
If i understand your question right, you're asking how to expand/set the parameters/scope of sliders, right?

Well, i don't believe you can do that, but i will test something and get back with you… I may be able to figure that out.

Engine Center! Check it out! 6 Engine's to jump start your project! - Jumper! Collect Gold in style! - Birds the arcade game! - Mind blowing math challenge!
scubajerry
Scratcher
1000+ posts

Need help with variables.

You can program buttons to change a variable any way you want to.
drmcw
Scratcher
1000+ posts

Need help with variables.

If you show a variable on the stage, you can then right click on the variable and select slider from the pop up menu and once set can right click and then set the min and max values for the slider. If you set min to 0.1 and max to 1 then it will use increments of 0.1. Works for version 1.4 and assume 2 is no different.

Yep just tried it with version 2 and it works as well, in fact uses increments of 0.01 too.

Last edited by drmcw (July 17, 2013 20:16:45)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
scratchdoodlegirl
Scratcher
25 posts

Need help with variables.

drmcw wrote:

If you show a variable on the stage, you can then right click on the variable and select slider from the pop up menu and once set can right click and then set the min and max values for the slider. If you set min to 0.1 and max to 1 then it will use increments of 0.1. Works for version 1.4 and assume 2 is no different.

Yep just tried it with version 2 and it works as well, in fact uses increments of 0.01 too.

Thank you so much for your help! Yes, it does work in 2.0. Thank you again! I can definitely use this in many scripts.

http://versatilenerd.weebly.com | http://haiitsnikkih.deviantart.com | http://www.colourlovers.com/lover/colorfulmuffin

Scratch | Java | JavaScript | Python

Photoshop | Pixelmator | Flash | GIMP | ArtStudio | Brushes 3
scratchdoodlegirl
Scratcher
25 posts

Need help with variables.

CAA14 wrote:

scratchdoodlegirl wrote:

I'm making a music game where you can change the instrument, note, drum, rest, etc. with sliders (a form of variables). The sliders are preset from 0-100. How do I change the range of the variable numbers? Is it possible to use decimals, like 0-1 (including all the decimals in between)? Because I'm sure that people don't want to have 19 second rests. And there are only so many instruments, notes, and drums.
If i understand your question right, you're asking how to expand/set the parameters/scope of sliders, right?

Well, i don't believe you can do that, but i will test something and get back with you… I may be able to figure that out.

Oh, don't worry about it. Someone else gave me an answer.

http://versatilenerd.weebly.com | http://haiitsnikkih.deviantart.com | http://www.colourlovers.com/lover/colorfulmuffin

Scratch | Java | JavaScript | Python

Photoshop | Pixelmator | Flash | GIMP | ArtStudio | Brushes 3
scratchdoodlegirl
Scratcher
25 posts

Need help with variables.

scubajerry wrote:

You can program buttons to change a variable any way you want to.

That does not answer my question, but I already got a different answer.

http://versatilenerd.weebly.com | http://haiitsnikkih.deviantart.com | http://www.colourlovers.com/lover/colorfulmuffin

Scratch | Java | JavaScript | Python

Photoshop | Pixelmator | Flash | GIMP | ArtStudio | Brushes 3
CAA14
Scratcher
500+ posts

Need help with variables.

scratchdoodlegirl wrote:

CAA14 wrote:

scratchdoodlegirl wrote:

I'm making a music game where you can change the instrument, note, drum, rest, etc. with sliders (a form of variables). The sliders are preset from 0-100. How do I change the range of the variable numbers? Is it possible to use decimals, like 0-1 (including all the decimals in between)? Because I'm sure that people don't want to have 19 second rests. And there are only so many instruments, notes, and drums.
If i understand your question right, you're asking how to expand/set the parameters/scope of sliders, right?

Well, i don't believe you can do that, but i will test something and get back with you… I may be able to figure that out.

Oh, don't worry about it. Someone else gave me an answer.
I see, and am glad someone knew about that, because i didn't.

Engine Center! Check it out! 6 Engine's to jump start your project! - Jumper! Collect Gold in style! - Birds the arcade game! - Mind blowing math challenge!
scratchdoodlegirl
Scratcher
25 posts

Need help with variables.

CAA14 wrote:

scratchdoodlegirl wrote:

CAA14 wrote:

scratchdoodlegirl wrote:

I'm making a music game where you can change the instrument, note, drum, rest, etc. with sliders (a form of variables). The sliders are preset from 0-100. How do I change the range of the variable numbers? Is it possible to use decimals, like 0-1 (including all the decimals in between)? Because I'm sure that people don't want to have 19 second rests. And there are only so many instruments, notes, and drums.
If i understand your question right, you're asking how to expand/set the parameters/scope of sliders, right?

Well, i don't believe you can do that, but i will test something and get back with you… I may be able to figure that out.

Oh, don't worry about it. Someone else gave me an answer.
I see, and am glad someone knew about that, because i didn't.

Well, then, both of us learned something new.

http://versatilenerd.weebly.com | http://haiitsnikkih.deviantart.com | http://www.colourlovers.com/lover/colorfulmuffin

Scratch | Java | JavaScript | Python

Photoshop | Pixelmator | Flash | GIMP | ArtStudio | Brushes 3

Powered by DjangoBB

Standard | Mobile