Author Topic: How To Randomise Sounds When Scrolling?  (Read 2584 times)

dylan1988

  • Jr. Member
  • **
  • Posts: 12
  • "I love the power glove... It's soo bad!
    • View Profile
How To Randomise Sounds When Scrolling?
« 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

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: How To Randomise Sounds When Scrolling?
« Reply #1 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.

djlunchbox

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: How To Randomise Sounds When Scrolling?
« Reply #2 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,