Random Sounds

Hello i would like it that when you press a button the actor would "play" a sound. I don't want it to be the same sound over and over again so i would need to be able to play a random number of sounds.
Maybe there is an easy way!
Please let me know.
-Lu_merlin
Maybe there is an easy way!
Please let me know.
-Lu_merlin
Comments
You then would need a rule on your button that does;
When touch is pressed
Change attribute game.sound to Random (1,X) - X being the number of sunds you have.
Then another rule that says;
If attribute game.sound = 1
Play sound 1
If attribute game.sound = 2
Play sound 2
etc etc
when doing the above thread (i made a game.random integer) the int was an assumption..
i put out text display to show what the random outputs would be and before i did this i would occasionally get missed clicks.. what i've realized with the text output is any time the random number is repeated, then the audio won't play.. example of a random(1,5) which is what i have:
1-play
4-play
3-play
3-no play
4-play
2-play
2-no play
etc..
does anyone have any suggestions
Thanks!
Caleb
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Thanks for replying, I had tried that and checked or unchecked i seem to experience the exact same behavior
Thanks!
Caleb
and if you run into "clipping audio trouble" you actually want "Run to completion" which seemed to work great without having to employ a timer..
But if you did want to solve that potential problem with longer sounds by keeping Run to Completion checked, you could set up as many booleans as you have sounds, and each time a particular sound is pressed toggle between true and false.
By making a set of duplicate sounds, put - for each different sound - when bool. att. SoundX is false, play the first version, then change attribute to true; when SoundX is true, play the second version, change att. to false. this way, if there were two longer sound files the same, one after the other, they'd finish playing, overlap as you would want, and avoid any backlog.
Just an idea if your going to be using longer sounds...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
that's a great suggestion about the bools too. I like that. thanks!