Attract-Mode Support Forum

Attract-Mode Support => General => Topic started by: dylan1988 on November 12, 2017, 09:59:46 PM

Title: How To Randomise Sounds When Scrolling?
Post by: dylan1988 on November 12, 2017, 09:59:46 PM
Hey guys,

I currently have the latest build of Attract Mode, using the latest Game Station layout. I would like to know if it's possible to randomise the sound played (from the "sounds" folder), when scrolling up or down through the games list. i.e Like Hyperspin, where a different sound is played every time you scroll up or down the games list. I know how to assign a single sound to up, and another sound to down, but I want them to randomise to any 1 of the 125 .mp3 samples that I have in the "sounds" folder.

Any help would be greatly appreciated!

Cheers,

Dylan
Title: Re: How To Randomise Sounds When Scrolling?
Post by: keilmillerjr on November 13, 2017, 03:06:34 AM
Yes. This is something you have to program yourself.

This is how I would go about it:

Read files in folder and store names in an array (table).
Use transitions.
Count array.
Use randInt function in my helpers module using count for max.
Play filename of random array slot.
Title: Re: How To Randomise Sounds When Scrolling?
Post by: djlunchbox on December 21, 2018, 09:49:35 AM
Ok I need to bump this because I have no idea how to do it still.

Does anyone have a fix that can explain it in laymans terms? lol

Thanks,