Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » New Sound each time button is pressed
- MrWampler
-
Teacher
2 posts
New Sound each time button is pressed
Hello! I am working a on a soundboard where keyboard inputs will play sounds (using a makey makey, if you are familiar…if you are not familiar, don't worry about it. Just assume that I'm using a keyboard for inputs)
I have made a script so that different clips can be played at random, say….if I pressed the spacebar, a different recording could come up at random.
Any ideas for how to make it come up *in order*?
I was using the script:
WHEN space key is pressed
Stop all sounds
Play sound (pick random 1-10)
How do i get it to NOT play at random, but in order?
I have made a script so that different clips can be played at random, say….if I pressed the spacebar, a different recording could come up at random.
Any ideas for how to make it come up *in order*?
I was using the script:
WHEN space key is pressed
Stop all sounds
Play sound (pick random 1-10)
How do i get it to NOT play at random, but in order?
- mstone326
-
Scratcher
1000+ posts
New Sound each time button is pressed
You could create a variable called playSound. Then increment it by 1 each time you play a sound.
Edit: Sorry, in the play sound block you'd snap the orange playSound variable reporter button in, I can't can't the Scratchblock to work.
when green flag clicked
set [playSound v] to [1]
when [space v] key pressed
play sound [(playSound) v] until done
change [playSound v] by (1)
Edit: Sorry, in the play sound block you'd snap the orange playSound variable reporter button in, I can't can't the Scratchblock to work.
Last edited by mstone326 (Dec. 10, 2017 22:45:18)
- Despicable_Dad
-
Scratcher
500+ posts
New Sound each time button is pressed
Or use a list like this https://scratch.mit.edu/projects/192450265/
- MrWampler
-
Teacher
2 posts
New Sound each time button is pressed
thanks guys! I'll play around and report back 

- RPP-Exploration
-
Scratcher
1000+ posts
New Sound each time button is pressed
Try
Until all your sounds have played or for just one sound:
when [space v] key pressed
play sound [ 1st] until done
play sound [ 2nd] until done
play sound [ 3rd] until done
play sound [ 4th] until done
Until all your sounds have played or for just one sound:
when [space v] key pressed
play sound [your sound ] until done
- Derpysquid1730
-
Scratcher
1 post
New Sound each time button is pressed
could i make it to where i press a button (1) it says a different thing each time? i have a list of dialogue i want, and i need it to go down a the list, but only playing 1 or 2 every time i press it for example.(list: hi. im sans. you need help? hey watch it.) (presses1) hi (presses1) im sans.(presses1) you need help?(presses1) hey watch it.
PLease HElp Im DEspEraTE
PLease HElp Im DEspEraTE
- deck26
-
Scratcher
1000+ posts
New Sound each time button is pressed
could i make it to where i press a button (1) it says a different thing each time? i have a list of dialogue i want, and i need it to go down a the list, but only playing 1 or 2 every time i press it for example.(list: hi. im sans. you need help? hey watch it.) (presses1) hi (presses1) im sans.(presses1) you need help?(presses1) hey watch it.Please create your own new topic rather than necroposting.
PLease HElp Im DEspEraTE
- sy14ris
-
New Scratcher
1 post
New Sound each time button is pressed
how do i make my sound play when i upload it and press the green flag, when i press that on my project nothing plays how do i make mine play
- SILVERWOLF2015
-
Scratcher
1 post
New Sound each time button is pressed
How do you make the sound change when pressing the space bar?

- kooqle
-
Scratcher
100+ posts
New Sound each time button is pressed
You can all use a pick random button to change the sound randomly.
when [ v] key pressed
play sound [(pick random (1) to (10)) v]
- Discussion Forums
- » Help with Scripts
-
» New Sound each time button is pressed