Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Play Random Audio (http://www.alice.org/community/showthread.php?t=11378)

devinw95 11-29-2015 06:27 PM

Play Random Audio
 
I have a collection of audio clips that I would like to play in random orders to go along with my Alice program. I barely know where to start with this, right now I'm focusing on using random variables and arrays but I don't know how to use these to accomplish my task. Any input/help would be greatly appreciated, thank you!

sfunk 12-12-2015 11:56 PM

1 Attachment(s)
Create a world variable. (Make it a number variable)

Create a world method appropriately named to what your task is.

Use a list function, have the number variable you created be assigned to a random number (use the min and max number to make a range of how many sound clips you are using)

then use if statements below that to find if the variable value == "randomly selected number" then "sound clip whatever" will play.

Use the else section of the if statements to further your conditions to test for the value of the variable.

There are multiple ways to have it loop while your world is running but one of the easiest is to put in a loop and place the method in a event "when the world begins"

MrMoke 12-13-2015 01:40 PM

2 Attachment(s)
Or you can try something easier, and make less code work for you. Just add the single line where it's needed.

sfunk 12-15-2015 05:12 PM

[QUOTE=MrMoke;56940]Or you can try something easier, and make less code work for you. Just add the single line where it's needed.[/QUOTE]

The only downside to not touching the program for close to a year, I barely remember any of it. But with any "language" there is always multiple ways to make something happen.


All times are GMT -5. The time now is 01:35 AM.

Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.