Jump to content

Recommended Posts

Posted

Hello all! In celebration of Rocket League supporting cross platform play with the XBone I wanted to finally create a script to accompany my game winning goals!

Currently I have a switch where one button will play this soccer.mp3 while the other cuts the audio in case someone skips the replay during the game. I have a collection of mp3 files that I would like to use from "C:\Rocket" folder and I would like to play a random file from that directory so "C:\Rocket\*.mp3".

 

I am having trouble understanding the random() function and hot to integrate it. Or would I need to create an array before being able to use the random function? Also for note I am trying to use about 20 mp3 files.

#include <MsgBoxConstants.au3>

Global $g_bPaused = False
HotKeySet("{8}", "HotKeyPressed")
HotKeySet("{5}", "HotKeyPressed")

Func HotKeyPressed()
   Switch @HotKeyPressed
      Case "{8}"
         SoundPlay("")
      Case "{5}"
         SoundPlay("C:\Rocket\Soccer.mp3")
   EndSwitch
EndFunc

The recordings are newscasters similar to this. Thought that it would have been nice for this to have been in the game to begin with lol Thanks Everyone! :D

 

 

  • Moderators
Posted

@afallenhope you could do this with _ArrayShuffle():

#include <Array.au3>
#include <File.au3>

Local $aMusic = _FileListToArray("C:\Rocket", "*.mp3", $FLTA_FILES, True)
    _ArrayDisplay($aMusic)
    _ArrayShuffle($aMusic)
    _ArrayDisplay($aMusic)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...