random audio

rivetopiarivetopia Member Posts: 12
any suggestions for having a button trigger random audio files

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Make an attribute that's an integer. Call it 'Sound' or something.

    Make a button actor.

    Have a rule in this actor that says:

    When mouse is over actor
    AND
    When mouse is down

    Change attribute 'Sound' to (function) Random (1,10)

    Then have a rule within this that says If attribute Sound = 1 then play this sound.

    Repeat for other sounds

    That should do it - making a fart sim perchance? ;)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • rivetopiarivetopia Member Posts: 12
    Thanks, quantumsheep, That worked perfect.
  • ZillaZilla Member Posts: 157
    Is there no shorter way like the one with the image attribute:
    "sound-"..self.randomSound..".ogg"?
  • StrobanikStrobanik Member Posts: 77
    Zilla.. I would like to know that too. But I don't think so, since you can't tie a sound to an actor like you do with images...

    But it would be great if you could do it in som other clever way. Anyone?
  • spaceneedlespaceneedle PRO Posts: 93
    No, I don't think you can. It would really simplify rule sets for sound board apps, rather than having a special button for every sound with a rule set.
Sign In or Register to comment.