Author Topic: How to play a random sound from a directory between directories.  (Read 782 times)

johnliem

  • Newbie
  • *
  • Posts: 49
Hello

I made a command to play a random sound from a directory and now I want to make a new command  to play a random sound from a directory between 7 directories.













Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How to play a random sound from a directory between directories.
« Reply #1 on: January 12, 2020, 06:23:25 AM »
You'll have to randomize between the directories like this:
Code: [Select]
Set integer [~rand] value as random from 1 to 7
Begin Integer Compare : [~rand] Equals 1
    Play random sound (from directory: {VA_DIR}\Sounds\1)
Else If Integer Compare : [~rand] Equals 2
    Play random sound (from directory: {VA_DIR}\Sounds\2)
Else If Integer Compare : [~rand] Equals 3
    Play random sound (from directory: {VA_DIR}\Sounds\3)
Else If Integer Compare : [~rand] Equals 4
    Play random sound (from directory: {VA_DIR}\Sounds\4)
Else If Integer Compare : [~rand] Equals 5
    Play random sound (from directory: {VA_DIR}\Sounds\5)
Else If Integer Compare : [~rand] Equals 6
    Play random sound (from directory: {VA_DIR}\Sounds\6)
Else
    Play random sound (from directory: {VA_DIR}\Sounds\7)
End Condition
Replace the directory names/paths with the ones you're using, obviously.

johnliem

  • Newbie
  • *
  • Posts: 49
Re: How to play a random sound from a directory between directories.
« Reply #2 on: January 12, 2020, 08:08:24 AM »
Thank you for the reply but where do I have to insert this code?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How to play a random sound from a directory between directories.
« Reply #3 on: January 12, 2020, 08:16:13 AM »
It's just an example of how the action list of a command could look. You need to recreate that in your command.


It's a "Set an Integer Value" action, followed by a "Begin a Conditional (If Statement) Block" action, then alternating between "Play a Random Sound" and "Add Else If to Conditional Block" actions (the last Else is a "Condition Else" action instead, though you could make that another "Add Else If to Conditional Block" action if you prefer).

johnliem

  • Newbie
  • *
  • Posts: 49
Re: How to play a random sound from a directory between directories.
« Reply #4 on: January 12, 2020, 09:03:26 AM »
Okay , I found the easiest way which work for me by using  execute another command with pause in between ;-)